Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
1683 Lượt xem

Hi,

could you please help us?

We just try to create a sales report via: Reporting > Sales Details

But fails with the following error message.

BR + Thank you

Stefan



Traceback (most recent call last):
  File "", line 4968, in template_1072
  File "", line 4950, in template_1072_content
  File "", line 4929, in template_1072_t_call_0
  File "", line 3751, in template_1072_t_call_1
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_qweb.py", line 2456, in _get_widget
    content = converter.value_to_html(value, field_options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_qweb_fields.py", line 189, in value_to_html
    value = float_utils.float_round(value, precision_digits=precision)
  File "/usr/lib/python3/dist-packages/odoo/tools/float_utils.py", line 75, in float_round
    normalized_value = value / rounding_factor # normalize
TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'

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

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/report.py", line 120, in report_download
    response = self.report_routes(reportname, converter=converter, context=context, **data)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 741, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/usr/lib/python3/dist-packages/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 "/usr/lib/python3/dist-packages/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 "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 899, in _render_qweb_pdf
    collected_streams = self._render_qweb_pdf_prepare_streams(report_ref, data, res_ids=res_ids)
  File "/usr/lib/python3/dist-packages/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 "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 749, in _render_qweb_pdf_prepare_streams
    html = self.with_context(**additional_context)._render_qweb_html(report_ref, all_res_ids_wo_stream, data=data)[0]
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 949, in _render_qweb_html
    return self._render_template(report.report_name, data), 'html'
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 669, in _render_template
    return view_obj._render_template(template, values).encode()
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 2051, in _render_template
    return self.env['ir.qweb']._render(template, values)
  File "/usr/lib/python3/dist-packages/odoo/tools/profiler.py", line 292, in _tracked_method_render
    return method_render(self, template, values, **options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_qweb.py", line 599, in _render
    result = ''.join(rendering)
  File "", line 4974, in template_1072
odoo.addons.base.models.ir_qweb.QWebException: Error while render the template
TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'
Template: point_of_sale.report_saledetails
Path: /t/t[2]/t/t[2]/table[1]/tbody/tr[2]/td[2]/span[1]/span[1]
Node: 

The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
    RPC_ERROR
        at makeErrorFromResponse (http://192.168.16.99:8069/web/assets/8e0d905/web.assets_web.min.js:2886:163)
        at decoder.onload (http://192.168.16.99:8069/web/assets/8e0d905/web.assets_web.min.js:2872:7)





Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Hi,

thank you for your reply.
This is no "custom" report. It is the standard sales report.
Could this happen, if we add a product like banana and our sales price is 0€?

Otherwise I can not explain it to me, as there is and there was no modification from our side.

Especially not for report_saledetails.


BR
schtebo

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

The error is related to a TypeError occurring when trying to perform a division operation. One of the operands is None (NoneType, not NullType) and the other is a float. This typically happens when a field expected to contain a numeric value is empty or null. To address this, make sure fields in your sales orders have proper numeric values. The error points to the template 'point_of_sale.report_saledetails'. Review this template, particularly the section mentioned in the error:

/t/t[2]/t/t[2]/table[1]/tbody/tr[2]/td[2]/span[1]/span[1]

You could use a default value or a conditional statement to avoid the division by zero error.


Hope it helps

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 7 25
1123
2
thg 8 20
7473
1
thg 1 20
4988
0
thg 4 17
2775
0
thg 1 17
4339