Members mailing list archives

Re: [V8][PORT] margin-analysis (product_get_cost_field / product_standard_margin)

Camptocamp SA, Joël Grand Guillaume
- 10/08/2015 12:52:07
Hi there,

I'm jumping back on this topic (just returned from holidays). The idea I had in my head when I first drafted the existing modules:

 * The standard_price define by the standard Odoo addons represent the inventory valuation price. You can choose : standard price, average or real price here. We don't want to touch this field value because Odoo manage it well enough (in average or real costing method).

 * product_get_cost_field (now  renamed product_replenishment_cost) : Provide a computed and stored field (replenishment_cost) that represent the cost of a product that the company want to use to compute margins. Depending on various needs, the cost of a product is not computed the same way in every company, this module give a base as follow:

    - If no other module installed: replenishment_cost = standard_price field value
    - If product_cost_incl_bom installed: replenishment_cost = cost computed from BoM if any, otherwise standard_price value
    - Any other way to compute a cost or replenishment price here can be implemented in other modules (e.g. replenishment cost is equal to last purchased price)

 * product_standard_margin: just compute a margin based on replenishment_cost and list_price => That allow you to computed the way you want your replenishment_cost and have a correct margin here

 * product_price_history: store historical price of both standard_price and list_price by company to be able (from a reporting point of view) to get historical values => mostly used to have a proper inventory valuation at a given date. Now in version 8.0, this module is obsolete I think. We may need a module that will store the historical list_price at a point, but most of this module was here to support historical price for inventory valuation purpose. => A migration script for v8.0 would be very much appreciated by the user to get back their historical price in v8.0

 * product_historical_margin: Store the replenishment_price in invoice line and compute historical margin of product based on invoice lines. You can then compute a margin by month, year, or whatever. Another interesting point here is that you can drill down and open "Margin details" from a product and it'll show you when the margin value comes from (to justify, identify trouble,etc..). This module should be ported in version 8.0 as well IMO.

Personally, I would not be in favor of creating another module to store the standard_price in invoice_line, but I would rather port product_historical_margin (not a lot of work in this one).

Best regards,


On Thu, Jul 23, 2015 at 10:53 AM, Lionel Sausin <> wrote:
Le 23/07/2015 09:53, Sylvain LE GAL a écrit :
<blockquote cite="" type="cite">
Thanks for your answers,

I have a question about the main "cost" field. in Odoo, the field used is standard_price (= "Cost Price"), in OCA, the field used is "cost_price" (="Replenishment Cost"), field.function based on standard_price).

@FR : what is the exact translation of Replenishment ?
@Alexandre, @Other : If I understand correctly "cost_price" was introduced to manage correctly cost price in BoM case, and other special case. Is this module necessary in v8 ?
The matter is still a bit fuzzy for me and I think not everyone agrees inside OCA, and I'm not even sure everyone is aware that they don't agree.
Here's what I gathered :
- Odoo has a field named "cost price" which is used for inventory valuation.
     * At first I thought it was misnamed ( but Graeme Gellatly proved me wrong
- OCA has a field named "Replenishment cost" which, if I understand correctly, is not supposed to be used directly in accounting but rather as a tool for the management to supervise the profitability of the company product by product.
    * FR: I'd translate to "Prix de réappro."

It may or may not be a good practice to distinguish between the two. I've read from reputable sources that both should be the same, but real-world sources (company managers) say it's important for them to segregate the two. has a bit of discussion on this topic, please read it before you move ahead.


If we keep a distinct
"Replenishment cost" as a management tool, it should be configurable and modular, so every company can cherry-pick what it needs.
So from a technical point of view, if you're going to port/rewrite it, can you please structure it as suite of plugins that we can easily extend ?
I'm thinking of a structure like the one I set up for the stock available to promise here :

Post to:



Joël Grand-Guillaume
Division Manager
Business Solutions

+41 21 619 10 28