[10.0][FIX]get_hs_code_recursively on product.template

This commit is contained in:
luc.demeyer@noviat.com
2018-08-20 08:55:18 +02:00
parent 23b36e070d
commit 38db9130fe
3 changed files with 6 additions and 3 deletions

View File

@@ -65,5 +65,5 @@ class AccountInvoiceLine(models.Model):
@api.onchange('product_id')
def intrastat_product_id_change(self):
if self.product_id:
hs_code = self.product_id.product_tmpl_id.get_hs_code_recursively()
hs_code = self.product_id.get_hs_code_recursively()
self.hs_code_id = hs_code and hs_code.id or False

View File

@@ -521,8 +521,7 @@ class IntrastatProductDeclaration(models.Model):
if inv_line.hs_code_id:
hs_code = inv_line.hs_code_id
elif inv_line.product_id and self._is_product(inv_line):
hs_code = inv_line.product_id.product_tmpl_id.\
get_hs_code_recursively()
hs_code = inv_line.product_id.get_hs_code_recursively()
if not hs_code:
note = "\n" + _(
"Missing H.S. code on product %s. "

View File

@@ -23,6 +23,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):
res = self.env['hs.code']