[FIX] POS close session without cash register

bzr revid: fp@openerp.com-20121103171225-nlp53s0aenamdhcg
This commit is contained in:
Fabien Pinckaers 2012-11-03 18:12:25 +01:00
parent fa90c9e771
commit 74476c8e22
3 changed files with 52 additions and 40 deletions

View File

@ -78,7 +78,7 @@ class account_cash_statement(osv.osv):
"""
res = {}
for statement in self.browse(cr, uid, ids, context=context):
if statement.journal_id.type not in ('cash',):
if (statement.journal_id.type not in ('cash',)) or (not statement.journal_id.cash_control):
continue
start = end = 0
for line in statement.details_ids:

View File

@ -296,8 +296,12 @@ class pos_session(osv.osv):
]
def create(self, cr, uid, values, context=None):
config_id = values.get('config_id', False) or False
if config_id:
context = context or {}
config_id = values.get('config_id', False) or context.get('default_config_id', False)
if not config_id:
raise osv.except_osv( _('Error!'),
_("You should assign a Point of Sale to your session."))
# journal_id is not required on the pos_config because it does not
# exists at the installation. If nothing is configured at the
# installation we do the minimal configuration. Impossible to do in
@ -390,7 +394,7 @@ class pos_session(osv.osv):
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 statement != session.cash_register_id and statement.balance_end != statement.balance_end_real:
if (statement != session.cash_register_id) and (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)

View File

@ -152,7 +152,7 @@
<record model="workflow.transition" id="trans_open_to_close">
<field name="act_from" ref="act_open" />
<field name="act_to" ref="act_close" />
<field name="act_to" ref="act_closing_control" />
<field name="signal">close</field>
<field name="condition">cash_control == False</field>
</record>
@ -163,5 +163,13 @@
<field name="signal">close</field>
</record>
<record model="workflow.transition" id="trans_closing_control_to_close_no_control">
<field name="act_from" ref="act_closing_control" />
<field name="act_to" ref="act_close" />
<field name="condition">cash_control == False</field>
</record>
</data>
</openerp>