OCA / brand

Manage brands for products and companies

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[16.0][BUG][brand_external_report_layout] is_company_details_empty missing

Bart-dh opened this issue · comments

Module

brand_external_layout

Describe the bug

Error when printing a PDF report with external layout (e.g. invoice pdf). Odoo added a field to res.company which is used in the external report XML, but the field doesn't exist yet on res.brand.
odoo/odoo@5db133d

To Reproduce

16.0
possible other versions if this field is backported

Steps to reproduce the behavior:

  1. Print any external report

Error log
RPC_ERROR

Odoo Server Error

Traceback (most recent call last):

  File "<199>", line 302, in template_199

  File "<199>", line 75, in template_199_content

AttributeError: 'res.brand' object has no attribute 'is_company_details_empty'

 

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

 

Traceback (most recent call last):

  File "/home/odoo/src/odoo/addons/web/controllers/report.py", line 113, in report_download

    response = self.report_routes(reportname, docids=docids, converter=converter, context=context)

  File "/home/odoo/src/odoo/odoo/http.py", line 697, in route_wrapper

    result = endpoint(self, *args, **params_ok)

  File "/home/odoo/src/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 "/home/odoo/src/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 "/home/odoo/src/odoo/odoo/addons/base/models/ir_actions_report.py", line 807, in _render_qweb_pdf

    collected_streams = self._render_qweb_pdf_prepare_streams(report_ref, data, res_ids=res_ids)

  File "/home/odoo/src/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 "/home/odoo/src/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 "/home/odoo/src/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 "/home/odoo/src/odoo/odoo/addons/base/models/ir_actions_report.py", line 708, 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 "/home/odoo/src/enterprise/web_studio/models/ir_actions_report.py", line 19, in _render_qweb_html

    return super(IrActionsReport, self)._render_qweb_html(report_ref, docids, data)

  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_actions_report.py", line 884, in _render_qweb_html

    return self._render_template(report.report_name, data), 'html'

  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_actions_report.py", line 623, in _render_template

    return view_obj._render_template(template, values).encode()

  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_ui_view.py", line 2128, in _render_template

    return self.env['ir.qweb']._render(template, values)

  File "/home/odoo/src/odoo/odoo/tools/profiler.py", line 292, in _tracked_method_render

    return method_render(self, template, values, **options)

  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_qweb.py", line 580, in _render

    result = ''.join(rendering)

  File "<694>", line 90, in template_694

  File "<694>", line 72, in template_694_content

  File "<694>", line 60, in template_694_t_call_0

  File "<690>", line 2108, in template_690

  File "<690>", line 2097, in template_690_content

  File "<202>", line 150, in template_202

  File "<202>", line 106, in template_202_content

  File "<199>", line 308, in template_199

odoo.addons.base.models.ir_qweb.QWebException: Error while render the template

AttributeError: 'res.brand' object has no attribute 'is_company_details_empty'

Template: web.external_layout_boxed

Path: /t/div[1]/div/div/div[2]/div[2]/ul/li[1]

Node:

  • I can confirm we are getting the same error.

    @Bart-dh As a temporary fix you can edit brand/models/res_brand.py and add a stub is_company_details_empty = False, naturally ensure that your company details are actually not empty.

    I.e.

    class ResBrand(models.Model):
        _name = "res.brand"
        _description = "Brand"
    
        is_company_details_empty = False
    

    This is not a fix, just a hammering to make it work.

    There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
    If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

    Just to point out explicitely that this is not fixed even if it has been auto-closed and the pull request is still pending. Can at least this be re-opened. It is still actual.

    We are getting the same error in amulticompany environment.

      odoo.addons.base.models.ir_qweb.QWebException: Error while render the template
      AttributeError: 'res.brand' object has no attribute 'is_company_details_empty'
      Template: web.external_layout_standard
      Path: /t/div[1]/div[3]/div/ul/li[1]
      Node: <li t-if="company.is_company_details_empty"/>
    

    It is not fixed. So sad...

    It would be great fixing this issue