Giter Site home page Giter Site logo

Comments (8)

sbidoul avatar sbidoul commented on July 19, 2024

@ccarly can you provide a detailed procedure to reproduce the bug, as well as the complete stack trace.

That would be really helpful.

Thanks in advance.

from account-financial-reporting.

ccarly avatar ccarly commented on July 19, 2024

@sbidoul

this is a full trace

2014-11-29 02:49:36,924 17266 ERROR cm openerp.service.report: Exception: 'account.journal.period' object has no attribute 'sort'
Traceback (most recent call last):
File "/data/home/openerp/bin/8.0/openerp/service/report.py", line 93, in go
result, format = openerp.report.render_report(cr, uid, ids, object, datas, context)
File "/data/home/openerp/bin/8.0/openerp/report/init.py", line 40, in render_report
return registry['ir.actions.report.xml'].render_report(cr, uid, ids, name, data, context)
File "/data/home/openerp/bin/8.0/openerp/api.py", line 237, in wrapper
return old_api(self, _args, *_kwargs)
File "/data/home/openerp/bin/8.0/openerp/addons/base/ir/ir_actions.py", line 155, in render_report
return new_report.create(cr, uid, res_ids, data, context)
File "/home/openerp/bin/8.0/addons/report_webkit/webkit_report.py", line 376, in create
result = self.create_source_pdf(cursor, uid, ids, data, report_xml, context)
File "/data/home/openerp/bin/8.0/openerp/report/report_sxw.py", line 461, in create_source_pdf
return self.create_single_pdf(cr, uid, ids, data, report_xml, context)
File "/home/openerp/Localizacion/0-community/account_financial_report_webkit/report/webkit_parser_header_fix.py", line 203, in create_single_pdf
parser_instance.set_context(objs, data, ids, report_xml.report_type)
File "/home/openerp/Localizacion/0-community/account_financial_report_webkit/report/print_journal.py", line 129, in set_context
objects.sort(key=lambda a: (a.journal_id.code, a.period_id.date_start))
AttributeError: 'account.journal.period' object has no attribute 'sort'
2014-11-29 02:49:37,056 17266 ERROR cm openerp.addons.web.controllers.main: An exception occured during an http request
Traceback (most recent call last):
File "/home/openerp/bin/8.0/addons/web/controllers/main.py", line 69, in wrap
return f(_args, *_kwargs)
File "/home/openerp/bin/8.0/addons/web/controllers/main.py", line 1577, in index
request.session.db, request.session.uid, request.session.password, report_id)
File "/data/home/openerp/bin/8.0/openerp/http.py", line 825, in proxy_method
result = dispatch_rpc(self.service_name, method, args)
File "/data/home/openerp/bin/8.0/openerp/http.py", line 108, in dispatch_rpc
result = dispatch(method, params)
File "/data/home/openerp/bin/8.0/openerp/service/report.py", line 34, in dispatch
res = fn(db, uid, *params)
File "/data/home/openerp/bin/8.0/openerp/service/report.py", line 141, in exp_report_get
return _check_report(report_id)
File "/data/home/openerp/bin/8.0/openerp/service/report.py", line 119, in _check_report
raise openerp.osv.orm.except_orm(exc.message, exc.traceback)
except_orm: (u"'account.journal.period' object has no attribute 'sort'", (<type 'exceptions.AttributeError'>, AttributeError("'account.journal.period' object has no attribute 'sort'",), <traceback object at 0x7fb439697248>))

from account-financial-reporting.

sbidoul avatar sbidoul commented on July 19, 2024

@ccarly can you test again with the patch in #37 ?

from account-financial-reporting.

ccarly avatar ccarly commented on July 19, 2024

2014-12-01 16:10:16,479 3114 INFO cm werkzeug: 192.168.254.214 - - [01/Dec/2014 16:10:16] "POST /web/dataset/call_kw/account.journal/read HTTP/1.1" 200 -
2014-12-01 16:10:16,646 3114 WARNING cm openerp.pooler: openerp.pooler.get_db_and_pool() is deprecated.
2014-12-01 16:10:16,658 3114 WARNING cm openerp.pooler: openerp.pooler.get_db_and_pool() is deprecated.
2014-12-01 16:10:16,690 3114 ERROR cm openerp.service.report: Exception: 'account.move.line' object has no attribute 'sort'
Traceback (most recent call last):
File "/data/home/openerp/bin/8.0/openerp/service/report.py", line 93, in go
result, format = openerp.report.render_report(cr, uid, ids, object, datas, context)
File "/data/home/openerp/bin/8.0/openerp/report/init.py", line 40, in render_report
return registry['ir.actions.report.xml'].render_report(cr, uid, ids, name, data, context)
File "/data/home/openerp/bin/8.0/openerp/api.py", line 237, in wrapper
return old_api(self, _args, *_kwargs)
File "/data/home/openerp/bin/8.0/openerp/addons/base/ir/ir_actions.py", line 155, in render_report
return new_report.create(cr, uid, res_ids, data, context)
File "/home/openerp/bin/8.0/addons/report_webkit/webkit_report.py", line 376, in create
result = self.create_source_pdf(cursor, uid, ids, data, report_xml, context)
File "/data/home/openerp/bin/8.0/openerp/report/report_sxw.py", line 461, in create_source_pdf
return self.create_single_pdf(cr, uid, ids, data, report_xml, context)
File "/home/openerp/Localizacion/0-community/account_financial_report_webkit/report/webkit_parser_header_fix.py", line 203, in create_single_pdf
parser_instance.set_context(objs, data, ids, report_xml.report_type)
File "/home/openerp/Localizacion/0-community/account_financial_report_webkit/report/print_journal.py", line 145, in set_context
move.line_id.sort(key=lambda a: (a.date, a.account_id.code))
AttributeError: 'account.move.line' object has no attribute 'sort'

from account-financial-reporting.

ccarly avatar ccarly commented on July 19, 2024

What's the status on this issue or planning to solve?

from account-financial-reporting.

sbidoul avatar sbidoul commented on July 19, 2024

@ccarly The problem is non-trivial and requires a significant refactoring of report/print_journal.py.

I have currently no planning for this. Feel free to contribute a pull request if you wish.

from account-financial-reporting.

ccarly avatar ccarly commented on July 19, 2024

Patch to resolve sort object in account_financial_report_webkit/report/print_journal.py

129c129
<         objects.sort(key=lambda a: (a.journal_id.code, a.period_id.date_start))
---
>         objects.sorted(key=lambda a: (a.journal_id.code, a.period_id.date_start))
144c144
<                 move.line_id.sort(key=lambda a: (a.date, a.account_id.code))
---
>                 move.line_id.sorted(key=lambda a: (a.date, a.account_id.code))

from account-financial-reporting.

ccarly avatar ccarly commented on July 19, 2024

This two patched to solve the issue

Final patch print_journal.py

*** OCA-account-financial-reporting/account_financial_report_webkit/report/print_journal.py       2015-01-12 16:22:54.603658433 -0500
--- account_financial_report_webkit/report/print_journal.py    2015-01-12 19:53:38.250835855 -0500
***************
*** 126,133 ****
          objects = account_journal_period_obj.browse(self.cursor, self.uid,
                                                      new_ids)
          # Sort by journal and period
!         objects.sort(key=lambda a: (a.journal_id.code, a.period_id.date_start))
          move_obj = self.pool.get('account.move')
          for journal_period in objects:
              domain_arg = [
                  ('journal_id', '=', journal_period.journal_id.id),
--- 126,134 ----
          objects = account_journal_period_obj.browse(self.cursor, self.uid,
                                                      new_ids)
          # Sort by journal and period
!         objects.sorted(key=lambda a: (a.journal_id.code, a.period_id.date_start))
          move_obj = self.pool.get('account.move')
+         moves = {}
          for journal_period in objects:
              domain_arg = [
                  ('journal_id', '=', journal_period.journal_id.id),
***************
*** 137,147 ****
                  domain_arg += [('state', '=', 'posted')]
              move_ids = move_obj.search(self.cursor, self.uid, domain_arg,
                                         order="name")
!             journal_period.moves = move_obj.browse(self.cursor, self.uid,
                                                     move_ids)
              # Sort account move line by account accountant
!             for move in journal_period.moves:
!                 move.line_id.sort(key=lambda a: (a.date, a.account_id.code))

          self.localcontext.update({
              'fiscalyear': fiscalyear,
--- 138,148 ----
                  domain_arg += [('state', '=', 'posted')]
              move_ids = move_obj.search(self.cursor, self.uid, domain_arg,
                                         order="name")
!             moves[journal_period..id] = move_obj.browse(self.cursor, self.uid,
                                                     move_ids)
              # Sort account move line by account accountant
!             for move in moves[journal_period..id]:
!                 move.line_id.sorted(key=lambda a: (a.date, a.account_id.code))

          self.localcontext.update({
              'fiscalyear': fiscalyear,
***************
*** 150,155 ****
--- 151,157 ----
              'start_period': start_period,
              'stop_period': stop_period,
              'chart_account': chart_account,
+             'moves', moves,
          })

          return super(PrintJournalWebkit, self).set_context(

Patch for account_report_print_journal.mako

*** OCA-account-financial-reporting/account_financial_report_webkit/report/templates/account_report_print_journal.mako    2015-01-12 16:22:54.603658433 -0500
--- account_financial_report_webkit/report/templates/account_report_print_journal.mako 2015-01-12 19:04:35.676527343 -0500
***************
*** 99,105 ****
                      %endif
                  </div>
              </div>
!             %for move in journal_period.moves:
              <%
              new_move = True
              %>
--- 99,105 ----
                      %endif
                  </div>
              </div>
!             %for move in moves[journal_period.id]:
              <%
              new_move = True
              %>

from account-financial-reporting.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.