Skip to content

[19.0][MIG] account_invoice_margin: Migration to 19.0#254

Open
Debora7 wants to merge 64 commits intoOCA:19.0from
dakai-soft:19.0-mig-account-invoice-margin
Open

[19.0][MIG] account_invoice_margin: Migration to 19.0#254
Debora7 wants to merge 64 commits intoOCA:19.0from
dakai-soft:19.0-mig-account-invoice-margin

Conversation

@Debora7
Copy link
Copy Markdown

@Debora7 Debora7 commented Jan 8, 2026

No description provided.

sergio-teruel and others added 30 commits January 8, 2026 09:33
[UPD] README.rst

[UPD] Update account_invoice_margin.pot

Translated using Weblate (Spanish)

Currently translated at 100.0% (7 of 7 strings)

Translation: margin-analysis-11.0/margin-analysis-11.0-account_invoice_margin
Translate-URL: https://translation.odoo-community.org/projects/margin-analysis-11-0/margin-analysis-11-0-account_invoice_margin/es/
[FIX] account_invoice_margin: Set purchase_price when user has not set invoice margin security group set
[REF] rename file with the name of the model
[ADD] margins on account.invoice model (and related views)
[ADD] description and screenshot
[FIX] Typo on margin (%) field name
[ADD] fr translation
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: margin-analysis-12.0/margin-analysis-12.0-account_invoice_margin
Translate-URL: https://translation.odoo-community.org/projects/margin-analysis-12-0/margin-analysis-12-0-account_invoice_margin/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: margin-analysis-13.0/margin-analysis-13.0-account_invoice_margin
Translate-URL: https://translation.odoo-community.org/projects/margin-analysis-13-0/margin-analysis-13-0-account_invoice_margin/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: margin-analysis-13.0/margin-analysis-13.0-account_invoice_margin
Translate-URL: https://translation.odoo-community.org/projects/margin-analysis-13-0/margin-analysis-13-0-account_invoice_margin/
Currently translated at 100.0% (9 of 9 strings)

Translation: margin-analysis-13.0/margin-analysis-13.0-account_invoice_margin
Translate-URL: https://translation.odoo-community.org/projects/margin-analysis-13-0/margin-analysis-13-0-account_invoice_margin/es/
@Reyes4711-S73
Copy link
Copy Markdown
Contributor

@Debora7 Please, solve pre-commit issues

Comment on lines +49 to +53
invoice.margin = margin
invoice.margin_signed = margin_signed
invoice.margin_percent = (
price_subtotal and margin_signed / price_subtotal * 100 or 0.0
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
invoice.margin = margin
invoice.margin_signed = margin_signed
invoice.margin_percent = (
price_subtotal and margin_signed / price_subtotal * 100 or 0.0
)
invoice.update(
{
"margin": margin,
"margin_signed": margin_signed,
"margin_percent": (
price_subtotal and margin_signed / price_subtotal * 100 if price_subtotal
else 0.0
)
}
)

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.

Why is using as update() better?
It there a commendation to use that for computed field ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@dreispt With this way you make only one query in DB.

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.

Field writes are in memory, they don't trigger a DB query on their own.
And I'm not sure update is a public API; AFAICT it is not documented as such.

@Reyes4711-S73
Copy link
Copy Markdown
Contributor

ping @Debora7

@Yusuke1998
Copy link
Copy Markdown

ping @Debora7

ping @Debora7

@Reyes4711-S73
Copy link
Copy Markdown
Contributor

@Debora7 Please, do the changes I recommeded you.
In addition, please squash pre-commit issues commit with the migration commit

Copy link
Copy Markdown
Member

@dreispt dreispt left a comment

Choose a reason for hiding this comment

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

LGTM but please squash the extra fixes commit

Comment thread account_invoice_margin/tests/test_account_invoice_margin.py Outdated
@Reyes4711-S73
Copy link
Copy Markdown
Contributor

ping @Debora7

@Debora7 Debora7 force-pushed the 19.0-mig-account-invoice-margin branch from f2ba90b to 106a470 Compare February 16, 2026 09:21
Fixed pre-commit issues.
Comment thread .pylintrc
Copy link
Copy Markdown

@dannyadair dannyadair left a comment

Choose a reason for hiding this comment

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

Please don't remove checks from .pylintrc
It is repo-wide. If checks fail you need to fix the code not remove the test.

If .pylintrc needs to be adjusted it should be in a separate PR, not a module migration.

@alexeirivera87
Copy link
Copy Markdown

Hello @Debora7

There is an error coming from this:

<record id="group_account_invoice_margin_security" model="res.groups"> <field name="name">Show Invoice Margin</field> <field name="privilege_id" ref="base.module_category_hidden" /> <field name="user_ids" eval="[(4, ref('base.user_admin'))]" /> </record>

Could you please check it? thanks

@Alexis-SDK
Copy link
Copy Markdown

Any news here, please?

Other MRs are blocked because of this one

@dannyadair
Copy link
Copy Markdown

dannyadair commented Apr 14, 2026

don't change the repo-wide .pylintrc in a module migration. Especially don't change from v19 down to v18

(see output of pre-commit test "Run precommit" step)

That should have probably failed the test instead of just giving a warning.

@dannyadair
Copy link
Copy Markdown

@Debora7 in practical terms, just don't touch .pylintrc it's already ready for v19 https://github.com/OCA/margin-analysis/blob/19.0/.pylintrc
If you get pre-commit warnings/errors fix them, don't disable checks

@Yusuke1998 Yusuke1998 mentioned this pull request Apr 20, 2026
7 tasks
@Yusuke1998
Copy link
Copy Markdown

In the module's description/information, the paths to the images account_invoice_margin/static/description/account_invoice_tree.png and account_invoice_margin/static/description/account_invoice_form.png still need to be corrected.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.