[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) <dbo@odoo.com>
This commit is contained in:
committed by
Damien Bouvy
parent
96d30d34b7
commit
343f7d61df
@@ -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',
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<field name="product_tmpl_id"
|
||||
invisible="context.get('active_model')!='product.category'"
|
||||
attrs="{'required': [('applied_on', '=', '1_product')]}"
|
||||
domain="[('categ_id', '=', context.get('default_categ_id', True))]"
|
||||
domain="[('categ_id', '=', context.get('default_categ_id', True)), '|', ('company_id', '=', company_id), ('company_id', '=', False)]"
|
||||
options="{'no_create_edit':1, 'no_open': 1}"/>
|
||||
<field name="product_id"
|
||||
groups="product.group_product_variant"
|
||||
@@ -72,7 +72,7 @@
|
||||
domain="['|', '|',
|
||||
('id', '=', context.get('default_product_id', 0)),
|
||||
('product_tmpl_id', '=', context.get('default_product_tmpl_id', 0)),
|
||||
('categ_id', '=', context.get('default_categ_id', 0)),
|
||||
('categ_id', '=', context.get('default_categ_id', 0)), '|', ('company_id', '=', company_id), ('company_id', '=', False)
|
||||
]"
|
||||
options="{'no_create_edit':1, 'no_open': 1}"
|
||||
/>
|
||||
@@ -253,6 +253,7 @@
|
||||
<field name="date_end"/>
|
||||
<field name="base" invisible="1"/>
|
||||
<field name="applied_on" invisible="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
|
||||
Reference in New Issue
Block a user