Call apply tax rule with empty tax
Handle list return for apply
This commit is contained in:
1 parent
3ab10e3da6
commit
e822d4b072
1 file changed
+22
-10
+22
-10
@@ -1585,17 +1585,23 @@ class InvoiceLine(ModelSQL, ModelView):
|
||||
except:
|
||||
pass
|
||||
res['taxes'] = []
|
||||
pattern = self._get_tax_rule_pattern(cursor, user, party, vals,
|
||||
context=context)
|
||||
for tax in product.supplier_taxes_used:
|
||||
if party and party.supplier_tax_rule:
|
||||
pattern = self._get_tax_rule_pattern(cursor, user, party,
|
||||
vals, context=context)
|
||||
tax_id = tax_rule_obj.apply(cursor, user,
|
||||
tax_ids = tax_rule_obj.apply(cursor, user,
|
||||
party.supplier_tax_rule, tax, pattern,
|
||||
context=context)
|
||||
if tax_id:
|
||||
res['taxes'].append(tax_id)
|
||||
if tax_ids:
|
||||
res['taxes'].extend(tax_ids)
|
||||
continue
|
||||
res['taxes'].append(tax.id)
|
||||
if party and party.supplier_tax_rule:
|
||||
tax_ids = tax_rule_obj.apply(cursor, user,
|
||||
party.supplier_tax_rule, False, pattern,
|
||||
context=context)
|
||||
if tax_ids:
|
||||
res['taxes'].extend(tax_ids)
|
||||
else:
|
||||
if company and currency:
|
||||
res['unit_price'] = currency_obj.compute(cursor, user,
|
||||
@@ -1609,17 +1615,23 @@ class InvoiceLine(ModelSQL, ModelView):
|
||||
except:
|
||||
pass
|
||||
res['taxes'] = []
|
||||
pattern = self._get_tax_rule_pattern(cursor, user, party, vals,
|
||||
context=context)
|
||||
for tax in product.customer_taxes_used:
|
||||
if party and party.customer_tax_rule:
|
||||
pattern = self._get_tax_rule_pattern(cursor, user, party,
|
||||
vals, context=context)
|
||||
tax_id = tax_rule_obj.apply(cursor, user,
|
||||
tax_ids = tax_rule_obj.apply(cursor, user,
|
||||
party.customer_tax_rule, tax, pattern,
|
||||
context=context)
|
||||
if tax_id:
|
||||
res['taxes'].append(tax_id)
|
||||
if tax_ids:
|
||||
res['taxes'].extend(tax_ids)
|
||||
continue
|
||||
res['taxes'].append(tax.id)
|
||||
if party and party.customer_tax_rule:
|
||||
tax_ids = tax_rule_obj.apply(cursor, user,
|
||||
party.customer_tax_rule, False, pattern,
|
||||
context=context)
|
||||
if tax_ids:
|
||||
res['taxes'].extend(tax_ids)
|
||||
|
||||
if not vals.get('description'):
|
||||
res['description'] = product_obj.browse(cursor, user, product.id,
|
||||
|
||||
Reference in new issue
Block a user