mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[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.
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -52,8 +52,8 @@ 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.assertEqual(self.product_test.supplier_taxes_id, self.tax_purchase)
|
||||
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):
|
||||
"""Default update"""
|
||||
|
||||
Reference in New Issue
Block a user