From e194fb9516e1b0a641493a364af07d7b3f760359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A0n=20Todorovich?= Date: Thu, 30 Jun 2022 15:11:52 -0300 Subject: [PATCH] [FIX] product_category_tax: onchange method name shouldn't be too generic Unless it's an override, onchange method names can't be too generic, otherwise it has a high risk of unadvertedly overwriting another module's method. --- product_category_tax/models/product_product.py | 2 +- product_category_tax/models/product_template.py | 2 +- product_category_tax/tests/test_product_category_tax.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/product_category_tax/models/product_product.py b/product_category_tax/models/product_product.py index 16c41a503..afc712d47 100644 --- a/product_category_tax/models/product_product.py +++ b/product_category_tax/models/product_product.py @@ -8,7 +8,7 @@ class ProductProduct(models.Model): _inherit = "product.product" @api.onchange("categ_id") - def onchange_categ_id(self): + def _onchange_categ_id_set_taxes(self): if self.categ_id: self.set_tax_from_category() diff --git a/product_category_tax/models/product_template.py b/product_category_tax/models/product_template.py index bd4c3f8e7..23bdb69f2 100644 --- a/product_category_tax/models/product_template.py +++ b/product_category_tax/models/product_template.py @@ -10,7 +10,7 @@ class ProductTemplate(models.Model): taxes_updeatable_from_category = fields.Boolean(default=True) @api.onchange("categ_id") - def onchange_categ_id(self): + def _onchange_categ_id_set_taxes(self): if self.categ_id: self.set_tax_from_category() diff --git a/product_category_tax/tests/test_product_category_tax.py b/product_category_tax/tests/test_product_category_tax.py index bc1d0b393..fcc71721b 100644 --- a/product_category_tax/tests/test_product_category_tax.py +++ b/product_category_tax/tests/test_product_category_tax.py @@ -52,7 +52,7 @@ class ProductCategoryTax(common.SavepointCase): self.product_test = self.product_obj.create( {"name": "TEST 01", "categ_id": test_categ.id, "list_price": 155.0} ) - self.product_test.product_tmpl_id.onchange_categ_id() + self.product_test.product_tmpl_id._onchange_categ_id_set_taxes() self.assertEquals(self.product_test.supplier_taxes_id, self.tax_purchase) def test_02_update_taxes(self):