[FIX] purchase: action_cancel

Action_cancel must be done on each stock.picking(with state!='cancel') linked to the purchase order
like in the revision 5aeccbd.

opw:652995
This commit is contained in:
Goffin Simon
2015-10-26 15:42:27 +01:00
parent ac53e2451d
commit 2eb8f009b4
+2
View File
@@ -285,6 +285,8 @@ class PurchaseOrder(models.Model):
if inv and inv.state not in ('cancel', 'draft'):
raise UserError(_("Unable to cancel this purchase order.i You must first cancel related vendor bills."))
for pick in order.picking_ids.filtered(lambda r: r.state != 'cancel'):
pick.action_cancel()
if not self.env.context.get('cancel_procurement'):
procurements = order.order_line.mapped('procurement_ids')
procurements.filtered(lambda r: r.state not in ('cancel', 'exception') and r.rule_id.propagate).write({'state': 'cancel'})