What You Want
If a product is not in the Plumber Pricelist , then fallback to Customer-specific Pricelist , and if not found, fallback to Default price (Public or Cost price) .
Why This Is Not Native
Odoo only supports one active pricelist per sale order/customer . It does not support fallback chains across multiple pricelists out of the box.
Solution Outline (Technical)
Step 1: Create Multiple Pricelists
- pricelist_1 : For plumbers
- pricelist_2 : For individual customers
- default : Public or base price (fallback)
Step 2: Custom Module Code (Python)
You will override the get_product_price logic to check multiple pricelists in order.
from odoo import models class ProductTemplate(models.Model): _inherit = 'product.template' def get_price_cascade(self, product, partner): "Custom method to cascade through pricelists" # Step 1: Get all pricelists in priority order pricelists = [] if partner.is_plumber and partner.plumber_pricelist_id: pricelists.append(partner.plumber_pricelist_id) if partner.property_product_pricelist: pricelists.append(partner.property_product_pricelist) # Step 2: Try to get price from each pricelist for pricelist in pricelists: price = pricelist._compute_price_rule([(product, 1.0, partner)], partner)[product.id][0] if price: return price #Step 3: Fallback to default price return product.lst_price # or product.standard_price depending on your policy
Step 3: Update Your Sales Order Logic (Optional)
Override or extend the sales order form view to show the calculated price using the new method get_price_cascade .
Add Partner Field: is_plumber and plumber_pricelist_id
Extend the res.partner model:
from odoo import models, fields class ResPartner(models.Model): _inherit = 'res.partner' is_plumber = fields.Boolean(string="Is Plumber?") plumber_pricelist_id = fields.Many2one('product.pricelist', string="Plumber Pricelist")
Testing Example
- Product A in pricelist_plumber → Use it
- Product B not in pricelist_plumber , but in pricelist_customer → Use it
- Product C not in both → Use lst_price
Can You Do This with No Code?
Not fully. Odoo's standard UI only allows selecting one pricelist per customer or sale.
Thanks & Regards,
Email: contact@datainteger.com