-class res_currency_rate_type(osv.osv):
- _name = "res.currency.rate.type"
- _description = "Currency Rate Type"
- _columns = {
- 'name': fields.char('Name', required=True, translate=True),
- }
+ def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount,
+ round=True, context=None):
+ context = context or {}
+ if not from_currency_id:
+ from_currency_id = to_currency_id
+ if not to_currency_id:
+ to_currency_id = from_currency_id
+ xc = self.browse(cr, uid, [from_currency_id,to_currency_id], context=context)
+ from_currency = (xc[0].id == from_currency_id and xc[0]) or xc[1]
+ to_currency = (xc[0].id == to_currency_id and xc[0]) or xc[1]
+ return self._compute(cr, uid, from_currency, to_currency, from_amount, round, context)