Skip to content

Conversation

@ypapouin
Copy link
Contributor

@ypapouin ypapouin commented Jan 5, 2026

Fix and improvements for Odoo 18.0 (this PR is based on a closed PR I previously made for Odoo 14.0 #1357)

  1. Use rule context: Instead of trying to get the product context, we must use the product.pricelist.item context to get the filtered partner. The current implementation is broken, a new test is added to ensure that it works correctly now.
  2. Let Odoo compute the produce price: Odoo's pricelist computation is now correctly split, so we override the base price computation instead of the full price and we let Odoo compute surcharge/discount/etc. This improvement removes a lot of code that was copy/paste from Odoo price computation.
  3. Refactoring to match Odoo's pricelist API: To match the new price computation signature from odoo/odoo@57ced812. (Also drop support to get "UoM" and "date" from context)
  4. More and improved tests on UoM and Dates.

@OCA-git-bot
Copy link
Contributor

Hi @luisg123v,
some modules you are maintaining are being modified, check this out!

Instead of trying to get the product context, we must use the `product.pricelist.item` context to get the filtered partner
Odoo's pricelist computation is now correctly split, so we override the base price computation instead of the full price and we let Odoo compute surcharge/discount/etc.
- Function signature of `_get_supplierinfo_pricelist_price` updated to match `PriceList._compute_price_rule`

- Also drop support to get "UoM" and "date" from context
  (see Odoo commit 57ced812f099bec67bade265fd592160ad5690a2: [REF] product: clean pricelist API )

- Improve test on different UoM:
  - Add `price_surcharge` to the UoM test
  - Add an intermediate UoM (half-dozen) to ensure valid results when the wanted UoM
    is not one of the product's default (uom_id, uom_po_id)
@ypapouin ypapouin force-pushed the 18.0-product_pricelist_supplierinfo-refactoring branch from 9f88a8e to 3c1aed7 Compare January 6, 2026 09:31
@ypapouin
Copy link
Contributor Author

ypapouin commented Jan 6, 2026

@CLaurelB can you please take a look on this since you did the 18.0 migration ? (#1837)
@AaronHForgeFlow can you please take a look on this since you made a PR for the 19.0 migration ? (#2137)

@AaronHForgeFlow
Copy link
Contributor

Thanks @ypapouin code LGTM. I will check how to incorporate this to v19, a refactor was done for the v19 migration and it is not a straightforward forward port.

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.

3 participants