Merge lp:~openerp-dev/openobject-addons/6.1-opw-580115-cbi into lp:openobject-addons/6.1

Proposed by Chris Biersbach (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-opw-580115-cbi
Merge into: lp:openobject-addons/6.1
Diff against target: 61 lines (+14/-15)
1 file modified
l10n_fr/report/base_report.py (+14/-15)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-opw-580115-cbi
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+130497@code.launchpad.net

Description of the change

In the l10n_fr module, 2 reports (Cilan and COmpte de Résultats) did not contain any values when printed.

This fixes these 2 reports and also cleans up the code a bit.

To post a comment you must log in.
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

Hello,

This bug was qualified as Not reproducible on Trunk. If this Merge Proposal could not be merged in v6.1 at the release of v7.0, it will be closed.

Thanks,
Naresh Soni

Unmerged revisions

7030. By Chris Biersbach (OpenERP)

[FIX] This fixes the 2 reports Bilan and Compte résultat in the l10n_fr module. Previously, this reports were empty, now the values correctly appear.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_fr/report/base_report.py'
2--- l10n_fr/report/base_report.py 2011-01-14 00:11:01 +0000
3+++ l10n_fr/report/base_report.py 2012-10-19 08:06:23 +0000
4@@ -30,6 +30,8 @@
5
6 from report import report_sxw
7
8+from tools import float_round
9+
10 class base_report(report_sxw.rml_parse):
11 def __init__(self, cr, uid, name, context=None):
12 super(base_report, self).__init__(cr, uid, name, context=context)
13@@ -42,8 +44,8 @@
14 self.context = context
15
16 def _load(self, name, form):
17- fiscalyear = self.pool.get('account.fiscalyear').browse(self.cr, self.uid, form['fiscalyear_id'])
18- period_ids=self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id', '=', form['fiscalyear_id'])])
19+ fiscalyear = self.pool.get('account.fiscalyear').browse(self.cr, self.uid, form['fiscalyear'])
20+ period_ids=self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id', '=', form['fiscalyear'])])
21
22 if period_ids:
23 self.cr.execute("SELECT MIN(date_start) AS date_start, MAX(date_stop) AS date_stop FROM account_period WHERE id = ANY(%s)", (period_ids,))
24@@ -95,26 +97,23 @@
25 query_params.append(list(period_ids))
26 self.cr.execute(query, query_params)
27
28- lines =self.cr.dictfetchall()
29+ lines = self.cr.dictfetchall()
30 for line in lines:
31 for account in accounts:
32 if(line["code"].startswith(account)):
33- operator=accounts[account][0]
34- type=accounts[account][1]
35- value=0.0
36- if(type == "S"):
37- value=line["debit"]-line["credit"]
38- elif(type == "D"):
39- value=line["debit"]-line["credit"]
40- if(value<0.001): value=0.0
41- elif(type == "C"):
42+ operator = accounts[account][0]
43+ type = accounts[account][1]
44+ value = 0.0
45+ if type in ["S", "D"]:
46+ value=line["debit"]-line["credit"]
47+ else:
48 value=line["credit"]-line["debit"]
49- if(value<0.001): value=0.0
50+ if type in ["D", "C"]:
51+ value = float_round(value, precision_digits=3)
52 if(operator == '+'):
53 sum += value
54 else:
55 sum -= value
56- break
57 self._set_variable(code, sum)
58
59-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
60\ No newline at end of file
61+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: