mirror of
https://github.com/OCA/intrastat-extrastat.git
synced 2025-02-16 17:13:41 +02:00
[10.0][FIX]get_hs_code_recursively on product.template
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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. "
|
||||
|
||||
@@ -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']
|
||||
|
||||
Reference in New Issue
Block a user