Skip to content

[18.0][FIX] sale_margin_pricelist_computation: Use sale.order.line _get_margin_pricelist_eval_context to test pricelist.item eval context - #278

Merged
OCA-git-bot merged 1 commit into
OCA:18.0from
Tecnativa:18.0-fix-sale_margin_pricelist_computation-test
Aug 10, 2026
Merged

[18.0][FIX] sale_margin_pricelist_computation: Use sale.order.line _get_margin_pricelist_eval_context to test pricelist.item eval context#278
OCA-git-bot merged 1 commit into
OCA:18.0from
Tecnativa:18.0-fix-sale_margin_pricelist_computation-test

Conversation

@Andrii9090-tecnativa

Copy link
Copy Markdown
Contributor

This change allows _get_margin_pricelist_eval_context to be overridden from other modules, making it possible to extend the evaluation context for each margin formula and evaluate the formula directly from pricelist.item.

@pedrobaeza can you review please?

@Tecnativa

@OCA-git-bot OCA-git-bot added mod:sale_margin_pricelist_computation Module sale_margin_pricelist_computation series:18.0 labels Aug 10, 2026
@pedrobaeza pedrobaeza changed the title [18.0][FIX] Use sale.order.line _get_margin_pricelist_eval_context to test pricelist.item eval context [18.0][FIX] sale_margin_pricelist_computation: Use sale.order.line _get_margin_pricelist_eval_context to test pricelist.item eval context Aug 10, 2026

@pedrobaeza pedrobaeza left a comment

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.

This is going to fail if the formula includes a division by one of the variables.

@pedrobaeza pedrobaeza added this to the 18.0 milestone Aug 10, 2026
@Andrii9090-tecnativa
Andrii9090-tecnativa force-pushed the 18.0-fix-sale_margin_pricelist_computation-test branch from 8ef0c1b to 994a6f7 Compare August 10, 2026 10:35
Comment thread sale_margin_pricelist_computation/models/product_pricelist_item.py Outdated
@Andrii9090-tecnativa

Copy link
Copy Markdown
Contributor Author

This is going to fail if the formula includes a division by one of the variables.

Using dummy data to simulate a real order should avoid this error.

@Andrii9090-tecnativa
Andrii9090-tecnativa force-pushed the 18.0-fix-sale_margin_pricelist_computation-test branch from 994a6f7 to 9feabe3 Compare August 10, 2026 10:40
…gin_pricelist_eval_context to test pricelist.item eval context

TT63968
@Andrii9090-tecnativa
Andrii9090-tecnativa force-pushed the 18.0-fix-sale_margin_pricelist_computation-test branch from 9feabe3 to 9d38469 Compare August 10, 2026 10:42

@pedrobaeza pedrobaeza left a comment

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.

We can fast-track it.

/ocabot merge patch

@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 18.0-ocabot-merge-pr-278-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot
OCA-git-bot merged commit 18df2a4 into OCA:18.0 Aug 10, 2026
7 checks passed
@OCA-git-bot

Copy link
Copy Markdown
Contributor

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

@Andrii9090-tecnativa
Andrii9090-tecnativa deleted the 18.0-fix-sale_margin_pricelist_computation-test branch August 10, 2026 10:53
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