[IMP] account, account_analytic_plans: Moved amount currency function from account to analytic plans
bzr revid: pso@tinyerp.com-20110414063606-4ssc3esyxdn1s22w
This commit is contained in:
parent
1874ca53b8
commit
9d96add953
|
@ -29,19 +29,6 @@ class account_analytic_line(osv.osv):
|
|||
_inherit = 'account.analytic.line'
|
||||
_description = 'Analytic Line'
|
||||
|
||||
def _get_amount(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
if not ids:
|
||||
return res
|
||||
for id in ids:
|
||||
res.setdefault(id, 0.0)
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
from_currency_id = line.company_id.currency_id.id
|
||||
to_currency_id = line.currency_id.id
|
||||
from_amount = line.amount
|
||||
res[line.id] = self.pool.get('res.currency').compute(cr, uid, from_currency_id, to_currency_id, from_amount, round=True, context=context)
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'product_uom_id': fields.many2one('product.uom', 'UoM'),
|
||||
'product_id': fields.many2one('product.product', 'Product'),
|
||||
|
@ -51,7 +38,7 @@ class account_analytic_line(osv.osv):
|
|||
'code': fields.char('Code', size=8),
|
||||
'ref': fields.char('Ref.', size=64),
|
||||
'currency_id': fields.related('move_id', 'currency_id', type='many2one', relation='res.currency', string='Account currency', store=True, help="The related account currency if not equal to the company one.", readonly=True),
|
||||
'amount_currency': fields.function(_get_amount, string="Amount Currency", type="float", method=True, store=True, help="The amount expressed in the related account currency if not equal to the company one.", readonly=True),
|
||||
'amount_currency': fields.related('move_id', 'amount_currency', type='float', string='Amount currency', store=True, help="The amount expressed in the related account currency if not equal to the company one.", readonly=True),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
|
|
@ -47,6 +47,29 @@ class one2many_mod2(fields.one2many):
|
|||
res[r[self._fields_id]].append( r['id'] )
|
||||
return res
|
||||
|
||||
class account_analytic_line(osv.osv):
|
||||
_inherit = 'account.analytic.line'
|
||||
_description = 'Analytic Line'
|
||||
|
||||
def _get_amount(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
if not ids:
|
||||
return res
|
||||
for id in ids:
|
||||
res.setdefault(id, 0.0)
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
from_currency_id = line.company_id.currency_id.id
|
||||
to_currency_id = line.currency_id.id
|
||||
from_amount = line.amount
|
||||
res[line.id] = self.pool.get('res.currency').compute(cr, uid, from_currency_id, to_currency_id, from_amount, round=True, context=context)
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'amount_currency': fields.function(_get_amount, string="Amount Currency", type="float", method=True, store=True, help="The amount expressed in the related account currency if not equal to the company one.", readonly=True),
|
||||
}
|
||||
|
||||
account_analytic_line()
|
||||
|
||||
class account_analytic_plan(osv.osv):
|
||||
_name = "account.analytic.plan"
|
||||
_description = "Analytic Plan"
|
||||
|
|
Loading…
Reference in New Issue