Partial port of product_usability

This commit is contained in:
Alexis de Lattre
2016-10-31 15:40:28 +01:00
committed by Raphaël Valyi
parent 4be79484b0
commit 8cc2fe66f4
5 changed files with 50 additions and 93 deletions

View File

@@ -1,3 +1,3 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
from . import product

View File

@@ -1,29 +1,12 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Product Usability module for Odoo
# Copyright (C) 2015 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# © 2015-2016 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Product Usability',
'version': '0.1',
'version': '10.0.1.0.0',
'category': 'Product',
'license': 'AGPL-3',
'summary': 'Small usability enhancements to the product module',
@@ -48,5 +31,5 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
'security/product_security.xml',
'product_view.xml',
],
'installable': False,
'installable': True,
}

View File

@@ -1,31 +1,13 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Product Usability module for Odoo
# Copyright (C) 2015 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# © 2015-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields
from odoo import models, fields
class ProductTemplate(models.Model):
_inherit = 'product.template'
class ProductProduct(models.Model):
_inherit = 'product.product'
price_history_ids = fields.One2many(
'product.price.history', 'product_template_id',
'product.price.history', 'product_id',
string='Product Price History')

View File

@@ -1,13 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py
© 2015-2016 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<openerp>
<data>
<odoo>
<record id="product_price_history_form" model="ir.ui.view">
@@ -16,7 +14,7 @@
<field name="arch" type="xml">
<form string="Product Price History">
<group name="main">
<field name="product_template_id" invisible="not context.get('product_price_history_main_view')"/>
<field name="product_id" invisible="not context.get('product_price_history_main_view')"/>
<field name="datetime"/>
<field name="cost"/>
<field name="company_id" groups="base.group_multi_company"/>
@@ -30,7 +28,7 @@
<field name="model">product.price.history</field>
<field name="arch" type="xml">
<tree string="Product Price History" editable="bottom">
<field name="product_template_id" invisible="not context.get('product_price_history_main_view')"/>
<field name="product_id" invisible="not context.get('product_price_history_main_view')"/>
<field name="datetime"/>
<field name="cost"/>
<field name="company_id" groups="base.group_multi_company"/>
@@ -43,9 +41,9 @@
<field name="model">product.price.history</field>
<field name="arch" type="xml">
<search string="Search Product Price History">
<field name="product_template_id"/>
<field name="product_id"/>
<group string="Group By" name="groupby">
<filter name="product_tmpl_groupby" string="Product" context="{'group_by': 'product_template_id'}"/>
<filter name="product_groupby" string="Product" context="{'group_by': 'product_id'}"/>
<filter name="datetime_groupby" string="Date" context="{'group_by': 'datetime:month'}"/>
</group>
</search>
@@ -59,8 +57,9 @@
<field name="context">{'product_price_history_main_view': True}</field>
</record>
<!--
<menuitem id="product_price_history_menu" action="product_price_history_action"
parent="product.prod_config_main" sequence="55"/>
parent="product.prod_config_main" sequence="55"/> -->
<!-- product.template form view -->
<record id="product_template_form_view" model="ir.ui.view">
@@ -68,50 +67,46 @@
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view" />
<field name="arch" type="xml">
<!--
<group name="general" position="after">
<group name="price_history" string="Price History">
<field name="price_history_ids" nolabel="1"/>
</group>
</group>
-->
<!-- START for wider 'name' field -->
<!-- Don't make it too big, othesize computers with small resolutions
will see the product name + image under the block of buttons -->
<div class="oe_left" position="attributes">
<attribute name="style">width: 700px;</attribute>
</div>
<div class="oe_title" position="attributes">
<attribute name="style">width: 600px;</attribute>
<attribute name="style">width: 650px;</attribute>
</div>
<field name="name" position="attributes">
<attribute name="class"></attribute>
</field>
<field name="description" position="attributes">
<attribute name="attrs">{'invisible': True}</attribute>
</field>
<!-- END for wider 'name' field -->
</field>
</record>
<!-- Also search on EAN13 -->
<record id="product_template_search_view" model="ir.ui.view">
<field name="name">product_usability.product.template.search</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_search_view"/>
<!-- product.category -->
<record id="product_category_list_view" model="ir.ui.view">
<field name="name">usability.product.category.tree</field>
<field name="model">product.category</field>
<field name="inherit_id" ref="product.product_category_list_view"/>
<field name="arch" type="xml">
<field name="name" position="attributes">
<attribute name="filter_domain">['|', '|', ('name', 'ilike', self), ('default_code', 'ilike', self), ('ean13', '=', self)]</attribute>
<field name="display_name" position="after">
<field name="type"/>
</field>
</field>
</record>
<!-- product.product -->
<record id="product_search_form_view" model="ir.ui.view">
<field name="name">product_usability.product.search</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_search_form_view"/>
<record id="product_category_search_view" model="ir.ui.view">
<field name="name">usability.product.category.search</field>
<field name="model">product.category</field>
<field name="inherit_id" ref="product.product_category_search_view"/>
<field name="arch" type="xml">
<field name="name" position="attributes">
<attribute name="filter_domain">['|', '|', ('name', 'ilike', self), ('default_code', 'ilike', self), ('ean13', '=', self)]</attribute>
<field name="parent_id" position="after">
<filter name="view" string="View" domain="[('type', '=', 'view')]"/>
<filter name="normal" string="Normal" domain="[('type', '=', 'normal')]"/>
<group name="group_by" string="Group By">
<filter name="type_groupby" string="Type" context="{'group_by': 'type'}"/>
</group>
</field>
</field>
</record>
@@ -129,5 +124,4 @@
</record>
</data>
</openerp>
</odoo>

View File

@@ -1,13 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 Akretion (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py
© 2015-2016 Akretion (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<openerp>
<data noupdate="1">
<odoo noupdate="1">
<record id="product_price_history_rule" model="ir.rule">
<field name="name">Product price history multi-company</field>
@@ -15,5 +14,4 @@
<field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
</record>
</data>
</openerp>
</odoo>