[FIX] account: fix unreconciling invoices, raising a wrong error.
That bug was introduced when removing the invoice workflow, where a call to action_invoice_cancel() has been used instead of action_invoice_reopen() which does slightly different things, as you can imagine.
This commit is contained in:
@@ -353,7 +353,7 @@ class AccountInvoice(models.Model):
|
||||
reconciled = self.filtered(lambda invoice: invoice.reconciled)
|
||||
not_reconciled = self - reconciled
|
||||
(reconciled & pre_reconciled).filtered(lambda invoice: invoice.state == 'open').action_invoice_paid()
|
||||
(not_reconciled & pre_not_reconciled).filtered(lambda invoice: invoice.state == 'paid').action_invoice_cancel()
|
||||
(not_reconciled & pre_not_reconciled).filtered(lambda invoice: invoice.state == 'paid').action_invoice_re_open()
|
||||
return res
|
||||
|
||||
@api.model
|
||||
@@ -578,7 +578,7 @@ class AccountInvoice(models.Model):
|
||||
@api.multi
|
||||
def action_invoice_cancel(self):
|
||||
if self.filtered(lambda inv: inv.state not in ['proforma2', 'draft', 'open']):
|
||||
raise UserError(_("Invoice must be in draft or Pro-forma state in order to validate it."))
|
||||
raise UserError(_("Invoice must be in draft,Pro-forma or open state in order to be cancelled."))
|
||||
return self.action_cancel()
|
||||
|
||||
@api.multi
|
||||
|
||||
Reference in New Issue
Block a user