From 09583d15632ce8844a8b7c51834bc17d845bcbd9 Mon Sep 17 00:00:00 2001 From: "Valeriya(vchu)" Date: Tue, 23 May 2023 11:22:01 +0000 Subject: [PATCH] [IMP] product, website_sale: add chatter to pricelist add chatter to product pricelist to improve collaboration. Track currency, company, country groups, discount policy and website fields. task-3316528 closes odoo/odoo#121244 Signed-off-by: Victor Feyens (vfe) --- addons/product/models/product_pricelist.py | 17 +++++++++++++---- .../product/views/product_pricelist_views.xml | 5 +++++ addons/website_sale/models/product_pricelist.py | 9 ++++++++- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/addons/product/models/product_pricelist.py b/addons/product/models/product_pricelist.py index a552836d081..9acad80871d 100644 --- a/addons/product/models/product_pricelist.py +++ b/addons/product/models/product_pricelist.py @@ -7,6 +7,7 @@ from odoo.exceptions import UserError class Pricelist(models.Model): _name = "product.pricelist" + _inherit = ['mail.thread', 'mail.activity.mixin'] _description = "Pricelist" _rec_names_search = ['name', 'currency_id'] # TODO check if should be removed _order = "sequence asc, id desc" @@ -25,16 +26,22 @@ class Pricelist(models.Model): currency_id = fields.Many2one( comodel_name='res.currency', default=_default_currency_id, - required=True) + required=True, + tracking=1, + ) company_id = fields.Many2one( - comodel_name='res.company') + comodel_name='res.company', + tracking=5, + ) country_group_ids = fields.Many2many( comodel_name='res.country.group', relation='res_country_group_pricelist_rel', column1='pricelist_id', column2='res_country_group_id', - string="Country Groups") + string="Country Groups", + tracking=10, + ) discount_policy = fields.Selection( selection=[ @@ -42,7 +49,9 @@ class Pricelist(models.Model): ('without_discount', "Show public price & discount to the customer"), ], default='with_discount', - required=True) + required=True, + tracking=15, + ) item_ids = fields.One2many( comodel_name='product.pricelist.item', diff --git a/addons/product/views/product_pricelist_views.xml b/addons/product/views/product_pricelist_views.xml index 62bdd8cfb66..50e3ee1f035 100644 --- a/addons/product/views/product_pricelist_views.xml +++ b/addons/product/views/product_pricelist_views.xml @@ -119,6 +119,11 @@ +
+ + + +
diff --git a/addons/website_sale/models/product_pricelist.py b/addons/website_sale/models/product_pricelist.py index a106808c3c5..1b3e7483c30 100644 --- a/addons/website_sale/models/product_pricelist.py +++ b/addons/website_sale/models/product_pricelist.py @@ -19,7 +19,14 @@ class ProductPricelist(models.Model): domain = [('company_id', '=', company_id)] return self.env['website'].search(domain, limit=1) - website_id = fields.Many2one('website', string="Website", ondelete='restrict', default=_default_website, domain="[('company_id', '=?', company_id)]") + website_id = fields.Many2one( + comodel_name='website', + string="Website", + ondelete='restrict', + default=_default_website, + domain="[('company_id', '=?', company_id)]", + tracking=20, + ) code = fields.Char(string='E-commerce Promotional Code', groups="base.group_user") selectable = fields.Boolean(help="Allow the end user to choose this price list")