Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
4943 Lượt xem

Can anyone tell me how Odoo compute the price unit in sale.order depending on pricelist?

Like in case the product doesn't exit in any pricelist, how Odoo will compute the price?

Or if the product doesn't exit in the pricelist of the customer of the sale order?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi, 

You may already know that when you create a Sale order, the So's pricelist is the partner's pricelist.

When you add a sale order line, an onchange is triggered and computes the new price_unit based on the quantity, the product and the SO's pricelist. 

Please kindly check the following onchange : 

@api.onchange('product_uom', 'product_uom_qty')
def product_uom_change(self):
if not self.product_uom or not self.product_id:
self.price_unit = 0.0
return
if self.order_id.pricelist_id and self.order_id.partner_id:
product = self.product_id.with_context(
lang=self.order_id.partner_id.lang,
partner=self.order_id.partner_id,
quantity=self.product_uom_qty,
date=self.order_id.date_order,
pricelist=self.order_id.pricelist_id.id,
uom=self.product_uom.id,
fiscal_position=self.env.context.get('fiscal_position')
)
self.price_unit = self.env['account.tax']._fix_tax_included_price_company(self._get_display_price(product), product.taxes_id, self.tax_id, self.company_id)

Please note that also if you change the Quotation template, Odoo computes the product price_unit too based on the given SO pricelist. Please check : 
def onchange_sale_order_template_id(self) at  odoo/addons/sale_management/models/sale_order.py:66


Hope this helps. 
Best of luck.




Ảnh đại diện
Huỷ bỏ
Tác giả

Thank you Ibrahim for your answer.
Yes I already know that but what I want to know is how Odoo compute the price unit.
For example, the partner has a specific price list then I add a product in the sale.order.line while the product is not included in the price list of the customer so how will Odoo calculate the price unit

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 7 20
2322
0
thg 9 19
3415
3
thg 3 25
1070
2
thg 12 24
525
4
thg 2 25
8194