Add module product_usability
This commit is contained in:
3
product_usability/__init__.py
Normal file
3
product_usability/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
|
||||
from . import product
|
||||
47
product_usability/__openerp__.py
Normal file
47
product_usability/__openerp__.py
Normal file
@@ -0,0 +1,47 @@
|
||||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
{
|
||||
'name': 'Product Usability',
|
||||
'version': '0.1',
|
||||
'category': 'Product',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Small usability enhancements to the product module',
|
||||
'description': """
|
||||
Product Usability
|
||||
=================
|
||||
|
||||
The usability enhancements include:
|
||||
* show the object product.price.history in the product template form view
|
||||
|
||||
This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
|
||||
""",
|
||||
'author': 'Akretion',
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['product'],
|
||||
'data': [
|
||||
'security/product_security.xml',
|
||||
'product_view.xml',
|
||||
],
|
||||
'installable': True,
|
||||
}
|
||||
31
product_usability/product.py
Normal file
31
product_usability/product.py
Normal file
@@ -0,0 +1,31 @@
|
||||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp import models, fields
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = 'product.template'
|
||||
|
||||
price_history_ids = fields.One2many(
|
||||
'product.price.history', 'product_template_id',
|
||||
string='Product Price History')
|
||||
81
product_usability/product_view.xml
Normal file
81
product_usability/product_view.xml
Normal file
@@ -0,0 +1,81 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
|
||||
<record id="product_price_history_form" model="ir.ui.view">
|
||||
<field name="name">product.price.history.form</field>
|
||||
<field name="model">product.price.history</field>
|
||||
<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="datetime"/>
|
||||
<field name="cost"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="product_price_history_tree" model="ir.ui.view">
|
||||
<field name="name">product.price.history.tree</field>
|
||||
<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="datetime"/>
|
||||
<field name="cost"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="product_price_history_search" model="ir.ui.view">
|
||||
<field name="name">product.price.history.search</field>
|
||||
<field name="model">product.price.history</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Product Price History">
|
||||
<field name="product_template_id"/>
|
||||
<group string="Group By" name="groupby">
|
||||
<filter name="product_tmpl_groupby" string="Product" context="{'group_by': 'product_template_id'}"/>
|
||||
<filter name="datetime_groupby" string="Date" context="{'group_by': 'datetime:month'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="product_price_history_action" model="ir.actions.act_window">
|
||||
<field name="name">Product Price History</field>
|
||||
<field name="res_model">product.price.history</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<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"/>
|
||||
|
||||
<!-- product.template form view -->
|
||||
<record id="product_template_form_view" model="ir.ui.view">
|
||||
<field name="name">usability.product.template.form</field>
|
||||
<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>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
19
product_usability/security/product_security.xml
Normal file
19
product_usability/security/product_security.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
|
||||
<record id="product_price_history_rule" model="ir.rule">
|
||||
<field name="name">Product price history multi-company</field>
|
||||
<field name="model_id" ref="product.model_product_price_history"/>
|
||||
<field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user