Revert "[IMP] base: use currency position from language"
NB : Not reviewed by apr and qdp
This reverts commit 58f16b7060.
This commit is contained in:
@@ -53,19 +53,6 @@ class res_currency(osv.osv):
|
||||
res[currency.id] = 0
|
||||
return res
|
||||
|
||||
def _compute_position(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
lang = self.pool['res.lang']
|
||||
lang_id = lang._lang_get(cr, uid, context.get('lang'))
|
||||
position = lang.read(cr, uid, lang_id, ['position'], context=context)['position']
|
||||
for currency in self.browse(cr, uid, ids, context=context):
|
||||
res[currency.id] = position
|
||||
|
||||
return res
|
||||
|
||||
_name = "res.currency"
|
||||
_description = "Currency"
|
||||
_columns = {
|
||||
@@ -78,7 +65,7 @@ class res_currency(osv.osv):
|
||||
'rounding': fields.float('Rounding Factor', digits=(12,6)),
|
||||
'decimal_places': fields.function(_decimal_places, string='Decimal Places', type='integer'),
|
||||
'active': fields.boolean('Active'),
|
||||
'position': fields.function(_compute_position, type='char', string="Currency Symbol Position"),
|
||||
'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': 1,
|
||||
|
||||
@@ -94,7 +94,6 @@ class lang(osv.osv):
|
||||
'time_format' : fix_datetime_format(locale.nl_langinfo(locale.T_FMT)),
|
||||
'decimal_point' : fix_xa0(str(locale.localeconv()['decimal_point'])),
|
||||
'thousands_sep' : fix_xa0(str(locale.localeconv()['thousands_sep'])),
|
||||
'position': 'before' if locale.nl_langinfo(locale.CRNCYSTR)[0] == '-' else 'after'
|
||||
}
|
||||
lang_id = False
|
||||
try:
|
||||
@@ -138,7 +137,6 @@ class lang(osv.osv):
|
||||
'grouping':fields.char('Separator Format', required=True,help="The Separator Format should be like [,n] where 0 < n :starting from Unit digit.-1 will end the separation. e.g. [3,2,-1] will represent 106500 to be 1,06,500;[1,2,-1] will represent it to be 106,50,0;[3] will represent it as 106,500. Provided ',' as the thousand separator in each case."),
|
||||
'decimal_point':fields.char('Decimal Separator', required=True),
|
||||
'thousands_sep':fields.char('Thousands Separator'),
|
||||
'position': fields.selection([('after','After Amount'),('before','Before Amount')], 'Currency Symbol Position', help="Determines where the currency symbol should be placed after or before the amount.")
|
||||
}
|
||||
_defaults = {
|
||||
'active': 1,
|
||||
@@ -149,7 +147,6 @@ class lang(osv.osv):
|
||||
'grouping': '[]',
|
||||
'decimal_point': '.',
|
||||
'thousands_sep': ',',
|
||||
'position': 'after'
|
||||
}
|
||||
_sql_constraints = [
|
||||
('name_uniq', 'unique (name)', 'The name of the language must be unique !'),
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
<newline/>
|
||||
<field name="active" />
|
||||
<field name="translatable"/>
|
||||
<field name="position"/>
|
||||
</group>
|
||||
<separator colspan="4" string="Legends for supported Date and Time Formats"/>
|
||||
<group col="4" colspan="4">
|
||||
|
||||
@@ -95,7 +95,6 @@ class TestCurrencyExport(TestExport):
|
||||
super(TestCurrencyExport, self).setUp()
|
||||
self.Currency = self.registry('res.currency')
|
||||
self.base = self.create(self.Currency, name="Source", symbol=u'source')
|
||||
self.lang_en = self.registry['ir.model.data'].xmlid_to_object(self.cr, self.uid, 'base.lang_en')
|
||||
|
||||
def create(self, model, context=None, **values):
|
||||
return model.browse(
|
||||
@@ -120,7 +119,6 @@ class TestCurrencyExport(TestExport):
|
||||
return converted
|
||||
|
||||
def test_currency_post(self):
|
||||
self.lang_en.write({'position': 'after'})
|
||||
currency = self.create(self.Currency, name="Test", symbol=u"test")
|
||||
obj = self.create(self.Model, value=0.12)
|
||||
|
||||
@@ -138,8 +136,8 @@ class TestCurrencyExport(TestExport):
|
||||
).encode('utf-8'),)
|
||||
|
||||
def test_currency_pre(self):
|
||||
self.lang_en.write({'position': 'before'})
|
||||
currency = self.create(self.Currency, name="Test", symbol=u"test")
|
||||
currency = self.create(
|
||||
self.Currency, name="Test", symbol=u"test", position='before')
|
||||
obj = self.create(self.Model, value=0.12)
|
||||
|
||||
converted = self.convert(obj, dest=currency)
|
||||
@@ -159,7 +157,6 @@ class TestCurrencyExport(TestExport):
|
||||
def test_currency_precision(self):
|
||||
""" Precision should be the currency's, not the float field's
|
||||
"""
|
||||
self.lang_en.write({'position': 'after'})
|
||||
currency = self.create(self.Currency, name="Test", symbol=u"test",)
|
||||
obj = self.create(self.Model, value=0.1234567)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user