product_category_tax: set taxes in all companies
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
'description': "",
|
'description': "",
|
||||||
'author': 'Akretion',
|
'author': 'Akretion',
|
||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['account'],
|
'depends': ['account', 'base_suspend_security'],
|
||||||
'data': ['product_view.xml'],
|
'data': ['product_view.xml'],
|
||||||
'installable': True,
|
'installable': True,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,11 +36,15 @@ class ProductCategTaxMixin(models.AbstractModel):
|
|||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def create(self, vals):
|
def create(self, vals):
|
||||||
|
# suspend_security() is needed to read/set taxes in all companies
|
||||||
|
self = self.suspend_security()
|
||||||
self.write_or_create(vals)
|
self.write_or_create(vals)
|
||||||
return super(ProductCategTaxMixin, self).create(vals)
|
return super(ProductCategTaxMixin, self).create(vals)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def write(self, vals):
|
def write(self, vals):
|
||||||
|
# suspend_security() is needed to read/set taxes in all companies
|
||||||
|
self = self.suspend_security()
|
||||||
self.write_or_create(vals)
|
self.write_or_create(vals)
|
||||||
return super(ProductCategTaxMixin, self).write(vals)
|
return super(ProductCategTaxMixin, self).write(vals)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user