[FIX] sale: stuck workflow in invoice before delivery
With a sale order with: - a stockable product - the `Create Invoice` policy set to `Before Delivery` After the quotation validation and the invoice validation, if the user: - cancelled the invoice, - then validated it again, - then hit `ignore exception` on the sale order - then registered the payment on the invoice The picking of the sale order was not created automatically, and the sale order was therefore stuck. Actually, it was just a write trigger that was missing: The condition for the sale order workflow to go to the next state is that the `invoiced` boolean is set to True. It was, when the invoice of the sale order was paid (after having registered the payment), but since this is a computed field, not stored, no write operation was actually performed on the sale order, and the workflow wasn't "notified" that a change occured for the `invoiced` boolean. A simple write on the sale order (e.g. in its notes) would have unblock the situation, though. This trigger ensures the worfklow to be notified when the invoice of the sale order is paid, and therefore when the `invoiced` boolean is set to `True`. opw-706591
This commit is contained in:
parent
78be4cd1de
commit
5de7500a41
|
@ -1316,6 +1316,7 @@ class account_invoice(osv.Model):
|
|||
so_ids = sale_order_obj.search(cr, uid, [('invoice_ids', 'in', ids)], context=context)
|
||||
for so_id in so_ids:
|
||||
sale_order_obj.message_post(cr, uid, so_id, body=_("Invoice paid"), context=context)
|
||||
workflow.trg_write(uid, 'sale.order', so_id, cr)
|
||||
return res
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
|
|
Loading…
Reference in New Issue