Skip to content

[16.0][ADD] brupower_custom_account_move_report#150

Open
mihien wants to merge 2 commits into16.0from
16.0-add-brupower_custom_account_move_report
Open

[16.0][ADD] brupower_custom_account_move_report#150
mihien wants to merge 2 commits into16.0from
16.0-add-brupower_custom_account_move_report

Conversation

@mihien
Copy link
Copy Markdown
Member

@mihien mihien commented Feb 5, 2026

Description

Add a text field representing an svg to account.move. Include this svg at the end of the report of account.move.

Odoo task (if applicable)

15244

Checklist before approval

  • Tests are present (or not needed).
  • Credits/copyright have been changed correctly.
  • Change log snippet is present.
  • (If a new module) Moving this to OCA has been considered.

@mihien mihien force-pushed the 16.0-add-brupower_custom_account_move_report branch from 5c6ece6 to 1b57f7c Compare February 5, 2026 11:27
@mihien mihien force-pushed the 16.0-add-brupower_custom_account_move_report branch from 1b57f7c to 00079bf Compare February 10, 2026 08:51
class AccountMove(models.Model):
_inherit = "account.move"

consumption_graph_svg = fields.Text()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

storing the contents of a file in a database field is only useful in some rare cases (when the contents must be searched, for example), or for performance reasons. this is not the case here. it should use a Binary field, which will store the contents as an attachment. moreover, ideally, the svg could be gzipped in that case, taking less disk space.

_inherit = "account.move"

consumption_graph_svg = fields.Text()
show_svg_field = fields.Boolean(string="Show SVG Code Field", default=False)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the name of this field is too generic. something like display_consumption_graph would be better (same remark for the name of the action below). the fact that it is an svg is not meaningful. what if they want to add another svg later on?

i don’t really understand the point of this field: it seems to be something ui-related and should not be stored in the database: should some invoices display the code and others not, and this should be remembered? i think it would be better to have a button displaying the contents, for example in a wizard, possibly also displaying the image as an image.

<template id="report_invoice_document" inherit_id="account.report_invoice_document">
<xpath expr="//div[@id='qrcode']" position="after">
<div id="consumption_graph_svg" t-if="o.consumption_graph_svg">
<t t-raw="o.consumption_graph_svg" />
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i think it would be better (and safer) to use an img element pointing to the svg file.

@huguesdk
Copy link
Copy Markdown
Member

huguesdk commented Apr 29, 2026

actually, why not use an invoice attachment (with a specific name) directly? if brupower needs to set is as a text field, it could be a non-stored non-readonly computed field, reading and writing from the attachment.

* use a Binary field to store the svg file as an attachment.
* use an <img> element in the account.move report instead of using the
  raw svg contents.
* simplify the form view by using the Binary field directly.
@github-grap-bot github-grap-bot added series:16.0 mod:brupower_custom_account_move_report Module brupower_custom_account_move_report labels May 5, 2026
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.

3 participants