Repository navigation
[20.0][MIG] report_qweb_pdf_watermark: Migration to 20.0 - #1207
BhaveshHeliconia wants to merge 35 commits into
Conversation
|
/ocabot migration report_qweb_pdf_watermark |
3e1f73d to
2e1eb11
Compare
|
Can you have a look at the tests? |
2e1eb11 to
385b012
Compare
|
The following commit authors need to sign the Contributor License Agreement: |
The tests are green now. Thanks! |
StefanRijnhart
left a comment
There was a problem hiding this comment.
Oh, when you did the migration, the 19.0 migration was not merged yet but it is now. Can you rebuild the branch on current 19.0?
| > | ||
| Note that the watermark is not reflected in the preview to the right. | ||
| Print a report to see the watermark in the generated PDF. | ||
| </div> |
There was a problem hiding this comment.
Another remark here would improve usability: the company background needs to be enabled per report before showing up at all.
| name="pdf_watermark_setting" | ||
| string="PDF Watermark" | ||
| help="Use the company watermark or a specific one for this report" | ||
| invisible="report_type != 'qweb-pdf'" |
There was a problem hiding this comment.
You migrated the functionality to work with papermuncher reports, which is great! However, these have qweb-pdf-paper-muncher here so please adapt the condition to show the settings on those as well.
There was a problem hiding this comment.
Oh, and upon retesting I can't get papermuncher to work on runbot so I'm wondering if I did it right the first time. Did you have any luck using papermuncher? Would be nice to round up support for it here.
File "/mnt/data/odoo-addons-dir/report_qweb_pdf_watermark/models/report.py", line 180, in _render_qweb_pdf_prepare_streams
collected_streams = super()._render_qweb_pdf_prepare_streams(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/odoo/odoo/addons/base/models/ir_actions_report.py", line 536, in _render_qweb_pdf_prepare_streams
pdf_content, html_ids = self._run_pdf_engine(engine_name, html, report_ref=report_ref, landscape=self.env.context.get('landscape'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/odoo/addons/base_report_paper_muncher/models/ir_actions_report.py", line 179, in _run_pdf_engine
content = self._run_paper_muncher(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/odoo/addons/base_report_paper_muncher/models/ir_actions_report.py", line 138, in _run_paper_muncher
return server.serve(bodies, header, footer) # TODO: ir.config_parameter
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/odoo/addons/base_report_paper_muncher/paper_muncher.py", line 137, in serve
self._process_data()
File "/opt/odoo/addons/base_report_paper_muncher/paper_muncher.py", line 162, in _process_data
self._process_request()
File "/opt/odoo/addons/base_report_paper_muncher/paper_muncher.py", line 179, in _process_request
response, bytes_sent = self._handle_get((
^^^^^^^^^^^^^^^^^^
File "/opt/odoo/addons/base_report_paper_muncher/paper_muncher.py", line 210, in _handle_get
self._send(h11.Data(data=content))
File "/opt/odoo/addons/base_report_paper_muncher/paper_muncher.py", line 342, in _send
bytes_written += os.write(self._process.stdin.fileno(), memview[bytes_written:])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
BrokenPipeError: [Errno 32] Broken pipe
upon processing Request(method=b'GET', headers=<Headers([(b'user-agent', b'Mozilla/5.0 Paper-Muncher/v0.7.1'), (b'host', b'')])>, target=b'/paper-muncher/0.html', http_version=b'1.1')
When no background configuration is present on the report definition, don't try to browse the report model especially because this breaks some upstream reports (see odoo/odoo#23389)
external_dependencies
[MIG] report_qweb_pdf_watermark: Migration to 15.0
When printing a document in a multi-company environment, the company watermark was selected based on self.env.company (the company currently active in the UI switcher) rather than the company of the document being printed. This caused the wrong watermark to appear when a user switched to company B and printed an invoice belonging to company A (or vice versa), as reported in OCA#1134. Fix by introducing a _get_watermark_company() helper that returns the document's company_id when available, falling back to self.env.company otherwise.
The module only tried to import PyPDF2, so on hosts that ship pypdf (Odoo 19 on Python >= 3.13) PdfReader/PdfWriter stayed undefined and rendering a watermarked report crashed with a NameError. Import the PDF classes from odoo.tools.pdf instead, which picks PyPDF2 2.x, pypdf or PyPDF2 1.x and keeps the legacy method names used here. Drop the obsolete INSTALL instructions to pip install PyPDF2. Addresses OCA#1091 (review) Co-authored-by: DjodyKort <90830682+DjodyKort@users.noreply.github.com>
…pany Resolve the watermark company like core does: use the documents' company_id, then company_ids, and fall back to the environment company. Documents of models that only have company_ids now get their own company's watermark, and the first document that carries a company is used rather than only the first document. Add tests for the company resolution.
Currently translated at 20.0% (2 of 10 strings) Translation: reporting-engine-19.0/reporting-engine-19.0-report_qweb_pdf_watermark Translate-URL: https://translation.odoo-community.org/projects/reporting-engine-19-0/reporting-engine-19-0-report_qweb_pdf_watermark/pl/
385b012 to
f25a641
Compare
|
@StefanRijnhart Thanks for the review! I've rerun the migration process from 19.0 to 20.0 and addressed your comments. |

No description provided.