Ila Rana(Open ERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-17664-ira into 
lp:openobject-addons/6.0.

Requested reviews:
  Raphael Collet (OpenERP) (rco-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-17664-ira/+merge/76975

Hello Raphael,

There is a problem in Amount Currency value of Analytic line in following 
situation:

1. Define the Invoice order with other than Company's currency.In Invoice line, 
define one Analytic Distribution plan have 50% distribution for each analytic 
account.

2. After that, Validate this Invoice order.Then, check Analytic entry for for 
this invoice reference.
You get a wrong value in amount_currency field.

To overcome from this type error I have made changes in analytic_account_plan.I 
back-ported from trunk account_analytic_plan module.

Thanks,
Ila Rana
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-17664-ira/+merge/76975
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-17664-ira.
=== modified file 'account_analytic_plans/account_analytic_plans.py'
--- account_analytic_plans/account_analytic_plans.py	2011-01-14 00:11:01 +0000
+++ account_analytic_plans/account_analytic_plans.py	2011-09-26 12:52:25 +0000
@@ -47,6 +47,26 @@
             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 = {}
+        for id in ids:
+            res.setdefault(id, 0.0)
+        for line in self.browse(cr, uid, ids, context=context):
+            amount = line.move_id and line.move_id.amount_currency * (line.percentage / 100) * -1 or 0.0
+            res[line.id] = amount
+        return res
+
+    _columns = {
+        'amount_currency': fields.function(_get_amount, method=True, string="Amount Currency", type="float", store=True, help="The amount expressed in the related account currency if not equal to the company one.", readonly=True),
+        'percentage': fields.float('Percentage')
+    }
+
+account_analytic_line()
+
 class account_analytic_plan(osv.osv):
     _name = "account.analytic.plan"
     _description = "Analytic Plan"
@@ -338,6 +358,7 @@
                        'move_id': line.id,
                        'journal_id': line.journal_id.analytic_journal_id.id,
                        'ref': line.ref,
+                       'percentage': line2.rate,
                    }
                    analytic_line_obj.create(cr, uid, al_vals, context=context)
         return True

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to