Skip to content

[16.0][ADD] purchase_order_report_hide_tax: New module#91

Merged
OCA-git-bot merged 1 commit intoOCA:16.0from
moduon:add-purchase_order_report_hide_tax
Dec 9, 2025
Merged

[16.0][ADD] purchase_order_report_hide_tax: New module#91
OCA-git-bot merged 1 commit intoOCA:16.0from
moduon:add-purchase_order_report_hide_tax

Conversation

@chienandalu
Copy link
Copy Markdown
Member

cc @moduon MT-11623

@rafaelbn rafaelbn added this to the 16.0 milestone Nov 5, 2025
Copy link
Copy Markdown

@Gelojr Gelojr left a comment

Choose a reason for hiding this comment

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

Nice job @chienandalu but when testing with purchase order lines containing taxes from different groups (for example 21% VAT and 10% VAT), the report Request for quotation does not display the tax column, even though it should appear in this case.
Additionally, attempting to print the purchase order using “Print → Purchase Order” raises a traceback instead of generating the PDF.

Traceback (most recent call last):
  File "<777>", line 1011, in template_777
  File "<777>", line 993, in template_777_content
  File "<777>", line 482, in template_777_t_call_0
KeyError: 'doc'

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

Traceback (most recent call last):
  File "/opt/odoo/addons/web/controllers/report.py", line 113, in report_download
    response = self.report_routes(reportname, docids=docids, converter=converter, context=context)
  File "/opt/odoo/odoo/http.py", line 763, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/opt/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 "/opt/odoo/addons/account/models/ir_actions_report.py", line 66, in _render_qweb_pdf
    return super()._render_qweb_pdf(report_ref, res_ids=res_ids, data=data)
  File "/opt/odoo/odoo/addons/base/models/ir_actions_report.py", line 910, in _render_qweb_pdf
    collected_streams = self._render_qweb_pdf_prepare_streams(report_ref, data, res_ids=res_ids)
  File "/opt/odoo/addons/account_edi_ubl_cii/models/ir_actions_report.py", line 65, in _render_qweb_pdf_prepare_streams
    collected_streams = super()._render_qweb_pdf_prepare_streams(report_ref, data, res_ids=res_ids)
  File "/opt/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 "/opt/odoo/addons/account/models/ir_actions_report.py", line 25, in _render_qweb_pdf_prepare_streams
    return super()._render_qweb_pdf_prepare_streams(report_ref, data, res_ids=res_ids)
  File "/opt/odoo/odoo/addons/base/models/ir_actions_report.py", line 761, 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 "/opt/odoo/odoo/addons/base/models/ir_actions_report.py", line 985, in _render_qweb_html
    return self._render_template(report.report_name, data), 'html'
  File "/opt/odoo/odoo/addons/base/models/ir_actions_report.py", line 664, in _render_template
    return view_obj._render_template(template, values).encode()
  File "/opt/odoo/odoo/addons/base/models/ir_ui_view.py", line 2135, in _render_template
    return self.env['ir.qweb']._render(template, values)
  File "/opt/odoo/odoo/tools/profiler.py", line 301, in _tracked_method_render
    return method_render(self, template, values, **options)
  File "/opt/odoo/odoo/addons/base/models/ir_qweb.py", line 593, in _render
    result = ''.join(rendering)
  File "<778>", line 80, in template_778
  File "<778>", line 62, in template_778_content
  File "<778>", line 50, in template_778_t_call_0
  File "<777>", line 1017, in template_777
odoo.addons.base.models.ir_qweb.QWebException: Error while render the template
KeyError: 'doc'
Template: purchase.report_purchaseorder_document
Path: /t/t/div/table/thead/tr/th[2]
Node: <th name="th_taxes" t-if="doc.show_tax_column_in_report"/>

The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
    RPC_ERROR
        at makeErrorFromResponse (http://oca-purchase-reporting-16-0-pr91-c72837ba5f3c.runboat.odoo-community.org/web/assets/427-a95bc99/web.assets_backend.min.js:1003:163)
        at decoder.onload (http://oca-purchase-reporting-16-0-pr91-c72837ba5f3c.runboat.odoo-community.org/web/assets/427-a95bc99/web.assets_backend.min.js:990:7)

@chienandalu chienandalu force-pushed the add-purchase_order_report_hide_tax branch from c72837b to 126c5b1 Compare November 6, 2025 08:46
@chienandalu
Copy link
Copy Markdown
Member Author

@Gelojr Try it again please. Please note that the RfQ report doesn't show either taxes or prices at all. Only the purchase order document does.

Copy link
Copy Markdown

@Gelojr Gelojr left a comment

Choose a reason for hiding this comment

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

Great work @chienandalu !
The following tests have been successfully performed:

  • Test 1: Verified that when all purchase order lines share the same tax group, the tax column is correctly hidden in the report.
  • Test 3: Confirmed that section and note lines do not interfere with the visibility logic of the tax column.
  • Test 4: Verified that different taxes within the same tax group (e.g., 21% goods and 21% services) still hide the tax column as expected.
  • An additional check was made: printing the purchase order using “Print → Purchase Order” raises a traceback instead of generating the PDF.

Copy link
Copy Markdown

@EmilioPascual EmilioPascual left a comment

Choose a reason for hiding this comment

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

LGTM! Code review.

@rafaelbn
Copy link
Copy Markdown
Member

rafaelbn commented Dec 9, 2025

/ocabot rebase

@OCA-git-bot
Copy link
Copy Markdown
Contributor

@rafaelbn The rebase process failed, because command git push --force moduon tmp-pr-91:add-purchase_order_report_hide_tax failed with output:

remote: Permission to moduon/purchase-reporting.git denied to OCA-git-bot.
fatal: unable to access 'https://github.com/moduon/purchase-reporting/': The requested URL returned error: 403

Copy link
Copy Markdown
Member

@rafaelbn rafaelbn left a comment

Choose a reason for hiding this comment

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

Tested in prod 👍🏼

🆗

@rafaelbn
Copy link
Copy Markdown
Member

rafaelbn commented Dec 9, 2025

/ocabot merge patch

@OCA-git-bot
Copy link
Copy Markdown
Contributor

On my way to merge this fine PR!
Prepared branch 16.0-ocabot-merge-pr-91-by-rafaelbn-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 18a71f6 into OCA:16.0 Dec 9, 2025
5 of 7 checks passed
@OCA-git-bot
Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at 5163191. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants