From 3f86507df56d6b2de402c1e93a9236b2f8ed23ef Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 4 Jan 2016 17:44:53 +0100 Subject: [PATCH] [FIX] stock_account: Invoice status to not applicable on cancellation When cancelling a `stock.move` with as invoice status `To be invoiced`, the invoice status was left that way. Therefore, the `stock.picking` to which this `stock.move` belonged remained in the "Deliveries to invoice" list, even if all other moves of the picking were invoiced, and this one cancelled. Setting the invoice status to "Not applicable" on the `stock.move` cancellation solves this issue as the `stock.picking` will no longer be considered as to be invoiced if all its moves are invoiced or `not applicable` opw-660729 --- addons/stock_account/stock.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/stock_account/stock.py b/addons/stock_account/stock.py index 50264fae7b4..554412b350b 100644 --- a/addons/stock_account/stock.py +++ b/addons/stock_account/stock.py @@ -180,6 +180,11 @@ class stock_move(osv.osv): is_extra_move[move.id] = False return (is_extra_move, extra_move_tax) + def action_cancel(self, cr, uid, ids, context=None): + res = super(stock_move, self).action_cancel(cr, uid, ids, context=context) + self.write(cr, uid, ids, {'invoice_state': 'none'}, context=context) + return res + #---------------------------------------------------------- # Picking #----------------------------------------------------------