skip to Main Content

I don´t understand why sending quotations is not working.

At the beginning of the error message I get this:

  File "/opt/odoo/odoo-server/odoo/http.py", line 1584, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env

Here the error message:

File "/opt/odoo/odoo-server/odoo/http.py", line 1584, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "/opt/odoo/odoo-server/odoo/service/model.py", line 134, in retrying
    result = func()
  File "/opt/odoo/odoo-server/odoo/http.py", line 1613, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/opt/odoo/odoo-server/odoo/http.py", line 1810, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "/opt/odoo/odoo-server/odoo/addons/base/models/ir_http.py", line 149, in _dispatch
    result = endpoint(**request.params)
  File "/opt/odoo/odoo-server/odoo/http.py", line 699, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/opt/odoo/odoo-server/addons/web/controllers/dataset.py", line 42, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/opt/odoo/odoo-server/addons/web/controllers/dataset.py", line 33, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo/odoo-server/odoo/api.py", line 461, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/opt/odoo/odoo-server/odoo/api.py", line 448, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/opt/odoo/odoo-server/addons/dynamic_odoo/models/models.py", line 36, in onchange
    result = _onchange(self, values, field_name, field_onchange)
  File "/opt/odoo/odoo-server/odoo/models.py", line 6489, in onchange
    record._onchange_eval(name, field_onchange[name], result)
  File "/opt/odoo/odoo-server/odoo/models.py", line 6200, in _onchange_eval
    method_res = method(self)
  File "/opt/odoo/odoo-server/addons/mail/wizard/mail_compose_message.py", line 177, in _onchange_template_id_wrapper
    values = self._onchange_template_id(self.template_id.id, self.composition_mode, self.model, self.res_id)['value']
  File "/opt/odoo/odoo-server/addons/mail/wizard/mail_compose_message.py", line 575, in _onchange_template_id
    values = self.generate_email_for_composer(
  File "/opt/odoo/odoo-server/addons/mail/wizard/mail_compose_message.py", line 705, in generate_email_for_composer
    template_values = self.env['mail.template'].with_context(tpl_partners_only=True).browse(template_id).generate_email(res_ids, fields)
  File "/opt/odoo/odoo-server/addons/account_edi/models/mail_template.py", line 35, in generate_email
    res = super().generate_email(res_ids, fields)
  File "/opt/odoo/odoo-server/addons/mail/models/mail_template.py", line 286, in generate_email
    result, report_format = self.env['ir.actions.report']._render_qweb_pdf(report, [res_id])
  File "/opt/odoo/odoo-server/addons/account/models/ir_actions_report.py", line 54, in _render_qweb_pdf
    return super()._render_qweb_pdf(report_ref, res_ids=res_ids, data=data)
  File "/opt/odoo/odoo-server/odoo/addons/base/models/ir_actions_report.py", line 793, in _render_qweb_pdf
    collected_streams = self._render_qweb_pdf_prepare_streams(report_ref, data, res_ids=res_ids)
  File "/opt/odoo/odoo-server/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/odoo-server/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/odoo-server/addons/account/models/ir_actions_report.py", line 17, in _render_qweb_pdf_prepare_streams
    return super()._render_qweb_pdf_prepare_streams(report_ref, data, res_ids=res_ids)
  File "/opt/odoo/odoo-server/odoo/addons/base/models/ir_actions_report.py", line 694, 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-server/addons/dynamic_odoo/models/ir_actions.py", line 46, in _render_qweb_html
    return super(IrActionsReport, self.with_context(REPORT_ID=self.search([('report_name', '=', report_ref)]).id))._render_qweb_html(report_ref, docids, data=data)
  File "/opt/odoo/odoo-server/odoo/models.py", line 1508, in search
    res = self._search(domain, offset=offset, limit=limit, order=order, count=count)
  File "/opt/odoo/odoo-server/odoo/models.py", line 4618, in _search
    query = self._where_calc(domain)
  File "/opt/odoo/odoo-server/odoo/models.py", line 4386, in _where_calc
    return expression.expression(domain, self).query
  File "/opt/odoo/odoo-server/odoo/osv/expression.py", line 447, in __init__
    self.parse()
  File "/opt/odoo/odoo-server/odoo/osv/expression.py", line 1024, in parse
    expr, params = self.__leaf_to_sql(leaf, model, alias)
  File "/opt/odoo/odoo-server/odoo/osv/expression.py", line 1044, in __leaf_to_sql
    assert not isinstance(right, BaseModel), 
AssertionError: Invalid value ir.actions.report(352,) in domain term ('report_name', '=', ir.actions.report(352,))

The same is happening when sending invoices etc. Otherwise our Odoo is working fine. The odoo system email is working too. Server: Ubuntu 22.04.2.

2

Answers


  1. This error is due to wrong domain definition.

    AssertionError: Invalid value ir.actions.report(352,) in domain term ('report_name', '=', ir.actions.report(352,))
    

    The correct way of defining domain is

    domain = [('report_name', '=', report.name)] 
    

    whereas you might have set domain as

    domain = [('report_name', '=', report)] 
    
    Login or Signup to reply.
  2. The dynamic_odoo module overrides the _render_qweb_html to update the context and pass an instance of ir.actions.report to the search function which is not possible.

    You need to use the same field name report_ref.report_name and because the function could be called using a report_name (External id) or an ID (integer) the function will raise an error, so you need to get the report id depending on the report_ref value, Odoo already has a function to do that and it is called _get_report.

    Use _get_report function to get the report record then update the context

    Example:

    @api.model
    def _render_qweb_html(self, report_ref, docids, data=None):
        report = self._get_report(report_ref)
        return super(IrActionsReport, self.with_context(REPORT_ID=report.id))._render_qweb_html(report_ref, docids, data=data) 
            
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search