diff --git a/bin/addons/base/ir/ir.xml b/bin/addons/base/ir/ir.xml index f4130da55a4..aa45e0fcd6d 100644 --- a/bin/addons/base/ir/ir.xml +++ b/bin/addons/base/ir/ir.xml @@ -663,7 +663,6 @@ - @@ -742,7 +741,6 @@ - diff --git a/bin/addons/base/res/partner/partner_view.xml b/bin/addons/base/res/partner/partner_view.xml index f53362107cd..1146d019426 100644 --- a/bin/addons/base/res/partner/partner_view.xml +++ b/bin/addons/base/res/partner/partner_view.xml @@ -527,5 +527,10 @@ + + diff --git a/bin/addons/base/res/res_currency.py b/bin/addons/base/res/res_currency.py index 909d8b1785b..0eb1befb599 100644 --- a/bin/addons/base/res/res_currency.py +++ b/bin/addons/base/res/res_currency.py @@ -79,7 +79,7 @@ class res_currency(osv.osv): def is_zero(self, cr, uid, currency, amount): return abs(self.round(cr, uid, currency, amount)) < currency.rounding - def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount, round=True, context={}, account=None): + def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount, round=True, context={}, account=None, account_invert=False): if not from_currency_id: from_currency_id = to_currency_id xc=self.browse(cr, uid, [from_currency_id,to_currency_id], context=context) @@ -100,8 +100,10 @@ class res_currency(osv.osv): cr.execute('select sum(debit-credit),sum(amount_currency) from account_move_line l ' \ 'where l.currency_id=%d and l.account_id=%d and '+q, (account.currency_id.id,account.id,)) tot1,tot2 = cr.fetchone() - if tot2: + if tot2 and not account_invert: rate = float(tot1)/float(tot2) + elif tot1 and account_invert: + rate = float(tot2)/float(tot1) if to_currency_id==from_currency_id: if round: return self.round(cr, uid, to_currency, from_amount) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 56a97a285bc..5480dab817c 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1542,6 +1542,7 @@ class orm(orm_template): def __init__(self, cr): super(orm, self).__init__(cr) + self._columns = self._columns.copy() f = filter(lambda a: isinstance(self._columns[a], fields.function) and self._columns[a].store, self._columns) if f: list_store = [] @@ -1587,8 +1588,6 @@ class orm(orm_template): 'translate': (field['translate']), #'select': int(field['select_level']) } - #if field['relation']: - # attrs['relation'] = field['relation'] if field['ttype'] == 'selection': self._columns[field['name']] = getattr(fields, field['ttype'])(eval(field['selection']), **attrs) elif field['ttype'] == 'many2one':