product_category_tax: set taxes in all companies

This commit is contained in:
Alexis de Lattre
2023-02-19 23:21:32 +01:00
parent 0358127f0c
commit 4a9bf263e3
2 changed files with 5 additions and 1 deletions

View File

@@ -12,7 +12,7 @@
'description': "",
'author': 'Akretion',
'website': 'http://www.akretion.com',
'depends': ['account'],
'depends': ['account', 'base_suspend_security'],
'data': ['product_view.xml'],
'installable': True,
}

View File

@@ -36,11 +36,15 @@ class ProductCategTaxMixin(models.AbstractModel):
@api.model
def create(self, vals):
# suspend_security() is needed to read/set taxes in all companies
self = self.suspend_security()
self.write_or_create(vals)
return super(ProductCategTaxMixin, self).create(vals)
@api.multi
def write(self, vals):
# suspend_security() is needed to read/set taxes in all companies
self = self.suspend_security()
self.write_or_create(vals)
return super(ProductCategTaxMixin, self).write(vals)