[MERGE] point_of_sale: Improve the layout of the pos.session.opening wizard.

bzr revid: stw@openerp.com-20120904100711-rp4ca0u9hs0t7vm4
This commit is contained in:
Stephane Wirtel
2012-09-04 12:07:11 +02:00
3 changed files with 17 additions and 10 deletions
+2 -2
View File
@@ -916,7 +916,7 @@
</field>
</group>
<div attrs="{'invisible': [('state', '=', 'closed')]}">
<div attrs="{'invisible': [('state', '!=', 'closed')]}">
<group class="oe_subtotal_footer oe_right">
<field name="cash_register_balance_start" readonly="1" string="Opening Balance" class="oe_subtotal_footer_separator"/>
<field name="cash_register_total_entry_encoding" attrs="{'invisible' : [('state', '=', 'opening_control')]}" string="+ Transactions"/>
@@ -933,7 +933,7 @@
</div>
<group class="oe_subtotal_footer oe_right" attrs="{'invisible' : [('state', 'in', ('opening_control', 'closed'))]}">
<group class="oe_subtotal_footer oe_right" attrs="{'invisible' : [('state', '!=', 'closed')]}">
<field name="cash_register_balance_end_real" class="oe_subtotal_footer_separator"/>
<field name="cash_register_difference" class="oe_subtotal_footer_separator"/>
</group>
@@ -6,14 +6,18 @@ import netsvc
from openerp.addons.point_of_sale.point_of_sale import pos_session
class pos_session_opening(osv.osv_memory):
_name = 'pos.session.opening'
_columns = {
'pos_config_id' : fields.many2one('pos.config', 'Point of Sale', required=True),
'pos_session_id' : fields.many2one('pos.session', 'PoS Session'),
'pos_state' : fields.selection(pos_session.POS_SESSION_STATE,
'Session State', readonly=True),
'pos_state' : fields.related('pos_session_id', 'state',
type='selection',
selection=pos_session.POS_SESSION_STATE,
string='Session State', readonly=True),
'pos_state_str' : fields.char('State', 32, readonly=True),
'show_config' : fields.boolean('Show Config', readonly=True),
'pos_session_name' : fields.related('pos_session_id', 'name',
type='char', size=64, readonly=True),
@@ -71,22 +75,25 @@ class pos_session_opening(osv.osv_memory):
result = {
'pos_session_id': False,
'pos_state': False,
'pos_state_str' : '',
'pos_session_username' : False,
'pos_session_name' : False,
}
if not config_id:
return {'value': result}
return {'value' : result}
proxy = self.pool.get('pos.session')
session_ids = proxy.search(cr, uid, [
('state', '<>', 'closed'),
('state', '!=', 'closed'),
('config_id', '=', config_id),
], context=context)
if session_ids:
session = proxy.browse(cr, uid, session_ids[0], context=context)
result['pos_state'] = session.state
result['pos_state'] = str(session.state)
result['pos_state_str'] = dict(pos_session.POS_SESSION_STATE).get(session.state, '')
result['pos_session_id'] = session.id
result['pos_session_name'] = session.name
result['pos_session_username'] = session.user_id.name
return {'value' : result}
def default_get(self, cr, uid, fieldnames, context=None):
@@ -12,7 +12,7 @@
<field name="pos_config_id" on_change="on_change_config(pos_config_id)"
widget="selection" domain="[('state','=','active')]"
class="oe_inline"/>
<field name="pos_state" class="oe_inline" attrs="{'invisible' : [('pos_state', '=', False)]}" />
<field name="pos_state" invisible="1" />
</group>
<field name="pos_session_id" invisible="1"/>
<button name="open_ui" type="object" string="Start Selling"
@@ -49,8 +49,8 @@
Click to continue the session.
</p>
<p>
The session <field name="pos_session_name" class="oe_inline" /> (<field name="pos_session_username" class="oe_inline" />) is "<b><field name="pos_state" class="oe_inline" /></b>"<br/>
You can continue sales from the touchscreen interface by clicking on "<b>Settings</b>" or close the cash register session ?
The session <field name="pos_session_name" class="oe_inline" /> (<field name="pos_session_username" class="oe_inline" />) is "<b><field name="pos_state_str" class="oe_inline" /></b>"<br/>
You can continue sales from the touchscreen interface by clicking on "<b>Sellings</b>" or close the cash register session ?
</p>
</div>