[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:
@@ -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'})
|
||||
|
||||
Reference in New Issue
Block a user