Friday, September 13, 2024
1 change · saas-17.1
Miscellaneous changes
Currently error is generated when try to edit 'Invoices' or 'Invoices without Payment' reports in studio mode when there is no record. Steps to reproduce: - Install an 'account' and 'web_studio' module (Without demo data). - Navigate to invoicing / Customers / Invoices and open a web studio mode. - Open reports and click on the 'Invoice' or 'Invoices without Payment' reports. - Click on 'EDIT SOURCES'. See Traceback:- ``` TypeError: 'bool' object is not subscriptable File "<
Original PR description
Currently error is generated when try to edit 'Invoices' or 'Invoices without Payment' reports in studio mode when there is no record. Steps to reproduce: - Install an 'account' and 'web_studio'…
Currently error is generated when try to edit 'Invoices' or 'Invoices without Payment' reports in studio mode when there is no record.
Steps to reproduce:
- Install an 'account' and 'web_studio' module (Without demo data).
- Navigate to invoicing / Customers / Invoices and open a web studio mode.
- Open reports and click on the 'Invoice' or 'Invoices without Payment' reports.
- Click on 'EDIT SOURCES'.
See Traceback:-
```
TypeError: 'bool' object is not subscriptable
File "<744>", line 200, in template_744
File "<744>", line 13, in template_744_content
QWebException: Error while render the template
TypeError: 'bool' object is not subscriptable
Template: ir.ui.view(744,)
Path: /t/t
Node: <t t-foreach="tax_totals[\'subtotals\']" t-as="subtotal"/>
File "odoo/http.py", line 2251, in __call__
response = request._serve_db()
File "odoo/http.py", line 1827, in _serve_db
return self._transactioning(_serve_ir_http, readonly=ro)
File "odoo/http.py", line 1847, in _transactioning
return service_model.retrying(func, env=self.env)
File "odoo/service/model.py", line 134, in retrying
result = func()
File "odoo/http.py", line 1825, in _serve_ir_http
return self._serve_ir_http(rule, args)
File "odoo/http.py", line 1832, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "odoo/http.py", line 2057, in dispatch
result = self.request.registry['ir.http']._dispatch(endpoint)
File "odoo/addons/base/models/ir_http.py", line 220, in _dispatch
result = endpoint(**request.params)
File "odoo/http.py", line 739, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "home/odoo/src/enterprise/saas-17.2/web_studio/controllers/report.py", line 652, in save_report
report_html = self._render_report(report, record_id)
File "home/odoo/src/enterprise/saas-17.2/web_studio/controllers/report.py", line 597, in _render_report
return request.env['ir.actions.report'].with_context(studio=True)._render_qweb_html(report, [record_id] if record_id else [], {"studio": True})
File "home/odoo/src/enterprise/saas-17.2/web_studio/models/ir_actions_report.py", line 24, in _render_qweb_html
return super(IrActionsReport, self)._render_qweb_html(report_ref, docids, data)
File "odoo/addons/base/models/ir_actions_report.py", line 927, in _render_qweb_html
return self._render_template(report.report_name, data), 'html'
File "odoo/addons/base/models/ir_actions_report.py", line 654, in _render_template
return view_obj._render_template(template, values).encode()
File "home/odoo/src/enterprise/saas-17.2/web_studio/models/ir_ui_view.py", line 1302, in _render_template
return super(View, self)._render_template(template, values)
File "odoo/addons/base/models/ir_ui_view.py", line 2024, in _render_template
return self.env['ir.qweb']._render(template, values)
File "odoo/tools/profiler.py", line 302, in _tracked_method_render
return method_render(self, template, values, **options)
File "odoo/addons/base/models/ir_qweb.py", line 594, in _render
result = ''.join(rendering)
File "<748>", line 42, in template_748
File "<748>", line 31, in template_748_content
File "<747>", line 90, in template_747
File "<747>", line 72, in template_747_content
File "<747>", line 60, in template_747_t_call_0
File "<742>", line 2412, in template_742
File "<742>", line 2394, in template_742_content
File "<742>", line 1650, in template_742_t_call_0
File "<744>", line 208, in template_744
```
The issue occurs when the system tries to access a boolean value which is stored in 'Tax_totals' in the 'document_tax_totals' template [1] and this a boolean value is passed into 'tax_totals' from this line [2] because record is not available.
link [1]: https://github.com/odoo/odoo/blob/a8daed02c58ab69cdea57a8f97065e229b07f0ab/addons/account/views/report_invoice.xml#L200-L201
link [2]: https://github.com/odoo/odoo/blob/a8daed02c58ab69cdea57a8f97065e229b07f0ab/addons/account/models/account_move.py#L1348
To resolve the issue, Add a condition that checks whether the 'Tax_totals' is available before call the 'document_tax_totals' template.
sentry-4499699758
---
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Forward-Port-Of: odoo/odoo#161249