From cc5d5bb2bf4a84a27edf998cee22c8602c9a78e0 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 10 Jan 2014 17:15:19 +0100 Subject: [PATCH] [FIX] account: restore cross-account reconciliation check, disabled by mistake in v6.1 Both the FY closing change and the removal of the check occurred in v6.1 at revision 6529 revid:qdp-launchpad@openerp.com-20120209170333-8xu7r21hencjwu73. Also removed code specific to fiscal year closing in the regular reconciliation operation, as the FY closing is now using a dedication reconciliation algorithm. This is a forward-port of the corresponding patch in v6.1, at revno 7295 rev-id: odo@openerp.com-20140110154023-12rqfeuwx5fqpdau. bzr revid: odo@openerp.com-20140110161519-qsocx6xgqsmbe6dt --- addons/account/account_move_line.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 3e40840ff88..e2aac6ff141 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -850,18 +850,17 @@ class account_move_line(osv.osv): (tuple(ids), )) r = cr.fetchall() #TODO: move this check to a constraint in the account_move_reconcile object + if len(r) != 1: + raise osv.except_osv(_('Error'), _('Entries are not of the same account or already reconciled ! ')) if not unrec_lines: raise osv.except_osv(_('Error!'), _('Entry is already reconciled.')) account = account_obj.browse(cr, uid, account_id, context=context) + if not account.reconcile: + raise osv.except_osv(_('Error'), _('The account is not defined to be reconciled !')) if r[0][1] != None: raise osv.except_osv(_('Error!'), _('Some entries are already reconciled.')) - if context.get('fy_closing'): - # We don't want to generate any write-off when being called from the - # wizard used to close a fiscal year (and it doesn't give us any - # writeoff_acc_id). - pass - elif (not currency_obj.is_zero(cr, uid, account.company_id.currency_id, writeoff)) or \ + if (not currency_obj.is_zero(cr, uid, account.company_id.currency_id, writeoff)) or \ (account.currency_id and (not currency_obj.is_zero(cr, uid, account.currency_id, currency))): if not writeoff_acc_id: raise osv.except_osv(_('Warning!'), _('You have to provide an account for the write off/exchange difference entry.'))