From e2d16ea04a2ae98800086619ff5dc94dfa6eb5d3 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 27 Jan 2016 16:28:49 +0100 Subject: [PATCH] [FIX] account_voucher: unreconcile with deleted journal items This is possible to unreconcile and then remove journal items associated to `account.voucher.line`. When it's done, the voucher is within a corrupted state, with debits and credits lines without journal item, which is required. Because the journal item of this line is empty, while required, this is no longer possible to use the "Unreconcile" button, because the form is invalid. In order to allow to unreconcile a posted customer/supplier payments with missing journal items, we set the journal items as required only when the payment is within the `draft` stage. opw-667232 --- addons/account_voucher/account_voucher.py | 1 + addons/account_voucher/voucher_payment_receipt_view.xml | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index d942225d70b..949239f8124 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -1498,6 +1498,7 @@ class account_voucher_line(osv.osv): 'amount_unreconciled': fields.function(_compute_balance, multi='dc', type='float', string='Open Balance', store=True, digits_compute=dp.get_precision('Account')), 'company_id': fields.related('voucher_id','company_id', relation='res.company', type='many2one', string='Company', store=True, readonly=True), 'currency_id': fields.function(_currency_id, string='Currency', type='many2one', relation='res.currency', readonly=True), + 'state': fields.related('voucher_id', 'state', type='char', string='State', readonly=True), } _defaults = { 'name': '', diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index 073b1efed82..f70f47c54ef 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -163,10 +163,11 @@