[REF] getting hs code should be done on the product.product, indeed in some really special case hscode can depend of the variant. Moving the method to the product.product make it inheritable

This commit is contained in:
Sébastien BEAU
2017-08-09 13:49:53 +02:00
parent e55fdd7b13
commit 33a92dcc4b
2 changed files with 5 additions and 1 deletions

View File

@@ -121,7 +121,7 @@ class AccountInvoiceLine(models.Model):
if product:
product = self.env['product.product'].browse(product)
hs_code = product.product_tmpl_id.get_hs_code_recursively()
hs_code = product.get_hs_code_recursively()
if hs_code:
res['value']['hs_code_id'] = hs_code.id
else:

View File

@@ -39,6 +39,10 @@ class ProductTemplate(models.Model):
help="Country of origin of the product i.e. product "
"'made in ____'.")
class ProductProduct(models.Model):
_inherit = 'product.product'
@api.multi
def get_hs_code_recursively(self):
self.ensure_one()