[IMP] setting closing cash position on all journals which does not requires control
bzr revid: fp@openerp.com-20120513120812-yabr9ngdxh32xk0n
This commit is contained in:
parent
8607b4eb8a
commit
56cfae3a8b
|
@ -349,15 +349,11 @@ class account_bank_statement(osv.osv):
|
|||
return self.write(cr, uid, done, {'state':'draft'}, context=context)
|
||||
|
||||
def _compute_balance_end_real(self, cr, uid, journal_id, context=None):
|
||||
|
||||
cr.execute('SELECT balance_end_real \
|
||||
FROM account_bank_statement \
|
||||
WHERE journal_id = %s AND NOT state = %s \
|
||||
ORDER BY date DESC,id DESC LIMIT 1', (journal_id, 'draft'))
|
||||
res = cr.fetchone()
|
||||
|
||||
print "res: %r" % (res,)
|
||||
|
||||
return res and res[0] or 0.0
|
||||
|
||||
def onchange_journal_id(self, cr, uid, statement_id, journal_id, context=None):
|
||||
|
|
|
@ -77,7 +77,6 @@ class account_cash_statement(osv.osv):
|
|||
Set starting and ending balances according to pieces count
|
||||
"""
|
||||
res = {}
|
||||
print 'Updating'
|
||||
for statement in self.browse(cr, uid, ids, context=context):
|
||||
if statement.journal_id.type not in ('cash',):
|
||||
continue
|
||||
|
@ -90,7 +89,6 @@ class account_cash_statement(osv.osv):
|
|||
'balance_end_real': end,
|
||||
}
|
||||
res[statement.id] = data
|
||||
print statement.id, data
|
||||
super(account_cash_statement, self).write(cr, uid, [statement.id], data, context=context)
|
||||
return res
|
||||
|
||||
|
|
|
@ -311,6 +311,12 @@ class pos_session(osv.osv):
|
|||
return True
|
||||
|
||||
def wkf_action_closing_control(self, cr, uid, ids, context=None):
|
||||
for session in self.browse(cr, uid, ids, context=context):
|
||||
for statement in session.statement_ids:
|
||||
if not statement.journal_id.closing_control:
|
||||
if statement.balance_end<>statement.balance_end_real:
|
||||
self.pool.get('account.bank.statement').write(cr, uid,
|
||||
[statement.id], {'balance_end_real': statement.balance_end})
|
||||
return self.write(cr, uid, ids, {'state' : 'closing_control', 'stop_at' : time.strftime('%Y-%m-%d %H:%M:%S')}, context=context)
|
||||
|
||||
def wkf_action_close(self, cr, uid, ids, context=None):
|
||||
|
@ -319,8 +325,10 @@ class pos_session(osv.osv):
|
|||
for record in self.browse(cr, uid, ids, context=context):
|
||||
for st in record.statement_ids:
|
||||
if abs(st.difference) > st.journal_id.amount_authorized_diff:
|
||||
raise osv.except_osv( _('Error !'),
|
||||
_("Your ending balance is too different from the theorical cash closing (%.2f), the maximum allowed is: %.2f.") % (st.difference, st.journal_id.amount_authorized_diff))
|
||||
# The pos manager can close statements with maximums.
|
||||
if not self.pool.get('ir.model.access').check_groups(cr, uid, "point_of_sale.group_pos_manager"):
|
||||
raise osv.except_osv( _('Error !'),
|
||||
_("Your ending balance is too different from the theorical cash closing (%.2f), the maximum allowed is: %.2f. You can contact your manager to force it.") % (st.difference, st.journal_id.amount_authorized_diff))
|
||||
if st.difference:
|
||||
if st.difference > 0.0:
|
||||
name= _('Point of Sale Profit')
|
||||
|
|
|
@ -923,6 +923,7 @@
|
|||
<field name="name" />
|
||||
<field name="journal_id" />
|
||||
<field name="balance_start" />
|
||||
<field name="total_entry_encoding" />
|
||||
<field name="balance_end_real" />
|
||||
<field name="difference" />
|
||||
<field name="currency" />
|
||||
|
|
Loading…
Reference in New Issue