From ba74cb9144d5997e58e4fd576eafc1597d22b4f8 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 8 Sep 2015 12:04:27 +0200 Subject: [PATCH] [FIX] account: Cash registers In Accounting > Bank and Cash > Cash Registers, when clicking in "More" button on 'Put Money In' or 'Take Money out', the date used for the bank statement line created must be the date of the bank stattement(same behaviour then when clicking on "Add item" in edit mode). It's forbidden to put/take money in/out for a bank statement which is not open. opw:647631 --- addons/account/wizard/pos_box.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/account/wizard/pos_box.py b/addons/account/wizard/pos_box.py index 4740ef83dfe..1a70c173e03 100644 --- a/addons/account/wizard/pos_box.py +++ b/addons/account/wizard/pos_box.py @@ -40,6 +40,9 @@ class CashBox(osv.osv_memory): return {} def _create_bank_statement_line(self, cr, uid, box, record, context=None): + if record.state == 'confirm': + raise osv.except_osv(_('Error!'), + _("You cannot put/take money in/out for a bank statement which is closed.")) values = self._compute_values_for_statement_line(cr, uid, box, record, context=context) return self.pool.get('account.bank.statement').write(cr, uid, [record.id], {'line_ids': [(0, False, values)]}, context=context) @@ -56,6 +59,7 @@ class CashBoxIn(CashBox): if not record.journal_id.internal_account_id.id: raise osv.except_osv(_('Configuration Error'), _("You should have defined an 'Internal Transfer Account' in your cash register's journal!")) return { + 'date': record.date, 'statement_id': record.id, 'journal_id': record.journal_id.id, 'amount': box.amount or 0.0, @@ -75,6 +79,7 @@ class CashBoxOut(CashBox): raise osv.except_osv(_('Configuration Error'), _("You should have defined an 'Internal Transfer Account' in your cash register's journal!")) amount = box.amount or 0.0 return { + 'date': record.date, 'statement_id': record.id, 'journal_id': record.journal_id.id, 'amount': -amount if amount > 0.0 else amount,