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] brand_external_report_layout : can't be used in multi-company context and conflicts with other modules #179

Open
metaminux opened this issue Oct 31, 2023 · 8 comments
Labels

Comments

@metaminux
Copy link

Module

brand_external_report_layout

Describe the bug

  • the model brand.document.layout is defining company_details (and should define is_company_details_empty also, as declared in [16.0][BUG][brand_external_report_layout] is_company_details_empty missing #167 ) so it's not possible to use the same brand for different companies
  • the company Qweb variable is replaced by a res.brand object in reports, so every module inheriting company to add information in reports is conflicting (for example, l10n_ca from Odoo with account_fiscal_country_id and l10n_ca_pst fields)

To Reproduce

16.0:

Steps to reproduce the behavior:

  1. Create a new database with brand_external_report_layout installed and demo data
  2. Go to settings and set a specific document layout for first company (this should set the company details by default)
  3. Set the company with Brand use level = optional
  4. Switch company and do the same for the second company, with another layout
  5. Create a brand and set its document layout (for the moment, [16.0][BUG][brand_external_report_layout] is_company_details_empty missing #167 is preventing to go further...)
  6. From now on, every sale, invoice, etc. that will use this brand will have the same address (company/brand details) for both companies

Expected behavior
I think only "style" fields should be overridden by brands.

Additional context
I'll propose a PR that keeps the original company object and temporarily modify it with data from brand then go back to original after the report is generated.

@metaminux metaminux added the bug label Oct 31, 2023
metaminux added a commit to meta-it/brand that referenced this issue Oct 31, 2023
…s and just temporarily use brand data

  - do not use company details and footer from brand, so that it could be used in multi-company
  - this avoid conflicts with other modules overriding company to add information in reports
Fixes OCA#167
Fixes OCA#179
metaminux added a commit to meta-it/brand that referenced this issue Oct 31, 2023
…s and just temporarily use brand data - do not use company details and footer from brand, so that it could be used in multi-company - this avoid conflicts with other modules overriding company to add information in reports Fixes OCA#167 Fixes OCA#179
metaminux added a commit to meta-it/brand that referenced this issue Nov 1, 2023
…s and just temporarily use brand data - do not use company details and footer from brand, so that it could be used in multi-company - this avoid conflicts with other modules overriding company to add information in reports Fixes OCA#167 Fixes OCA#179
@diniciacci
Copy link

diniciacci commented Mar 5, 2024

There is an extra consequence of this. It is impossible to generate invoices for printing in "batch" (i.e. invoicing->customers->invoices; select a bunch of invoices; print->invoices) this triggers and error for users that are not part of group Administration/Settings because of the missing access to the resources:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/report.py", line 113, in report_download
response = self.report_routes(reportname, docids=docids, converter=converter, context=context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/http.py", line 697, 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 58, 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 807, 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_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 "/usr/lib/python3/dist-packages/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 "/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 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 "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 884, 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 623, 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 2128, 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 580, in _render
result = ''.join(rendering)
^^^^^^^^^^^^^^^^^^
File "<662>", line 90, in template_662
File "<662>", line 72, in template_662_content
File "<662>", line 60, in template_662_t_call_0
File "<658>", line 2091, in template_658
File "<658>", line 2080, in template_658_content
File "<203>", line 156, in template_203
odoo.addons.base.models.ir_qweb.QWebException: Error while render the template
AccessError: You are not allowed to access 'View' (ir.ui.view) records.

This operation is allowed for the following groups:
- Administration/Settings

Contact your administrator to request access if necessary.
Template: web.external_layout
Path: /t/t[7]
Node: <t t-if="o and \'brand_id\' in o.fields_get() and o.brand_id and o.brand_id.external_report_layout_id" t-call="{{o.brand_id.external_report_layout_id.key}}"/>

The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
at makeErrorFromResponse (https://erp.semmel.it/web/assets/565-d105eb6/web.assets_backend.min.js:985:163)
at decoder.onload (https://erp.semmel.it/web/assets/565-d105eb6/web.assets_backend.min.js:973:7)

Any chance the associated pull requests gets any attention?

Copy link

github-actions bot commented Sep 1, 2024

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.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Sep 1, 2024
@diniciacci
Copy link

Closing bugs like this is not appropriate. Please disable the bot or increase the timeout, it already closed other valid bugs.

There is no activity on this because it is awaiting an aswer from the maintaner, not because the reporter didn't do his part.

The pull request is there. Keep open and merge that instead.

@metaminux
Copy link
Author

@diniciacci is right, bug is still there...

Original PR #180 as been superseded by #201 but we're still waiting for a merge...
@sbejaoui ?

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

This module has never been tested properly!
In the manifest file you find
"assets": {
"web.report_assets_common": [
"/brand_external_report_layout/"
"static/src/legacy/scss/asset_styles_brand_report.scss"
]
But in static/ there is only a discription where is the scss file???

@sbejaoui Can you please do the necessary?

@metaminux
Copy link
Author

@OCA/brand-maintainers We need some feedback from maintainers here... please.

@sbejaoui
Copy link
Contributor

sbejaoui commented Oct 2, 2024

Hi,
I will check this and get back to you

@javidiez92
Copy link

javidiez92 commented Nov 29, 2024

Any progress on this issue?

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 a pull request may close this issue.

5 participants