openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #05462
[Merge] lp:~openerp-dev/openobject-addons/trunk-bug-717198-pso into lp:openobject-addons
Priyesh (Open ERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-bug-717198-pso into lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
Related bugs:
Bug #717198 in OpenERP Addons: "Wrong computation of amount currency in analytic entry"
https://bugs.launchpad.net/openobject-addons/+bug/717198
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-717198-pso/+merge/57623
Fixed bug: 717198 (https://bugs.launchpad.net/openobject-addons/+bug/717198)
Fixed wrong computation of amount currency in analytic lines.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-717198-pso/+merge/57623
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-bug-717198-pso.
=== modified file 'account/account_analytic_line.py'
--- account/account_analytic_line.py 2011-02-25 14:11:14 +0000
+++ account/account_analytic_line.py 2011-04-14 05:52:33 +0000
@@ -28,6 +28,20 @@
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'),
@@ -37,7 +51,7 @@
'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.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),
+ '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),
}
_defaults = {
Follow ups