Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Cost price update based on last PO price/average price

Paulo Matos‏
on 6/16/14, 11:49 AM 6,749 views

Dear all,

I cannot find a way to have Odoo 7 to automatically update the product cost price based on the last purchase order made or at least by the average cost price.

What I need is to have Odoo to automatically update the product cost price whenever I register a PO.

Any idea?

Thank you very much




Akhil P Sivan

--Akhil P Sivan--
| 5 3 6
Kochi, India
--Akhil P Sivan--

Interested in exploring Odoo both technically & functionality wise.

email-id : akhilpsivan01@gmail.com

Akhil P Sivan
On 12/7/14, 11:45 PM

You can build your own custom module for this requirement. You can proceed in these ways: You should first inherit mrp.bom and add a new field 'price_unit': fields.float('Unit Price') and redefine the onchange_product_id function define compute_price and compute_total function to calculate "line price" and "total price" Then you have to inherit mrp.production and define compute_production_cost function to update cost_price from BOM. We have created this custom module and it works perfect , in my module it takes avg purcahse price in BOM and we added an extra tab to manufactring form to compute Production Cost , in that tab you can add extra charges like electicity etc.. , that charges also added to cost by calculating per_unit charge depending on UOM. for any help you can contact us baijuks@hotmail.com, akhil.p.sivan007@gmail.com


Zura Tsiklauri

--Zura Tsiklauri--
| 5 2 6
Tbilisi, Georgia
--Zura Tsiklauri--
Zura Tsiklauri
On 10/22/14, 7:35 AM

The solution is Anglo Saxion Accounting. Then set the default in caaounting tab of product: Valuation: Real Time, Automated. and also set: Average price default in procurement tab of product.

U get auto update of cost price based on average and also cost of goods journal entry when selling. 

E.R. Spada II
On 8/27/14, 11:34 PM

Yes, the above is correct as we are using purchase_landed_costs and confirm the following with camptocamp module:

=> I understand. The point is, this is very difficult and cost a lot to achieve due to the structure of OpenERP (or odoo).

Currently, we solved that this way: * AVG price is computed with the PO landed costs when receiving the goods (picking ->done)

 * The margin in the SO line are computed using the current value (means the actual AVG price before ordering new goods to the supplier)

 * IF THE CUSTOMER INVOICE is generated AFTER deliveries, then you can have the proper margin computed in the invoice line using the product_historical_margin module). Because here, the AVG cost taken is the one after validating the incoming shipment from the supplier. So:

a) SO confirmed by customer with margin = current value

b) PO ordred to supplier

c) Goods received and AVG price updated

d) Customer invoice generated with proper margin

So my advice is here to compute commission based on invoice line instead of sales order lines.

Our next module is to create an a workflow "Waiting Landed Costs" so we will not receive the product until we have all Landed costs on the product view and sales order line. With using margin-analysis modules from camptocamp we can generate the true margin for reporting

Thank you E.R. Spada, I will give it a try on this modules and see how it works for my actual needs Regards

ThinkOpen Solutions (Angola), Paulo Matos‏
on 8/28/14, 4:18 AM
Paulo Matos‏
On 8/11/14, 7:50 AM

Dear Kevin,

Thank you very much.

In fact, what I need is a module that updates the product cost price when we register a Purchase Order.

When we register a PO on core Odoo, the product price on the product table is not automatically updated. What I need is to have a module that updates this price whenever I register a purchase order. Perhaps there's a way to do it on standard Odoo functionality but I do not know how. Can you please help?

Thank you once again


Paulo Matos


Kevin McMenamin

--Kevin McMenamin--
| 5 2 6
Auckland, New Zealand
--Kevin McMenamin--
Kevin McMenamin
On 6/23/14, 4:13 AM

Obviously this is not standard logic where the average price is updated based on the receipt of the goods.

You could change your cost method to standard cost and develop a module that updates the standard cost that is called on PO confirm.

On 8/27/14, 4:31 AM

In the previous OpenERP version, average cost could be activated. However, the calculation was incorrect in some cases pertaining to the sequence of the stock moves.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)


Asked: 6/16/14, 11:49 AM
Seen: 6749 times
Last updated: 3/16/15, 8:10 AM