[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
This commit is contained in:
parent
20b5e0a4ab
commit
ba74cb9144
|
@ -40,6 +40,9 @@ class CashBox(osv.osv_memory):
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def _create_bank_statement_line(self, cr, uid, box, record, context=None):
|
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)
|
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)
|
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:
|
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!"))
|
raise osv.except_osv(_('Configuration Error'), _("You should have defined an 'Internal Transfer Account' in your cash register's journal!"))
|
||||||
return {
|
return {
|
||||||
|
'date': record.date,
|
||||||
'statement_id': record.id,
|
'statement_id': record.id,
|
||||||
'journal_id': record.journal_id.id,
|
'journal_id': record.journal_id.id,
|
||||||
'amount': box.amount or 0.0,
|
'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!"))
|
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
|
amount = box.amount or 0.0
|
||||||
return {
|
return {
|
||||||
|
'date': record.date,
|
||||||
'statement_id': record.id,
|
'statement_id': record.id,
|
||||||
'journal_id': record.journal_id.id,
|
'journal_id': record.journal_id.id,
|
||||||
'amount': -amount if amount > 0.0 else amount,
|
'amount': -amount if amount > 0.0 else amount,
|
||||||
|
|
Loading…
Reference in New Issue