[MIG] product_usability_akretion to v18
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Product Usability',
|
'name': 'Product Usability',
|
||||||
'version': '16.0.1.0.0',
|
'version': '18.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',
|
||||||
@@ -28,13 +28,12 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
|||||||
'depends': ['product'],
|
'depends': ['product'],
|
||||||
"external_dependencies": {"python": ["stdnum"]},
|
"external_dependencies": {"python": ["stdnum"]},
|
||||||
'data': [
|
'data': [
|
||||||
'views/product_supplierinfo_view.xml',
|
'views/product_supplierinfo.xml',
|
||||||
'views/product_pricelist_view.xml',
|
'views/product_pricelist.xml',
|
||||||
'views/product_pricelist_item.xml',
|
'views/product_pricelist_item.xml',
|
||||||
'views/product_template_view.xml',
|
'views/product_template.xml',
|
||||||
'views/product_product.xml',
|
'views/product_product.xml',
|
||||||
'views/product_config_menu.xml',
|
'views/product_config_menu.xml',
|
||||||
'views/product_category_view.xml',
|
|
||||||
],
|
],
|
||||||
'installable': False,
|
'installable': True,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
from . import product_product
|
from . import product_product
|
||||||
from . import product_template
|
from . import product_template
|
||||||
from . import product_supplierinfo
|
from . import product_supplierinfo
|
||||||
from . import product_pricelist
|
|
||||||
from . import product_category
|
from . import product_category
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2022 Akretion (https://www.akretion.com).
|
# Copyright 2022-2024 Akretion (https://www.akretion.com).
|
||||||
# @author Sébastien BEAU <sebastien.beau@akretion.com>
|
# @author Sébastien BEAU <sebastien.beau@akretion.com>
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
@@ -6,8 +6,7 @@ from odoo import fields, models
|
|||||||
|
|
||||||
|
|
||||||
class ProductCategory(models.Model):
|
class ProductCategory(models.Model):
|
||||||
_inherit = ['product.category', "mail.thread", "mail.activity.mixin"]
|
_inherit = 'product.category'
|
||||||
_name = 'product.category'
|
|
||||||
|
|
||||||
name = fields.Char(tracking=10)
|
name = fields.Char(tracking=10)
|
||||||
parent_id = fields.Many2one(tracking=20)
|
parent_id = fields.Many2one(tracking=20)
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
# Copyright 2017-2022 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).
|
|
||||||
|
|
||||||
from odoo import fields, models
|
|
||||||
|
|
||||||
|
|
||||||
class ProductPricelist(models.Model):
|
|
||||||
_inherit = 'product.pricelist'
|
|
||||||
|
|
||||||
company_id = fields.Many2one(default=lambda self: self.env.company)
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2015-2022 Akretion (http://www.akretion.com)
|
# Copyright 2015-2024 Akretion (https://www.akretion.com)
|
||||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
# @author Raphaël Valyi <rvalyi@akretion.com>
|
# @author Raphaël Valyi <rvalyi@akretion.com>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2015-2022 Akretion (http://www.akretion.com)
|
# Copyright 2015-2024 Akretion (https://www.akretion.com)
|
||||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
# @author Raphaël Valyi <rvalyi@akretion.com>
|
# @author Raphaël Valyi <rvalyi@akretion.com>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
@@ -14,7 +14,9 @@ class ProductTemplate(models.Model):
|
|||||||
# in v10, that field was defined in procurement_suggest, but we will
|
# in v10, that field was defined in procurement_suggest, but we will
|
||||||
# probably not port procurement_suggest because it is native in v14
|
# probably not port procurement_suggest because it is native in v14
|
||||||
seller_id = fields.Many2one(
|
seller_id = fields.Many2one(
|
||||||
'res.partner', related='seller_ids.partner_id', store=True,
|
'res.partner',
|
||||||
|
compute="_compute_seller_id",
|
||||||
|
search="_search_seller_id",
|
||||||
string='Main Supplier')
|
string='Main Supplier')
|
||||||
|
|
||||||
# in v14, I noticed that the tracking of the fields of product.template
|
# in v14, I noticed that the tracking of the fields of product.template
|
||||||
@@ -26,7 +28,7 @@ class ProductTemplate(models.Model):
|
|||||||
barcode = fields.Char(tracking=20)
|
barcode = fields.Char(tracking=20)
|
||||||
default_code = fields.Char(tracking=30)
|
default_code = fields.Char(tracking=30)
|
||||||
categ_id = fields.Many2one(tracking=40)
|
categ_id = fields.Many2one(tracking=40)
|
||||||
detailed_type = fields.Selection(tracking=50)
|
type = fields.Selection(tracking=50)
|
||||||
list_price = fields.Float(tracking=60, default=0) # native: default=1.0
|
list_price = fields.Float(tracking=60, default=0) # native: default=1.0
|
||||||
weight = fields.Float(tracking=70)
|
weight = fields.Float(tracking=70)
|
||||||
sale_ok = fields.Boolean(tracking=80)
|
sale_ok = fields.Boolean(tracking=80)
|
||||||
@@ -35,6 +37,18 @@ class ProductTemplate(models.Model):
|
|||||||
company_id = fields.Many2one(tracking=110)
|
company_id = fields.Many2one(tracking=110)
|
||||||
barcode_type = fields.Char(compute='_compute_template_barcode_type')
|
barcode_type = fields.Char(compute='_compute_template_barcode_type')
|
||||||
|
|
||||||
|
def _search_seller_id(self, operator, value):
|
||||||
|
# searching on the first line of a o2m is not that easy
|
||||||
|
# So we search all potential matching products
|
||||||
|
# Then we filter on the seller_id
|
||||||
|
records = self.search([("seller_ids.partner_id", operator, value)])
|
||||||
|
records = records.filtered_domain([("seller_id", operator, value)])
|
||||||
|
return [("id", "in", records.ids)]
|
||||||
|
|
||||||
|
def _compute_seller_id(self):
|
||||||
|
for record in self:
|
||||||
|
record.seller_id = fields.first(record.seller_ids).partner_id
|
||||||
|
|
||||||
# precompute=True doesn't work on product.template
|
# precompute=True doesn't work on product.template
|
||||||
# (works fine on product.product), probably because we don't depend
|
# (works fine on product.product), probably because we don't depend
|
||||||
# on 'barcode'
|
# on 'barcode'
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<odoo>
|
|
||||||
|
|
||||||
<record id="product_category_form_view" model="ir.ui.view">
|
|
||||||
<field name="model">product.category</field>
|
|
||||||
<field name="inherit_id" ref="product.product_category_form_view" />
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<sheet position="after">
|
|
||||||
<div class="oe_chatter">
|
|
||||||
<field name="message_follower_ids"/>
|
|
||||||
<field name="activity_ids"/>
|
|
||||||
<field name="message_ids"/>
|
|
||||||
</div>
|
|
||||||
</sheet>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
</odoo>
|
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!--
|
||||||
Copyright 2022 Akretion France (http://www.akretion.com/)
|
Copyright 2022-2024 Akretion France (https://www.akretion.com/)
|
||||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
-->
|
-->
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
<!--
|
<!--
|
||||||
When the module stock and sale are not installed,
|
When the module stock and sale are not installed,
|
||||||
there is no menu entry for UoM nor Product Categories !
|
there is no menu entry for UoM nor Product Categories !
|
||||||
This set of menu entries entre Configuration > Technical fixes this
|
This set of menu entries under Configuration > Technical fixes this
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<menuitem id="product_config_menu" parent="base.menu_custom"
|
<menuitem id="product_config_menu" parent="base.menu_custom"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<record id="pricelist_item_fullscreen_action" model="ir.actions.act_window">
|
<record id="pricelist_item_fullscreen_action" model="ir.actions.act_window">
|
||||||
<field name="name">Price Rules</field>
|
<field name="name">Price Rules</field>
|
||||||
<field name="res_model">product.pricelist.item</field>
|
<field name="res_model">product.pricelist.item</field>
|
||||||
<field name="view_mode">tree,form</field>
|
<field name="view_mode">list,form</field>
|
||||||
<field name="domain">[('pricelist_id', '=', active_id)]</field>
|
<field name="domain">[('pricelist_id', '=', active_id)]</field>
|
||||||
<field name="context">{'product_pricelist_item_main_view': True}</field>
|
<field name="context">{'product_pricelist_item_main_view': True}</field>
|
||||||
</record>
|
</record>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!--
|
||||||
Copyright 2015-2022 Akretion (http://www.akretion.com/)
|
Copyright 2015-2024 Akretion (https://www.akretion.com/)
|
||||||
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
-->
|
-->
|
||||||
@@ -13,10 +13,16 @@
|
|||||||
<field name="inherit_id" ref="product.product_product_tree_view"/>
|
<field name="inherit_id" ref="product.product_product_tree_view"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="lst_price" position="after">
|
<field name="lst_price" position="after">
|
||||||
<field name="currency_id" invisible="1"/>
|
<field name="currency_id" column_invisible="1"/>
|
||||||
|
<field name="cost_currency_id" column_invisible="1"/>
|
||||||
</field>
|
</field>
|
||||||
<field name="lst_price" position="attributes">
|
<field name="lst_price" position="attributes">
|
||||||
<attribute name="widget">monetary</attribute>
|
<attribute name="widget">monetary</attribute>
|
||||||
|
<attribute name="options">{'currency_field': 'currency_id'}</attribute>
|
||||||
|
</field>
|
||||||
|
<field name="standard_price" position="attributes">
|
||||||
|
<attribute name="widget">monetary</attribute>
|
||||||
|
<attribute name="options">{'currency_field': 'cost_currency_id'}</attribute>
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
@@ -27,7 +33,7 @@
|
|||||||
<field name="inherit_id" ref="product.product_normal_form_view"/>
|
<field name="inherit_id" ref="product.product_normal_form_view"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="barcode" position="after">
|
<field name="barcode" position="after">
|
||||||
<field name="barcode_type" attrs="{'invisible': [('barcode', '=', False)]}"/>
|
<field name="barcode_type" invisible="not barcode"/>
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
@@ -1,22 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!--
|
||||||
Copyright 2015-2020 Akretion (http://www.akretion.com/)
|
Copyright 2015-2024 Akretion (https://www.akretion.com/)
|
||||||
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<record id="product_supplierinfo_search_view" model="ir.ui.view">
|
|
||||||
<field name="model">product.supplierinfo</field>
|
|
||||||
<field name="inherit_id" ref="product.product_supplierinfo_search_view"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<field name="product_tmpl_id" position="after">
|
|
||||||
<field name="product_name" filter_domain="['|', ('product_code', 'ilike', self), ('product_name', 'ilike', self)]" />
|
|
||||||
</field>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="product_supplierinfo_tree_view" model="ir.ui.view">
|
<record id="product_supplierinfo_tree_view" model="ir.ui.view">
|
||||||
<field name="model">product.supplierinfo</field>
|
<field name="model">product.supplierinfo</field>
|
||||||
<field name="inherit_id" ref="product.product_supplierinfo_tree_view"/>
|
<field name="inherit_id" ref="product.product_supplierinfo_tree_view"/>
|
||||||
@@ -14,11 +14,8 @@
|
|||||||
<field name="inherit_id" ref="product.product_template_search_view" />
|
<field name="inherit_id" ref="product.product_template_search_view" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="categ_id" position="after">
|
<field name="categ_id" position="after">
|
||||||
<field name="seller_ids" string="Supplier" filter_domain="[('seller_ids.partner_id', 'ilike', self)]"/>
|
<field name="seller_id" string="Main Supplier"/>
|
||||||
</field>
|
</field>
|
||||||
<filter name="type" position="attributes">
|
|
||||||
<attribute name="context">{'group_by': 'detailed_type'}</attribute>
|
|
||||||
</filter>
|
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
@@ -30,7 +27,7 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="barcode" position="after">
|
<field name="barcode" position="after">
|
||||||
<!-- barcode is False when the template has several variants anyway -->
|
<!-- barcode is False when the template has several variants anyway -->
|
||||||
<field name="barcode_type" attrs="{'invisible': [('barcode', '=', False)]}"/>
|
<field name="barcode_type" invisible="not barcode"/>
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
Reference in New Issue
Block a user