[IMP] POS: added field currency_id to have currency symbol at pos total
bzr revid: cha@tinyerp.com-20130318084547-42fwyv84jqqfi03h
This commit is contained in:
parent
b9cd6db6bc
commit
d3b14e953a
|
@ -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'),
|
||||
|
@ -198,7 +211,8 @@ class pos_session(osv.osv):
|
|||
'state' : fields.selection(POS_SESSION_STATE, 'Status',
|
||||
required=True, readonly=True,
|
||||
select=1),
|
||||
|
||||
|
||||
'currency_id' : fields.related('config_id', 'currency_id', type="many2one", relation='res.currency', string="Currnecy"),
|
||||
'cash_control' : fields.function(_compute_cash_all,
|
||||
multi='cash',
|
||||
type='boolean', string='Has Cash Control'),
|
||||
|
|
|
@ -772,6 +772,7 @@
|
|||
<group>
|
||||
<field name="name"/>
|
||||
<field name="shop_id" widget="selection" groups="stock.group_locations" />
|
||||
<field name="currency_id"/>
|
||||
<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"/>
|
||||
<field name="config_id"/>
|
||||
</group>
|
||||
<group>
|
||||
|
@ -922,9 +924,9 @@
|
|||
|
||||
<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="= Computed Balance"/>
|
||||
<field name="cash_register_balance_start" readonly="1" string="Opening Balance" class="oe_subtotal_footer_separator" widget="monetary" options="{'currency_field': 'currency_id'}"/>
|
||||
<field name="cash_register_total_entry_encoding" attrs="{'invisible' : [('state', '=', 'opening_control')]}" string="+ Transactions" widget="monetary" options="{'currency_field': 'currency_id'}"/>
|
||||
<field name="cash_register_balance_end" attrs="{'invisible' : [('state', '=', 'opening_control')]}" string="= Computed Balance" 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 +940,8 @@
|
|||
|
||||
|
||||
<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'}"/>
|
||||
<field name="cash_register_difference" class="oe_subtotal_footer_separator" widget="monetary" options="{'currency_field': 'currency_id'}"/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
|
|
Loading…
Reference in New Issue