summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorLaurent Smet <las@odoo.com>2018-09-26 13:56:31 +0200
committerLaurent Smet <las@odoo.com>2018-09-26 15:34:21 +0200
commitc1954ba9c68aa6bd2b34df9284cbd6edfdb64b74 (patch)
tree7e8260b7c7663c24ca1a8d7fb85e73c82cbb5bd5 /addons
parent326dabce09d634e029e68281694ec695fa665666 (diff)
[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'.
Diffstat (limited to 'addons')
-rw-r--r--addons/account/models/account_invoice.py4
1 files 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'})