From 4a9bf263e3e6add532c3d93d4362943ab4d784ce Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sun, 19 Feb 2023 23:21:32 +0100 Subject: [PATCH] product_category_tax: set taxes in all companies --- product_category_tax/__manifest__.py | 2 +- product_category_tax/product.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/product_category_tax/__manifest__.py b/product_category_tax/__manifest__.py index 92828e0..5326d39 100644 --- a/product_category_tax/__manifest__.py +++ b/product_category_tax/__manifest__.py @@ -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, } diff --git a/product_category_tax/product.py b/product_category_tax/product.py index a82154b..732b5b5 100644 --- a/product_category_tax/product.py +++ b/product_category_tax/product.py @@ -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)