[MERGE] currency position dsh
bzr revid: al@openerp.com-20110921232150-c1rpri2650363fkd
This commit is contained in:
commit
c1026977ab
|
@ -62,11 +62,12 @@ class res_currency(osv.osv):
|
|||
'active': fields.boolean('Active'),
|
||||
'company_id':fields.many2one('res.company', 'Company'),
|
||||
'date': fields.date('Date'),
|
||||
'base': fields.boolean('Base')
|
||||
|
||||
'base': fields.boolean('Base'),
|
||||
'position': fields.selection([('after','After Amount'),('before','Before Amount')], 'Symbol position', help="Determines where the currency symbol should be placed after or before the amount.")
|
||||
}
|
||||
_defaults = {
|
||||
'active': lambda *a: 1,
|
||||
'position' : 'after',
|
||||
}
|
||||
_sql_constraints = [
|
||||
# this constraint does not cover all cases due to SQL NULL handling for company_id,
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
<field name="rate"/>
|
||||
<field name="rounding"/>
|
||||
<field name="accuracy"/>
|
||||
<field name="position"/>
|
||||
<field name="active"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
@ -37,23 +38,30 @@
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Currency">
|
||||
<group col="6" colspan="6">
|
||||
<group col="6" colspan="4">
|
||||
<field name="name"/>
|
||||
<field name="rate"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<field name="symbol"/>
|
||||
</group>
|
||||
|
||||
<group col="2" colspan="2">
|
||||
<separator string="Price Accuracy" colspan="2"/>
|
||||
<field name="rounding"/>
|
||||
<field name="accuracy"/>
|
||||
</group>
|
||||
<group col="6" colspan="4">
|
||||
<group col="2" colspan="2">
|
||||
<separator string="Price Accuracy" colspan="2"/>
|
||||
<field name="rounding"/>
|
||||
<field name="accuracy"/>
|
||||
</group>
|
||||
|
||||
<group col="2" colspan="2">
|
||||
<separator string="Miscelleanous" colspan="2"/>
|
||||
<field name="base"/>
|
||||
<field name="active" select="1"/>
|
||||
<group col="2" colspan="2">
|
||||
<separator string="Display" colspan="2"/>
|
||||
<field name="symbol"/>
|
||||
<field name="position"/>
|
||||
</group>
|
||||
|
||||
<group col="2" colspan="2">
|
||||
<separator string="Miscelleanous" colspan="2"/>
|
||||
<field name="base"/>
|
||||
<field name="active" select="1"/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<field colspan="4" mode="tree,form" name="rate_ids" nolabel="1" attrs="{'readonly':[('base','=',True)]}">
|
||||
|
|
|
@ -267,7 +267,7 @@ class rml_parse(object):
|
|||
d = obj._field.digits[1] or DEFAULT_DIGITS
|
||||
return d
|
||||
|
||||
def formatLang(self, value, digits=None, date=False, date_time=False, grouping=True, monetary=False, dp=False):
|
||||
def formatLang(self, value, digits=None, date=False, date_time=False, grouping=True, monetary=False, dp=False, currency_obj=False):
|
||||
"""
|
||||
Assuming 'Account' decimal.precision=3:
|
||||
formatLang(value) -> digits=2 (default)
|
||||
|
@ -305,7 +305,13 @@ class rml_parse(object):
|
|||
date = datetime(*value.timetuple()[:6])
|
||||
return date.strftime(date_format)
|
||||
|
||||
return self.lang_dict['lang_obj'].format('%.' + str(digits) + 'f', value, grouping=grouping, monetary=monetary)
|
||||
res = self.lang_dict['lang_obj'].format('%.' + str(digits) + 'f', value, grouping=grouping, monetary=monetary)
|
||||
if currency_obj:
|
||||
if currency_obj.position == 'after':
|
||||
res='%s %s'%(res,currency_obj.symbol)
|
||||
elif currency_obj and currency_obj.position == 'before':
|
||||
res='%s %s'%(currency_obj.symbol, res)
|
||||
return res
|
||||
|
||||
def repeatIn(self, lst, name,nodes_parent=False):
|
||||
ret_lst = []
|
||||
|
|
Loading…
Reference in New Issue