From c1954ba9c68aa6bd2b34df9284cbd6edfdb64b74 Mon Sep 17 00:00:00 2001 From: Laurent Smet Date: Wed, 26 Sep 2018 13:56:31 +0200 Subject: [PATCH] [FIX] account: set inv state to 'open' when unreconciling in 'in_payment' - Check post_at_bank_rec on bank journal. - Create an invoice of amount=x - Register a payment of amount=x using the bank journal (invoice state is now 'in_payment') - unreconcile the payment ... The invoice state is still 'in_payment' instead of going back to 'open'. --- addons/account/models/account_invoice.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 7136060f323..0d92a946f79 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -528,7 +528,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_re_open() + (not_reconciled & pre_not_reconciled).filtered(lambda invoice: invoice.state in ('in_payment', 'paid')).action_invoice_re_open() return res @api.model @@ -916,7 +916,7 @@ class AccountInvoice(models.Model): @api.multi def action_invoice_re_open(self): - if self.filtered(lambda inv: inv.state != 'paid'): + if self.filtered(lambda inv: inv.state not in ('in_payment', 'paid')): raise UserError(_('Invoice must be paid in order to set it to register payment.')) return self.write({'state': 'open'})