Merge remote-tracking branch 'origin/nested_taxes'
This commit is contained in:
commit
0ddc4d9774
1 changed files with 12 additions and 3 deletions
15
edocument.py
15
edocument.py
|
@ -63,7 +63,8 @@ class Invoice(Invoice):
|
|||
numtax=len(line.invoice_taxes)))
|
||||
|
||||
allowed_cat = ['AE', 'L', 'M', 'E', 'S', 'Z', 'G', 'O', 'K', 'B']
|
||||
if not line.invoice_taxes[0].tax.unece_category_code in allowed_cat:
|
||||
unece_category_code = self.get_category_code(line.invoice_taxes[0].tax)
|
||||
if unece_category_code not in allowed_cat:
|
||||
raise UserError(gettext(
|
||||
'edocument_xrechnung.msg_linetax_invalid_catcode',
|
||||
taxname=line.invoice_taxes[0].tax.rec_name,
|
||||
|
@ -99,14 +100,22 @@ class Invoice(Invoice):
|
|||
uomname=line.unit.rec_name))
|
||||
return line.unit.unece_code
|
||||
|
||||
def get_category_code(self, tax):
|
||||
while tax:
|
||||
if tax.unece_category_code:
|
||||
return tax.unece_category_code
|
||||
break
|
||||
tax = tax.parent
|
||||
|
||||
def tax_category_code(self, tax):
|
||||
""" read tax-category, fire exception if missing
|
||||
"""
|
||||
if len(tax.unece_category_code or '') == 0:
|
||||
unece_category_code = self.get_category_code(tax)
|
||||
if not unece_category_code:
|
||||
raise UserError(gettext(
|
||||
'edocument_xrechnung.mds_tax_category_missing',
|
||||
taxname=tax.rec_name))
|
||||
return tax.unece_category_code
|
||||
return unece_category_code
|
||||
|
||||
def quote_text(self, text):
|
||||
""" replace critical chars
|
||||
|
|
Loading…
Reference in a new issue