Partial port of product_usability

This commit is contained in:
Alexis de Lattre
2016-10-31 15:40:28 +01:00
parent 8bcbb83a91
commit e505ce2ad4
5 changed files with 50 additions and 93 deletions

View File

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

View File

@@ -1,29 +1,12 @@
# -*- encoding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## # © 2015-2016 Akretion (http://www.akretion.com)
# # @author Alexis de Lattre <alexis.delattre@akretion.com>
# Product Usability module for Odoo # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# 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/>.
#
##############################################################################
{ {
'name': 'Product Usability', 'name': 'Product Usability',
'version': '0.1', 'version': '10.0.1.0.0',
'category': 'Product', 'category': 'Product',
'license': 'AGPL-3', 'license': 'AGPL-3',
'summary': 'Small usability enhancements to the product module', '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', 'security/product_security.xml',
'product_view.xml', 'product_view.xml',
], ],
'installable': False, 'installable': True,
} }

View File

@@ -1,31 +1,13 @@
# -*- encoding: utf-8 -*- # -*- 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).
# 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/>.
#
##############################################################################
from openerp import models, fields from odoo import models, fields
class ProductTemplate(models.Model): class ProductProduct(models.Model):
_inherit = 'product.template' _inherit = 'product.product'
price_history_ids = fields.One2many( price_history_ids = fields.One2many(
'product.price.history', 'product_template_id', 'product.price.history', 'product_id',
string='Product Price History') string='Product Price History')

View File

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

View File

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