From 343f7d61df476203e185c7dbc0e214e2a666858a Mon Sep 17 00:00:00 2001 From: Mitali Patel Date: Tue, 22 Oct 2019 11:08:22 +0000 Subject: [PATCH] [IMP] product: added check_company feature on pricelist Purpose of this commit is pricelist/pricelist item can not created/modifided linking records of diffrent companies together closes odoo/odoo#44391 Task: 2090409 X-original-commit: 9b62813cddb2726003b4b989c32185400059dfa1 Signed-off-by: Damien Bouvy (dbo) --- addons/product/models/product_pricelist.py | 7 ++++--- addons/product/views/product_pricelist_views.xml | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/product/models/product_pricelist.py b/addons/product/models/product_pricelist.py index 8c37bb1cef5..0474a119935 100644 --- a/addons/product/models/product_pricelist.py +++ b/addons/product/models/product_pricelist.py @@ -379,6 +379,7 @@ class PricelistItem(models.Model): _name = "product.pricelist.item" _description = "Pricelist Rule" _order = "applied_on, min_quantity desc, categ_id desc, id desc" + _check_company_auto = True # NOTE: if you change _order on this model, make sure it matches the SQL # query built in _compute_price_rule() above in this file to avoid # inconstencies and undeterministic issues. @@ -389,10 +390,10 @@ class PricelistItem(models.Model): ('company_id', '=', self.env.company.id)], limit=1) product_tmpl_id = fields.Many2one( - 'product.template', 'Product', ondelete='cascade', + 'product.template', 'Product', ondelete='cascade', check_company=True, help="Specify a template if this rule only applies to one product template. Keep empty otherwise.") product_id = fields.Many2one( - 'product.product', 'Product Variant', ondelete='cascade', + 'product.product', 'Product Variant', ondelete='cascade', check_company=True, help="Specify a product if this rule only applies to one product. Keep empty otherwise.") categ_id = fields.Many2one( 'product.category', 'Product Category', ondelete='cascade', @@ -418,7 +419,7 @@ class PricelistItem(models.Model): 'Sales Price: The base price will be the Sales Price.\n' 'Cost Price : The base price will be the cost price.\n' 'Other Pricelist : Computation of the base price based on another Pricelist.') - base_pricelist_id = fields.Many2one('product.pricelist', 'Other Pricelist') + base_pricelist_id = fields.Many2one('product.pricelist', 'Other Pricelist', check_company=True) pricelist_id = fields.Many2one('product.pricelist', 'Pricelist', index=True, ondelete='cascade', required=True, default=_default_pricelist_id) price_surcharge = fields.Float( 'Price Surcharge', digits='Product Price', diff --git a/addons/product/views/product_pricelist_views.xml b/addons/product/views/product_pricelist_views.xml index d22cb8f32b5..18f69f445b7 100644 --- a/addons/product/views/product_pricelist_views.xml +++ b/addons/product/views/product_pricelist_views.xml @@ -62,7 +62,7 @@ @@ -253,6 +253,7 @@ +