Merge lp:~credativ/openobject-addons/fix-c2c-budgets-6.0 into lp:openobject-addons/extra-6.0

Proposed by Dimitri John Ledkov (ex-credativ)
Status: Needs review
Proposed branch: lp:~credativ/openobject-addons/fix-c2c-budgets-6.0
Merge into: lp:openobject-addons/extra-6.0
Diff against target: 40 lines (+5/-11)
1 file modified
c2c_budget/wizard/validate_budget_structure.py (+5/-11)
To merge this branch: bzr merge lp:~credativ/openobject-addons/fix-c2c-budgets-6.0
Reviewer Review Type Date Requested Status
OpenERP Committers Pending
Review via email: mp+81574@code.launchpad.net

Description of the change

Forward-port of a fix from 5.0 which didn't get applied to 6.0 nor trunk.

To post a comment you must log in.

Unmerged revisions

5584. By gpa(OpenERP)

[FIX] c2c_budget module: Corrected account_account_rel missing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'c2c_budget/wizard/validate_budget_structure.py'
--- c2c_budget/wizard/validate_budget_structure.py 2009-10-15 11:25:40 +0000
+++ c2c_budget/wizard/validate_budget_structure.py 2011-11-08 14:02:26 +0000
@@ -81,7 +81,7 @@
81 self.cr = cr81 self.cr = cr
82 82
83 sql_filters = self._get_sql_filters(data['form']['company'], data['form']['account_type'][0][2])83 sql_filters = self._get_sql_filters(data['form']['company'], data['form']['account_type'][0][2])
84 sql_filters_aa2 = self._get_sql_filters(data['form']['company'], data['form']['account_type'][0][2], 'aa2')84 sql_filters_aa2 = self._get_sql_filters(data['form']['company'], data['form']['account_type'][0][2], 'aa')
85 85
86 root_id = data['ids'][0]86 root_id = data['ids'][0]
87 87
@@ -213,10 +213,8 @@
213 """ return all account that do not have parents """213 """ return all account that do not have parents """
214 214
215 query = """ SELECT distinct(aa.id)215 query = """ SELECT distinct(aa.id)
216 FROM account_account aa LEFT OUTER JOIN account_account_rel rel ON (aa.id = rel.child_id)216 FROM account_account aa
217 WHERE rel.child_id IS NULL217 WHERE aa.active %s """ % sql_filters
218 AND aa.active
219 %s """ % sql_filters
220 self.cr.execute(query)218 self.cr.execute(query)
221 219
222 result = map(lambda x: x[0], self.cr.fetchall())220 result = map(lambda x: x[0], self.cr.fetchall())
@@ -234,12 +232,8 @@
234232
235 #build a dictionnary {parent_id -> [children_ids]}233 #build a dictionnary {parent_id -> [children_ids]}
236 children_ids = {}234 children_ids = {}
237 query = """SELECT rel.child_id, rel.parent_id235 query = """SELECT aa.id, aa.parent_id
238 FROM account_account_rel rel, account_account aa, account_account aa2236 FROM account_account aa WHERE aa.active %s """ % (sql_filter)
239 WHERE rel.parent_id = aa.id
240 AND rel.child_id = aa2.id
241 AND aa.active
242 AND aa2.active %s """ % (sql_filter)
243 237
244 self.cr.execute(query)238 self.cr.execute(query)
245 for i in self.cr.fetchall():239 for i in self.cr.fetchall():