Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0] - [stock_picking_report_valued] - Error in valued delivery report when adding manual lines to stock picking not linked to sale order #305

Open
ignaciord opened this issue Mar 19, 2024 · 1 comment
Labels

Comments

@ignaciord
Copy link

ignaciord commented Mar 19, 2024

Module

stock_picking_report_valued

Describe the bug

When adding any line manually to stock picking (so that line is not linked to the sale order in any way) the valued delivery slip report fails with error "Expected singleton: res.currency() Template: stock.stock_report_delivery_has_serial_move_line".

To Reproduce

16.0

Steps to reproduce the behavior:

  1. Login with admin user in runboat
  2. Create a sale order with 1 line
  3. Go to the stock picking associated with the sale order (truck icon), add a manual line at the end with any quantity in the done field (so that stock move line is not associated with the sale order). Confirm the picking.
  4. Confirm that the customer has the "Valued picking" check in the partner form (for example "Deco Addict").
  5. Go to Print --> Delivery Slip. The following error occurs:

Traceback (most recent call last):
File "/opt/odoo/odoo/models.py", line 5174, in ensure_one
_id, = self._ids
ValueError: not enough values to unpack (expected 1, got 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<769>", line 562, in template_769
File "<769>", line 486, in template_769_content
File "/opt/odoo/odoo/addons/base/models/ir_qweb.py", line 2385, in _get_field
content = converter.record_to_html(record, field_name, field_options)
File "/opt/odoo/odoo/addons/base/models/ir_qweb_fields.py", line 500, in record_to_html
return super(MonetaryConverter, self).record_to_html(record, field_name, options)
File "/opt/odoo/odoo/addons/base/models/ir_qweb_fields.py", line 121, in record_to_html
return False if value is False else self.value_to_html(value, options=options)
File "/opt/odoo/odoo/addons/base/models/ir_qweb_fields.py", line 464, in value_to_html
formatted_amount = lang.format(fmt, display_currency.round(value),
File "/opt/odoo/odoo/addons/base/models/res_currency.py", line 208, in round
self.ensure_one()
File "/opt/odoo/odoo/models.py", line 5177, in ensure_one
raise ValueError("Expected singleton: %s" % self)
ValueError: Expected singleton: res.currency()

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/opt/odoo/addons/web/controllers/report.py", line 113, in report_download
response = self.report_routes(reportname, docids=docids, converter=converter, context=context)
File "/opt/odoo/odoo/http.py", line 697, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "/opt/odoo-venv/lib/python3.10/site-packages/odoo/addons/report_xlsx_helper/controllers/main.py", line 52, in report_routes
return super().report_routes(reportname, docids, converter, **data)
File "/opt/odoo/odoo/http.py", line 697, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "/opt/odoo-venv/lib/python3.10/site-packages/odoo/addons/report_xlsx/controllers/main.py", line 49, in report_routes
return super().report_routes(reportname, docids, converter, **data)
File "/opt/odoo/odoo/http.py", line 697, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "/opt/odoo/addons/web/controllers/report.py", line 42, in report_routes
pdf = report.with_context(context)._render_qweb_pdf(reportname, docids, data=data)[0]
File "/opt/odoo/addons/account/models/ir_actions_report.py", line 61, in _render_qweb_pdf
return super()._render_qweb_pdf(report_ref, res_ids=res_ids, data=data)
File "/opt/odoo/odoo/addons/base/models/ir_actions_report.py", line 858, in _render_qweb_pdf
collected_streams = self._render_qweb_pdf_prepare_streams(report_ref, data, res_ids=res_ids)
File "/opt/odoo/addons/account_edi_ubl_cii/models/ir_actions_report.py", line 58, in _render_qweb_pdf_prepare_streams
collected_streams = super()._render_qweb_pdf_prepare_streams(report_ref, data, res_ids=res_ids)
File "/opt/odoo/addons/account_edi/models/ir_actions_report.py", line 14, in _render_qweb_pdf_prepare_streams
collected_streams = super()._render_qweb_pdf_prepare_streams(report_ref, data, res_ids=res_ids)
File "/opt/odoo/addons/account/models/ir_actions_report.py", line 20, in _render_qweb_pdf_prepare_streams
return super()._render_qweb_pdf_prepare_streams(report_ref, data, res_ids=res_ids)
File "/opt/odoo/odoo/addons/base/models/ir_actions_report.py", line 709, in _render_qweb_pdf_prepare_streams
html = self.with_context(**additional_context)._render_qweb_html(report_ref, res_ids_wo_stream, data=data)[0]
File "/opt/odoo/odoo/addons/base/models/ir_actions_report.py", line 907, in _render_qweb_html
return self._render_template(report.report_name, data), 'html'
File "/opt/odoo/odoo/addons/base/models/ir_actions_report.py", line 624, in _render_template
return view_obj._render_template(template, values).encode()
File "/opt/odoo/odoo/addons/base/models/ir_ui_view.py", line 2127, in _render_template
return self.env['ir.qweb']._render(template, values)
File "/opt/odoo/odoo/tools/profiler.py", line 292, in _tracked_method_render
return method_render(self, template, values, **options)
File "/opt/odoo/odoo/addons/base/models/ir_qweb.py", line 581, in _render
result = ''.join(rendering)
File "<773>", line 65, in template_773
File "<773>", line 52, in template_773_content
File "<768>", line 1849, in template_768
File "<768>", line 1831, in template_768_content
File "<768>", line 1814, in template_768_t_call_0
File "<768>", line 1195, in template_768_t_call_1
File "<769>", line 568, in template_769
odoo.addons.base.models.ir_qweb.QWebException: Error while render the template
ValueError: Expected singleton: res.currency()
Template: stock.stock_report_delivery_has_serial_move_line
Path: /t/t[4]/td[3]/span
Node:

The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
at makeErrorFromResponse (http://oca-stock-logistics-reporting-16-0-469d732a0247.runboat.odoo-community.org/web/assets/459-d43c255/web.assets_backend.min.js:993:163)
at decoder.onload (http://oca-stock-logistics-reporting-16-0-469d732a0247.runboat.odoo-community.org/web/assets/459-d43c255/web.assets_backend.min.js:980:7)

Expected behavior
The delivery slip should be printed without error and the manually added line should have null price (or zero) in the report.

Additional context
Add any other context about the problem here. (e.g. OS, Python version, ...)

@ignaciord ignaciord added the bug label Mar 19, 2024
@ignaciord ignaciord changed the title [stock_picking_report_valued] - Error in valued delivery report when adding manual lines to stock picking [16.0] - [stock_picking_report_valued] - Error in valued delivery report when adding manual lines to stock picking Mar 19, 2024
@ignaciord ignaciord changed the title [16.0] - [stock_picking_report_valued] - Error in valued delivery report when adding manual lines to stock picking [16.0] - [stock_picking_report_valued] - Error in valued delivery report when adding manual lines to stock picking not linked to sale order Mar 19, 2024
javierjcf added a commit to Comunitea/stock-logistics-reporting that referenced this issue Jun 27, 2024
@javierjcf
Copy link

I can confirm the bug. I just opened PR #329 to solve this.

javierjcf added a commit to Comunitea/stock-logistics-reporting that referenced this issue Jun 27, 2024
javierjcf added a commit to Comunitea/stock-logistics-reporting that referenced this issue Jun 27, 2024
javierjcf added a commit to Comunitea/stock-logistics-reporting that referenced this issue Jun 27, 2024
javierjcf added a commit to Comunitea/stock-logistics-reporting that referenced this issue Jun 27, 2024
javierjcf added a commit to Comunitea/stock-logistics-reporting that referenced this issue Jun 27, 2024
javierjcf added a commit to Comunitea/stock-logistics-reporting that referenced this issue Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants