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][FIX] add is_company_detail_empty boolean computed field on res.brand #195

Open
wants to merge 3 commits into
base: 16.0
Choose a base branch
from

Conversation

RemiFr82
Copy link

@RemiFr82 RemiFr82 commented Apr 2, 2024

The field works like on res.company model and prevents the following error (encountered on branded sale.order PDF report print) :

Traceback (most recent call last):
File "<198>", line 304, in template_198
File "<198>", line 76, in template_198_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 "/opt/odoo/auto/addons/web/controllers/report.py", line 113, in report_download
response = self.report_routes(reportname, docids=docids, converter=converter, context=context)
File "/opt/odoo/custom/src/odoo/odoo/http.py", line 697, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "/opt/odoo/auto/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/auto/addons/account/models/ir_actions_report.py", line 58, in _render_qweb_pdf
return super()._render_qweb_pdf(report_ref, res_ids=res_ids, data=data)
File "/opt/odoo/custom/src/odoo/odoo/addons/base/models/ir_actions_report.py", line 819, in _render_qweb_pdf
collected_streams = self._render_qweb_pdf_prepare_streams(report_ref, data, res_ids=res_ids)
File "/opt/odoo/auto/addons/account_invoice_facturx/models/ir_actions_report.py", line 17, in _render_qweb_pdf_prepare_streams
collected_streams = super()._render_qweb_pdf_prepare_streams(
File "/opt/odoo/auto/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/auto/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/auto/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/custom/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 "/opt/odoo/auto/addons-dev/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 "/opt/odoo/custom/src/odoo/odoo/addons/base/models/ir_actions_report.py", line 896, in _render_qweb_html
return self._render_template(report.report_name, data), 'html'
File "/opt/odoo/custom/src/odoo/odoo/addons/base/models/ir_actions_report.py", line 623, in _render_template
return view_obj._render_template(template, values).encode()
File "/opt/odoo/auto/addons/website/models/ir_ui_view.py", line 420, in _render_template
return super()._render_template(template, values=values)
File "/opt/odoo/custom/src/odoo/odoo/addons/base/models/ir_ui_view.py", line 2125, in _render_template
return self.env['ir.qweb']._render(template, values)
File "/opt/odoo/custom/src/odoo/odoo/tools/profiler.py", line 292, in _tracked_method_render
return method_render(self, template, values, **options)
File "/opt/odoo/custom/src/odoo/odoo/addons/base/models/ir_qweb.py", line 581, in _render
result = ''.join(rendering)
File "<1107>", line 80, in template_1107
File "<1107>", line 62, in template_1107_content
File "<1107>", line 50, in template_1107_t_call_0
File "<1106>", line 1662, in template_1106
File "<1106>", line 1651, in template_1106_content
File "<202>", line 150, in template_202
File "<202>", line 106, in template_202_content
File "<198>", line 310, in template_198
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_striped
Path: /t/div[1]/div/div[2]/ul/li[1]
Node:

  • This field is used in report layout templates web/views/report_templates.xml at lines 303, 349, 392, 415 and 446. Native company is replaced by the record brand_id in brand_external_report_layout/views/report_template.xml at line 19.

  • The field works like on res.company model
    @OCA-git-bot
    Copy link
    Contributor

    Hi @sbejaoui,
    some modules you are maintaining are being modified, check this out!

    @RemiFr82
    Copy link
    Author

    RemiFr82 commented Apr 4, 2024

    Hi @sbejaoui, I dont understand how I can manage to solve the 2 codecov issues to make this PR mergeable.
    Could you guide me to the remaining things to do ? (or show me where I can read the docs)
    Thanks !

    Copy link

    github-actions bot commented Aug 4, 2024

    There hasn't been any activity on this pull request in the past 4 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 PR to never become stale, please ask a PSC member to apply the "no stale" label.

    @github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Aug 4, 2024
    @RemiFr82 RemiFr82 changed the title [ADD] is_company_detail_empty Boolean on res.brand [16.0][FIX] add is_company_detail_empty boolean computed field on res.brand Aug 5, 2024
    @RemiFr82
    Copy link
    Author

    RemiFr82 commented Aug 5, 2024

    Hi @Ivorra78 @ibuioli, as @sbejaoui seems not to be active at this time, do you have the write access on this repository to merge this PR I made 4 months ago ?
    This PR solves an issue on branded report PDF print (from sales and invoices) because of a missing field on res.brand that was recently added on res.company. I copied the computing code from res.company and successfully tested it on my local odoo 16.0 CE.
    Thanks for your help !

    @github-actions github-actions bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Aug 11, 2024
    Copy link

    @CasVissers-360ERP CasVissers-360ERP left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Functional review

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    4 participants