Ujjvala Collins (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-account_report-balance_field_fix-uco 
into lp:~openerp-dev/openobject-addons/trunk-account_report-uco.

Requested reviews:
  OpenERP R&D Team (openerp-dev)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-account_report-balance_field_fix-uco/+merge/74344

[FIX] account:
-------------------------
An error occurs when a record contains type='Account Report' and then print the 
Financial report gives recursion error.
There are three possible ways to solve this error:
1) Mark the balance field as store=True. (But can't store it as balance field 
is needed only at runtime so we calculate it and use it. That's it..!)
2) Make a function which will browse the related account_report_id and returns 
the balance value.
3) Call the same function passing account_report_id and fetch balance from it. 
(which is already done for elif type='sum' part (what we have used))
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-account_report-balance_field_fix-uco/+merge/74344
Your team OpenERP R&D Team is requested to review the proposed merge of 
lp:~openerp-dev/openobject-addons/trunk-account_report-balance_field_fix-uco 
into lp:~openerp-dev/openobject-addons/trunk-account_report-uco.
=== modified file 'account/account.py'
--- account/account.py	2011-08-31 12:50:38 +0000
+++ account/account.py	2011-09-07 05:43:09 +0000
@@ -2650,7 +2650,10 @@
                     balance += a.balance
             elif report.type == 'account_report' and report.account_report_id:
                 # it's the amount of the linked report
-                balance = report.account_report_id.balance
+                res2 = self._get_balance(cr, uid, [report.account_report_id.id], 'balance', False, context=context)
+                res_all.update(res2)
+                for key, value in res2.items():
+                    balance += value
             elif report.type == 'sum':
                 # it's the sum of balance of the children of this account.report
                 #for child in report.children_ids:

_______________________________________________
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