跳至内容
菜单
此问题已终结
1 回复
421 查看

hello,

how can i do in odoo to have a cascad in the pricelist with fix price. by example


My customer X has a list price

The same cutomer is plomber, and as plomber he has a pricelist

for each product which are not in pricelist 1 or 2, the price is DEFAULT


how can ask to odoo to check the pricelist 1  and after 2 if the customer is a plomber and 3 if not response 


thans you

形象
丢弃
最佳答案
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

形象
丢弃
相关帖文 回复 查看 活动
1
6月 25
193
1
6月 25
552
3
5月 25
626
3
5月 25
914
1
5月 25
646