Update taxes only for draft invoices

This commit is contained in:
Cédric Krier committed 2009-04-03 17:48:44 +02:00
1 parent ca03a7b5a3
commit b7e4b9ca62
1 file changed
+4 -1
+4 -1
View File
@@ -920,9 +920,12 @@ class Invoice(ModelWorkflow, ModelSQL, ModelView):
keys.remove(key)
if len(keys):
self.check_modify(cursor, user, ids, context=context)
update_tax_ids = [x.id for x in self.browse(cursor, user, ids,
context=context) if x.state == 'draft']
res = super(Invoice, self).write(cursor, user, ids, vals,
context=context)
self.update_taxes(cursor, user, ids, context=context)
if update_tax_ids:
self.update_taxes(cursor, user, update_tax_ids, context=context)
if 'state' in vals and vals['state'] in ('paid', 'cancel'):
self.workflow_trigger_trigger(cursor, user, ids, context=context)
return res