[Openerp-community] [Merge] lp:~openerp-community/c2c-financial-addons/fix_general_ledger into lp:c2c-financial-addons/6.0

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Openerp-community] [Merge] lp:~openerp-community/c2c-financial-addons/fix_general_ledger into lp:c2c-financial-addons/6.0

eLBatti
Lorenzo Battistini - Agile BG - Domsense has proposed merging lp:~openerp-community/c2c-financial-addons/fix_general_ledger into lp:c2c-financial-addons/6.0.

Requested reviews:
  Camptocamp (c2c)

For more details, see:
https://code.launchpad.net/~openerp-community/c2c-financial-addons/fix_general_ledger/+merge/83265

This fixes the following bug:

 - Run general ledger webkit wizard
 - In the account filters, select a leaf account (with parent)

Get

[2011-11-24 10:58:34,971][test] ERROR:db.cursor:Programming error: syntax error at or near ")"
LINE 1: ...ELECT a.id FROM account_account a  WHERE a.id IN () AND a.ty...
                                                             ^
, in query SELECT a.id FROM account_account a  WHERE a.id IN %(ids)s AND a.type not in %(exclude_type)s
[2011-11-24 10:58:34,973][test] ERROR:web-services:[01]: Exception: syntax error at or near ")"
[2011-11-24 10:58:34,974][test] ERROR:web-services:[02]: LINE 1: ...ELECT a.id FROM account_account a  WHERE a.id IN () AND a.ty...
[2011-11-24 10:58:34,974][test] ERROR:web-services:[03]:                                                              ^
[2011-11-24 10:58:34,974][test] ERROR:web-services:[04]:
[2011-11-24 10:58:34,974][test] ERROR:web-services:[05]: Traceback (most recent call last):
[2011-11-24 10:58:34,974][test] ERROR:web-services:[06]:   File "/home/elbati/workspace/openerp/openerp6/server/bin/service/web_services.py", line 724, in go
[2011-11-24 10:58:34,974][test] ERROR:web-services:[07]:     (result, format) = obj.create(cr, uid, ids, datas, context)
[2011-11-24 10:58:34,974][test] ERROR:web-services:[08]:   File "/home/elbati/workspace/openerp/openerp6/server/bin/addons/report_webkit/webkit_report.py", line 372, in create
[2011-11-24 10:58:34,975][test] ERROR:web-services:[09]:     result = self.create_source_pdf(cursor, uid, ids, data, report_xml, context)
[2011-11-24 10:58:34,975][test] ERROR:web-services:[10]:   File "/home/elbati/workspace/openerp/openerp6/server/bin/report/report_sxw.py", line 481, in create_source_pdf
[2011-11-24 10:58:34,975][test] ERROR:web-services:[11]:     return self.create_single_pdf(cr, uid, ids, data, report_xml, context)
[2011-11-24 10:58:34,975][test] ERROR:web-services:[12]:   File "/home/elbati/workspace/openerp/openerp6/server/bin/addons/account_financial_report_webkit/report/webkit_parser_header_fix.py", line 156, in create_single_pdf
[2011-11-24 10:58:34,975][test] ERROR:web-services:[13]:     self.parser_instance.set_context(objs, data, ids, report_xml.report_type)
[2011-11-24 10:58:34,975][test] ERROR:web-services:[14]:   File "/home/elbati/workspace/openerp/openerp6/server/bin/addons/account_financial_report_webkit/report/account_report_general_ledger.py", line 100, in set_context
[2011-11-24 10:58:34,975][test] ERROR:web-services:[15]:     accounts = self.get_all_accounts(new_ids, exclude_type=['view'])
[2011-11-24 10:58:34,975][test] ERROR:web-services:[16]:   File "/home/elbati/workspace/openerp/openerp6/server/bin/addons/account_financial_report_webkit/report/common_report_header_webkit.py", line 178, in get_all_accounts
[2011-11-24 10:58:34,976][test] ERROR:web-services:[17]:     self.cursor.execute(sql, sql_filters)
[2011-11-24 10:58:34,976][test] ERROR:web-services:[18]:   File "/home/elbati/workspace/openerp/openerp6/server/bin/sql_db.py", line 78, in wrapper
[2011-11-24 10:58:34,976][test] ERROR:web-services:[19]:     return f(self, *args, **kwargs)
[2011-11-24 10:58:34,976][test] ERROR:web-services:[20]:   File "/home/elbati/workspace/openerp/openerp6/server/bin/sql_db.py", line 131, in execute
[2011-11-24 10:58:34,976][test] ERROR:web-services:[21]:     res = self._obj.execute(query, params)
[2011-11-24 10:58:34,976][test] ERROR:web-services:[22]: ProgrammingError: syntax error at or near ")"
[2011-11-24 10:58:34,976][test] ERROR:web-services:[23]: LINE 1: ...ELECT a.id FROM account_account a  WHERE a.id IN () AND a.ty...
[2011-11-24 10:58:34,977][test] ERROR:web-services:[24]:
--
https://code.launchpad.net/~openerp-community/c2c-financial-addons/fix_general_ledger/+merge/83265
Your team OpenERP Community is subscribed to branch lp:~openerp-community/c2c-financial-addons/fix_general_ledger.

=== modified file 'account_financial_report_webkit/report/common_report_header_webkit.py'
--- account_financial_report_webkit/report/common_report_header_webkit.py 2011-11-21 12:46:39 +0000
+++ account_financial_report_webkit/report/common_report_header_webkit.py 2011-11-24 10:01:37 +0000
@@ -112,20 +112,21 @@
     def sort_accounts_with_structure(self, account_ids, context=None):
         """Sort accounts by code respecting their structure"""
 
-        def recursive_sort_by_code(accounts, parent_id=False):
+        def recursive_sort_by_code(accounts, parent_ids=[]):
             sorted_accounts = []
             level_accounts = [account for account
                               in accounts
-                              if (not parent_id and not account['parent_id'] or
-                                  account['parent_id'] and account['parent_id'][0] == parent_id)]
+                              if (not parent_ids and not account['parent_id'] or
+                                  account['parent_id'] and account['parent_id'][0] in parent_ids)]
             if not level_accounts:
                 return []
 
             level_accounts = sorted(level_accounts, key=lambda a: a['code'])
 
             for level_account in level_accounts:
-                sorted_accounts.append(level_account['id'])
-                sorted_accounts.extend(recursive_sort_by_code( accounts, parent_id=level_account['id']))
+                if level_account['id'] not in sorted_accounts:
+                    sorted_accounts.append(level_account['id'])
+                    sorted_accounts.extend(recursive_sort_by_code( accounts, parent_ids=[level_account['id']]))
             return sorted_accounts
 
         if not account_ids:
@@ -134,8 +135,11 @@
                                                          account_ids,
                                                          ['id', 'parent_id', 'code'],
                                                          context=context)
-
-        sorted_accounts = recursive_sort_by_code(accounts)
+        parent_ids = []
+        for account in accounts:
+            if account['parent_id'] and account['parent_id'][0] not in parent_ids:
+                parent_ids.append(account['parent_id'][0])
+        sorted_accounts = recursive_sort_by_code(accounts, parent_ids)
 
         return sorted_accounts
 


_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|

[Openerp-community] [Merge] lp:~openerp-community/c2c-financial-addons/fix_general_ledger into lp:c2c-financial-addons/6.0

noreply
The proposal to merge lp:~openerp-community/c2c-financial-addons/fix_general_ledger into lp:c2c-financial-addons/6.0 has been updated.

    Status: Needs review => Merged

For more details, see:
https://code.launchpad.net/~openerp-community/c2c-financial-addons/fix_general_ledger/+merge/83265
--
https://code.launchpad.net/~openerp-community/c2c-financial-addons/fix_general_ledger/+merge/83265
Your team OpenERP Community is subscribed to branch lp:~openerp-community/c2c-financial-addons/fix_general_ledger.

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|

Re: [Openerp-community] [Merge] lp:~openerp-community/c2c-financial-addons/fix_general_ledger into lp:c2c-financial-addons/6.0

Guewen Baconnier @ Camptocamp
In reply to this post by eLBatti
Review: Approve

Thanks for the fix !
Your patch is now merged.
--
https://code.launchpad.net/~openerp-community/c2c-financial-addons/fix_general_ledger/+merge/83265
Your team OpenERP Community is subscribed to branch lp:~openerp-community/c2c-financial-addons/fix_general_ledger.

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|

Re: [Openerp-community] [Merge] lp:~openerp-community/c2c-financial-addons/fix_general_ledger into lp:c2c-financial-addons/6.0

Frédéric Clementi
In reply to this post by eLBatti
FYI, this bug was due to a problem we tried to bypass on account level calculation at some point. Thank you

--
https://code.launchpad.net/~openerp-community/c2c-financial-addons/fix_general_ledger/+merge/83265
Your team OpenERP Community is subscribed to branch lp:~openerp-community/c2c-financial-addons/fix_general_ledger.

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