Lookup parent taxes for unece tax codes.
In the same way as for categories the unece tax codes must be searched on parents.
This commit is contained in:
parent
40097137b0
commit
6e2f109346
1 changed files with 9 additions and 1 deletions
10
mixin.py
10
mixin.py
|
@ -144,12 +144,20 @@ class EdocumentMixin(object):
|
||||||
def tax_unece_code(self, tax):
|
def tax_unece_code(self, tax):
|
||||||
""" 'tax': invoice.line
|
""" 'tax': invoice.line
|
||||||
"""
|
"""
|
||||||
if not (tax.unece_code or ''):
|
unece_code = self.get_tax_unece_code(tax)
|
||||||
|
if not unece_code:
|
||||||
raise UserError(gettext(
|
raise UserError(gettext(
|
||||||
'edocument_xrechnung.msg_tax_code_missing',
|
'edocument_xrechnung.msg_tax_code_missing',
|
||||||
taxname=tax.rec_name))
|
taxname=tax.rec_name))
|
||||||
return tax.unece_code
|
return tax.unece_code
|
||||||
|
|
||||||
|
def get_tax_unece_code(self, tax):
|
||||||
|
while tax:
|
||||||
|
if tax.unece_code:
|
||||||
|
return tax.unece_code
|
||||||
|
break
|
||||||
|
tax = tax.parent
|
||||||
|
|
||||||
def get_category_code(self, tax):
|
def get_category_code(self, tax):
|
||||||
while tax:
|
while tax:
|
||||||
if tax.unece_category_code:
|
if tax.unece_category_code:
|
||||||
|
|
Loading…
Reference in a new issue