Call apply tax rule with empty tax

Handle list return for apply
This commit is contained in:
Cédric Krier committed 2009-04-06 10:33:20 +02:00
1 parent a45daf6066
commit 52339997a2
1 file changed
+11 -5
+11 -5
View File
@@ -983,17 +983,23 @@ class PurchaseLine(ModelSQL, ModelView):
res['unit_price'] = product_obj.get_purchase_price(cursor, user,
[product.id], vals.get('quantity', 0), context=ctx2)[product.id]
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)
if not vals.get('description'):
res['description'] = product_obj.browse(cursor, user, product.id,