Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

Seeking Advice on Migrating Custom Pricing Logic to Built-in Features in Odoo 17

by
Ing. Rolando Pérez Rebollo
- 22/02/2025 14:24:57

Dear Community,

I hope this message finds you well. I’m reaching out for advice on improving an Odoo 17 setup related to pricing strategies.

Current Scenario

The customer has configured 5 pricelists, with each partner assigned to one of them. Additionally, a simple custom development—let’s call it "On Sale"—has been implemented. This feature allows setting:

  • A customer
  • A product
  • A fixed price
  • A date interval

When a product is selected in a sale order line, the system queries the "On Sale" model. If a match is found, the custom price is applied; otherwise, the default partner’s pricelist is used.

My Goal

I’d like to migrate this custom development to built-in or OCA features and remove the custom code. However, I’m struggling to replicate the same user experience (UX) and pricing logic.

The Challenge

The fallback mechanism is where I’m stuck. If I:

  1. Create a dedicated pricelist per partner with all relevant "On Sale" records, and
  2. Set this new pricelist on the partner,

It works fine only if a match exists. However, if there’s no matching rule, I need a way to fallback to the original pricelist assigned to the partner. I haven't found a straightforward way to set a fallback pricelist for each partner using the built-in system.

Possible Solution?

The customer is currently using the "Multiple Prices per Product" pricing strategy. I’m considering switching to "Advanced Price Rules" instead. This might allow me to:

  • Create an "On Sale" pricelist for each partner.
  • Set up a "Coordinator" pricelist per partner, with two rules:
    1. A rule that prioritizes the "On Sale" pricelist.
    2. A fallback rule that applies the regular pricelist if no custom price applies.

In theory, this setup should replicate the current logic while using built-in features. However, I’m not entirely sure if this will maintain the desired behavior without introducing unexpected issues.

My Questions

  • Is switching to "Advanced Price Rules" the right approach for this scenario?
  • Has anyone faced a similar situation? If so, how did you manage the migration while keeping the UX intact?
  • Are there alternative methods to implement a fallback pricelist for each partner without custom development?

Any suggestions or shared experiences would be greatly appreciated. Thank you for your time and support!

Best regards,
\rrebollo

Follow-Ups