In Odoo, I can already recompute the cost of a manufactured product using the standard server action (action_bom_cost).I would like to achieve a similar behavior, but instead of recomputing the cost, I want to recompute the sale price of the finished product.The idea is:
each component in the BOM already has its own sale price (margin included) the sale price of the finished product should be the sum of the sale prices of the BOM components, multiplied by their quantitiesIs there an existing method or best practice in Odoo to do this (server action, override, computed field), similar to action_bom_cost?Any guidance would be greatly appreciated.
This question has been flagged
I finally found a solution that works well without custom development, using Odoo Studio + Automations.
Context
The goal was to compute the sale price of a manufactured product based on the sale prices of its BOM components (margin already included at component level), similar to what action_bom_cost does for costs.
Add a sale price column on the BOM lines
First, I added a sale price column on the BOM lines (coming from the component product).
⚠️ Important point:
All BOM quantities must use the same Unit of Measure as the product sale UoM.
Odoo Studio does not handle UoM conversions automatically.
Example:
Product sold in hours
BOM needs 15 minutes → use 0.25 hours in the BOM
Create a computed Studio field on the BOM
I created a Studio computed field on the BOM (e.g. x_studio_prix_de_vente_calcule) with this Python code:
for record in self:
total = 0.0
for line in record.bom_line_ids:
unit_price = line.product_id.list_price or 0.0
qty = line.product_qty or 0.0
total += unit_price * qty
record['x_studio_prix_de_vente_calcule'] = total
Dependencies used:
bom_line_ids
This ensures the value is recalculated whenever BOM lines are modified.
Use an Automation to update the product sale price
Then, I used an Automated Action on the product to compute the final sale price from the BOM(s):
sum(
line['x_studio_prix_de_vente_calcule']
for line in record.bom_ids
)
This value is then written into the product’s sale price field.
Result
Sale price of the finished product = sum of sale prices of BOM components
No margin recalculation at product level
Fully compatible with Odoo Studio
No custom module required
Works reliably as long as UoMs are consistent
Notes
This approach is intentionally simple and avoids deep dependency chains (bom_line_ids.product_id.list_price) that are not supported in Studio.
For more advanced scenarios (multi-BOM logic, automatic UoM conversion, complex pricing rules), a custom module would be required.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Registrar-se| Related Posts | Respostes | Vistes | Activitat | |
|---|---|---|---|---|
|
|
0
d’abr. 26
|
33 | ||
|
|
1
de juny 23
|
5651 | ||
|
|
0
de gen. 23
|
4303 | ||
|
|
1
de juny 22
|
5006 | ||
|
|
2
de juny 26
|
426 |