[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
This commit is contained in:
Denis Ledoux 2016-01-04 17:44:53 +01:00
parent f6d2a75c94
commit 3f86507df5
1 changed files with 5 additions and 0 deletions

View File

@ -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
#----------------------------------------------------------