[FIX] better responsibilities on objects POS
This commit is contained in:
parent
0829afadd2
commit
d14297ac53
|
@ -77,7 +77,10 @@ class account_cash_statement(osv.osv):
|
||||||
"""
|
"""
|
||||||
res = {}
|
res = {}
|
||||||
for statement in self.browse(cr, uid, ids, context=context):
|
for statement in self.browse(cr, uid, ids, context=context):
|
||||||
if (statement.journal_id.type not in ('cash',)) or (not statement.journal_id.cash_control):
|
if (statement.journal_id.type not in ('cash',)):
|
||||||
|
continue
|
||||||
|
if not statement.journal_id.cash_control:
|
||||||
|
statement.write({'balance_end_real' : statement.balance_end})
|
||||||
continue
|
continue
|
||||||
start = end = 0
|
start = end = 0
|
||||||
for line in statement.details_ids:
|
for line in statement.details_ids:
|
||||||
|
|
|
@ -461,20 +461,6 @@ class pos_session(osv.osv):
|
||||||
if (st.journal_id.type not in ['bank', 'cash']):
|
if (st.journal_id.type not in ['bank', 'cash']):
|
||||||
raise osv.except_osv(_('Error!'),
|
raise osv.except_osv(_('Error!'),
|
||||||
_("The type of the journal for your payment method should be bank or cash "))
|
_("The type of the journal for your payment method should be bank or cash "))
|
||||||
if st.difference and st.journal_id.cash_control == True:
|
|
||||||
if st.difference > 0.0:
|
|
||||||
name= _('Point of Sale Profit')
|
|
||||||
else:
|
|
||||||
name= _('Point of Sale Loss')
|
|
||||||
bsl.create(cr, uid, {
|
|
||||||
'statement_id': st.id,
|
|
||||||
'amount': st.difference,
|
|
||||||
'ref': record.name,
|
|
||||||
'name': name,
|
|
||||||
'journal_id': st.journal_id.id,
|
|
||||||
}, context=context)
|
|
||||||
|
|
||||||
st.write({'balance_end_real': st.balance_end}) # will update balances for cash statements
|
|
||||||
getattr(st, 'button_confirm_%s' % st.journal_id.type)(context=context)
|
getattr(st, 'button_confirm_%s' % st.journal_id.type)(context=context)
|
||||||
self._confirm_orders(cr, uid, ids, context=context)
|
self._confirm_orders(cr, uid, ids, context=context)
|
||||||
self.write(cr, uid, ids, {'state' : 'closed'}, context=context)
|
self.write(cr, uid, ids, {'state' : 'closed'}, context=context)
|
||||||
|
|
Loading…
Reference in New Issue