[14.0][FIX] account_invoice_report_grouped_by_picking. #326
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, i found a error when i printed some account.move report without pickings and with note on line.
Error:
Odoo Server Error
Traceback (most recent call last):
File "/opt/odoo-server/odoo/addons/base/models/qweb.py", line 329, in _compiled_fn
return compiled(self, append, new, options, log)
File "", line 1, in template_account_report_invoice_document_3446
File "", line 2, in body_call_content_3444
File "", line 1, in foreach_3399
AttributeError: 'bool' object has no attribute 'get'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/odoo-server/addons/web/controllers/main.py", line 2107, in report_download
response = self.report_routes(reportname, docids=docids, converter=converter, context=context)
File "/opt/odoo-server/odoo/http.py", line 544, in response_wrap
response = f(*args, **kw)
File "/opt/odoo-server/extra-addons/oca/reporting-engine/report_xlsx/controllers/main.py", line 18, in report_routes
return super(ReportController, self).report_routes(
File "/opt/odoo-server/odoo/http.py", line 544, in response_wrap
response = f(*args, **kw)
File "/opt/odoo-server/addons/web/controllers/main.py", line 2038, in report_routes
pdf = report.with_context(context)._render_qweb_pdf(docids, data=data)[0]
File "/opt/odoo-server/addons/account/models/ir_actions_report.py", line 54, in _render_qweb_pdf
return super()._render_qweb_pdf(res_ids=res_ids, data=data)
File "/opt/odoo-server/odoo/addons/base/models/ir_actions_report.py", line 896, in _render_qweb_pdf
html = self_sudo.with_context(context)._render_qweb_html(res_ids, data=data)[0]
File "/opt/odoo-server/extra-addons/oca/account-financial-reporting/account_financial_report/models/ir_actions_report.py", line 19, in _render_qweb_html
return super(IrActionsReport, obj)._render_qweb_html(docids, data)
File "/opt/odoo-server/odoo/addons/base/models/ir_actions_report.py", line 937, in _render_qweb_html
return self._render_template(self.report_name, data), 'html'
File "/opt/odoo-server/odoo/addons/base/models/ir_actions_report.py", line 672, in _render_template
return view_obj._render_template(template, values)
File "/opt/odoo-server/odoo/addons/base/models/ir_ui_view.py", line 1727, in _render_template
return self.browse(self.get_view_id(template))._render(values, engine)
File "/opt/odoo-server/addons/web_editor/models/ir_ui_view.py", line 28, in _render
return super(IrUiView, self)._render(values=values, engine=engine, minimal_qcontext=minimal_qcontext)
File "/opt/odoo-server/odoo/addons/base/models/ir_ui_view.py", line 1735, in _render
return self.env[engine]._render(self.id, qcontext)
File "/opt/odoo-server/odoo/addons/base/models/ir_qweb.py", line 55, in _render
result = super(IrQWeb, self)._render(id_or_xml_id, values=values, **context)
File "/opt/odoo-server/odoo/addons/base/models/qweb.py", line 254, in _render
self.compile(template, options)(self, body.append, values or {})
File "/opt/odoo-server/odoo/addons/base/models/qweb.py", line 331, in _compiled_fn
raise e
File "/opt/odoo-server/odoo/addons/base/models/qweb.py", line 329, in _compiled_fn
return compiled(self, append, new, options, log)
File "", line 1, in template_account_report_invoice_with_payments_3361
File "", line 2, in body_call_content_3359
File "", line 3, in foreach_3358
File "/opt/odoo-server/odoo/addons/base/models/qweb.py", line 336, in _compiled_fn
raise QWebException("Error to render compiling AST", e, path, node and etree.tostring(node[0], encoding='unicode'), name)
odoo.addons.base.models.qweb.QWebException: 'bool' object has no attribute 'get'
Traceback (most recent call last):
File "/opt/odoo-server/odoo/addons/base/models/qweb.py", line 329, in _compiled_fn
return compiled(self, append, new, options, log)
File "", line 1, in template_account_report_invoice_document_3446
File "", line 2, in body_call_content_3444
File "", line 1, in foreach_3399
AttributeError: 'bool' object has no attribute 'get'
Error to render compiling AST
AttributeError: 'bool' object has no attribute 'get'
Template: account.report_invoice_document
Path: /t/t/div/table/tbody/t[3]/tr[2]
Node:
Subtotal:
Example of account.move object:
![image](https://private-user-images.githubusercontent.com/128601880/347353815-e2516e18-61ed-4ff8-bcf7-598483990856.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNTQ2NTQsIm5iZiI6MTczOTM1NDM1NCwicGF0aCI6Ii8xMjg2MDE4ODAvMzQ3MzUzODE1LWUyNTE2ZTE4LTYxZWQtNGZmOC1iY2Y3LTU5ODQ4Mzk5MDg1Ni5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQwOTU5MTRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04M2RlNjdkNjBjYTJlNTg0NjdlOWRjNGM5YTI2MGUzNTMwMzFiZmU3YjBiNTQ4YTRmMGY4M2UwM2I0OTVlMTkyJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.3FlAwk89nUTMVNlYCQrbp6B3hsGG3_9jMc2kToUGIHI)
Summary the next_line variable can be a list with a False inside, you must check that the value of position 0 before using the .get() method, in this line :
<tr t-if="lines_group.get('is_last_section_notes') and (not next_line or not next_line[0].get('is_last_section_notes')) and subtotal">"