[MERGE] lp:~openerp-dev/openobject-addons/trunk-cashcontrol--cha.

bzr revid: tta@openerp.com-20130404131017-phib24vytdx5fqmj
This commit is contained in:
Tejas Tank 2013-04-04 18:40:17 +05:30
commit 8e0f1cd1b9
3 changed files with 37 additions and 6 deletions

View File

@ -45,6 +45,18 @@ class pos_config(osv.osv):
('deprecated', 'Deprecated')
]
def _get_currency(self, cr, uid, ids, fieldnames, args, context=None):
result = {}
currency_id = False
user = self.pool.get('res.users')
for pos_config in self.browse(cr, uid, ids, context=context):
if pos_config.journal_id:
currency_id = pos_config.journal_id.currency.id or pos_config.journal_id.company_id.currency_id.id
else:
currency_id = user.browse(cr, uid, pos_config.id, context=context).company_id.currency_id.id
result[pos_config.id] = currency_id
return result
_columns = {
'name' : fields.char('Point of Sale Name', size=32, select=1,
required=True, help="An internal identification of the point of sale"),
@ -56,6 +68,7 @@ class pos_config(osv.osv):
'journal_id' : fields.many2one('account.journal', 'Sale Journal',
domain=[('type', '=', 'sale')],
help="Accounting journal used to post sales entries."),
'currency_id' : fields.function(_get_currency, type="many2one", string="Currency", relation="res.currency"),
'iface_self_checkout' : fields.boolean('Self Checkout Mode',
help="Check this if this point of sale should open by default in a self checkout mode. If unchecked, OpenERP uses the normal cashier mode by default."),
'iface_cashdrawer' : fields.boolean('Cashdrawer Interface'),
@ -192,13 +205,14 @@ class pos_session(osv.osv):
readonly=True,
states={'opening_control' : [('readonly', False)]}
),
'currency_id' : fields.related('config_id', 'currency_id', type="many2one", relation='res.currency', string="Currnecy"),
'start_at' : fields.datetime('Opening Date', readonly=True),
'stop_at' : fields.datetime('Closing Date', readonly=True),
'state' : fields.selection(POS_SESSION_STATE, 'Status',
required=True, readonly=True,
select=1),
'cash_control' : fields.function(_compute_cash_all,
multi='cash',
type='boolean', string='Has Cash Control'),

View File

@ -772,6 +772,7 @@
<group>
<field name="name"/>
<field name="shop_id" widget="selection" groups="stock.group_locations" />
<field name="currency_id" invisible="1"/>
<field name="journal_id" widget="selection" />
<field name="sequence_id" readonly="1" groups="base.group_no_one" />
<field name="group_by" groups="account.group_account_user" />
@ -894,6 +895,7 @@
<field name="cash_control" invisible="1" />
<group>
<field name="user_id"/>
<field name="currency_id" invisible="1"/>
<field name="config_id"/>
</group>
<group>
@ -922,9 +924,11 @@
<div attrs="{'invisible' : [('cash_control', '=', False)]}">
<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"/>
<field name="cash_register_balance_end" attrs="{'invisible' : [('state', '=', 'opening_control')]}" string="= Theoretical Balance"/>
<field name="cash_register_balance_start" readonly="1" string="Opening Balance" class="oe_subtotal_footer_separator" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<label for="cash_register_total_entry_encoding" attrs="{'invisible' : [('state', '=', 'opening_control')]}" string="+ Transactions" class="oe_bold oe_pos_opening_total"/>
<field name="cash_register_total_entry_encoding" nolabel="1" attrs="{'invisible' : [('state', '=', 'opening_control')]}" class="oe_bold oe_pos_total" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<label for="cash_register_balance_end" attrs="{'invisible' : [('state', '=', 'opening_control')]}" string="= Computed Balance" class="oe_force_bold oe_pos_opening_total"/>
<field name="cash_register_balance_end" nolabel="1" attrs="{'invisible' : [('state', '=', 'opening_control')]}" class="oe_bold oe_pos_total" widget="monetary" options="{'currency_field': 'currency_id'}"/>
</group>
<div class="oe_clear"/>
<div attrs="{'invisible' : ['|', ('cash_journal_id', '=', False), ('state', '!=', 'opening_control')]}" class="oe_view_nocontent" groups="point_of_sale.group_pos_manager">
@ -938,8 +942,9 @@
<group class="oe_subtotal_footer oe_right" attrs="{'invisible': ['|', ('cash_control', '=', False), ('state', '=', 'opening_control')]}">
<field name="cash_register_balance_end_real" string="Closing Balance" class="oe_subtotal_footer_separator"/>
<field name="cash_register_difference" class="oe_subtotal_footer_separator"/>
<field name="cash_register_balance_end_real" string="Closing Balance" class="oe_subtotal_footer_separator" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<label for="cash_register_difference" class="oe_force_bold oe_pos_ening_total"/>
<field name="cash_register_difference" nolabel="1" class="oe_bold oe_pos_total" widget="monetary" options="{'currency_field': 'currency_id'}"/>
</group>
</group>

View File

@ -1431,3 +1431,15 @@
box-shadow: 0px 3px 38px rgba(0,0,0,0.3);
border-radius: 3px;
}
.openerp .oe_force_bold {
font-weight: bold !important;
}
.openerp .oe_pos_opening_total {
margin-right: -14px;
}
.openerp .oe_pos_ening_total {
margin-right: -7px;
}
.openerp .oe_pos_total {
margin-left: -2px;
}