Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
30c3756
[ADD] V8. product_replenishment_cost
legalsylvain Jul 24, 2015
9b2d7ef
[UPD] prefix versions with 8.0
sbidoul Oct 9, 2015
cdab8d3
[MIG] Make modules uninstallable
pedrobaeza Oct 14, 2015
4907743
[MIG] Rename manifest files
pedrobaeza Oct 6, 2016
cc5a2ea
remove obsolete .pot files [ci skip]
sbidoul Jun 15, 2018
95cc70d
migrate product_replenishment_cost to v9
nicomacr Nov 2, 2016
a716707
[MIG] product_replenishment_cost: Migration to 10.0
Jul 31, 2019
3ecc3d5
[PORT][12.0] product_replenishment_cost
legalsylvain Aug 9, 2019
dffd550
Added translation using Weblate (Chinese (Simplified))
liweijie0812 Sep 18, 2019
e9e1cb6
Translated using Weblate (Chinese (Simplified))
liweijie0812 Sep 18, 2019
6590a5e
Added translation using Weblate (Portuguese (Brazil))
marcelsavegnago Mar 14, 2021
5d5cdd7
Added translation using Weblate (Portuguese)
alvarorib Apr 12, 2021
a1a6945
Translated using Weblate (Portuguese)
alvarorib Apr 12, 2021
c4a470a
Added translation using Weblate (Italian)
mymage Dec 28, 2022
599c9cb
Translated using Weblate (Italian)
mymage Dec 28, 2022
40f02d9
[REF] apply pre-commit fixes
legalsylvain Jan 3, 2023
5bb7fac
[IMP] product_replenishment_cost: pre-commit stuff
amarcosg Jun 5, 2023
341a4cd
[MIG] product_replenishment_cost: Migration to 16.0
amarcosg Jun 5, 2023
3a287e4
[UPD] DESCRIPTION.rst
amarcosg Jun 6, 2023
2bf1c9a
[UPD] Update product_replenishment_cost.pot
Jul 25, 2023
96a37ff
Update translation files
weblate Jul 25, 2023
2cc557c
Translated using Weblate (Spanish)
Ivorra78 Aug 21, 2023
1c8a7b5
Translated using Weblate (French)
kbentaleb Jan 8, 2024
6788552
Translated using Weblate (Italian)
mymage Jan 19, 2024
a897364
Translated using Weblate (Portuguese (Brazil))
May 21, 2024
f3f9bf1
[IMP] product_replenishment_cost: pre-commit auto fixes
BhaveshHeliconia Feb 21, 2025
531f3be
[MIG] product_replenishment_cost: Migration to 17.0
BhaveshHeliconia Feb 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[ADD] V8. product_replenishment_cost
- move product_get_cost_field from unported folder to root folder; rename module;
[PORT] various changes realized in v7 branch; specially 7f3f629
[REF] OCA convention about folders;
[PORT] V8 api;
[ADD] demo data;
[FIX] set replenishment_cost as a stored field;
  • Loading branch information
legalsylvain authored and BhaveshHeliconia committed Dec 15, 2025
commit 30c3756211fb703b891216c4e1fa34146120d4c0
50 changes: 50 additions & 0 deletions product_replenishment_cost/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3

Product Replenishment Cost
==========================

Provides an overridable method on product which compute the Replenishment cost
of a product. By default it just returns the value of "Cost price" field, but
using the product_cost_incl_bom module, it will return the costing from the
bom.

As it is a generic module, you can also setup your own way of computing the
replenishment_cost for your product.

All OCA modules to compute margins are based on it, so you'll be able to use
them in your own way.


Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback
`here <https://github.com/OCA/margin-analysis/issues/new?body=module:%20product_replenishment_cost%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Credits
=======

Contributors
------------

* Alexandre Fayolle <alexandre.fayolle@camptocamp.com>
* Yannick Vaucher <yannick.vaucher@camptocamp.com>
* Joël Grand-Guillaume <joel.grand-guillaume@camptocamp.com>
* Sylvain Le Gal (https://twitter.com/legalsylvain)

Maintainer
----------

.. image:: http://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: http://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

To contribute to this module, please visit http://odoo-community.org.

22 changes: 22 additions & 0 deletions product_replenishment_cost/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Alexandre Fayolle, Joel Grand-Guillaume
# Copyright 2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from . import models
38 changes: 38 additions & 0 deletions product_replenishment_cost/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Alexandre Fayolle
# Copyright 2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Replenishment cost',
'version': '2.0',
'author': "Camptocamp,GRAP,Odoo Community Association (OCA)",
'category': 'Products',
'depends': [
'product',
],
'website': 'http://www.camptocamp.com/',
'data': [
'views/view.xml',
'demo/res_groups.yml',
],
'test': [
'test/cost_price_update.yml',
],
'license': 'AGPL-3',
}
28 changes: 28 additions & 0 deletions product_replenishment_cost/demo/res_groups.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015-Today GRAP (http://www.grap.coop)
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

- !record {model: res.groups, id: base.group_no_one}:
users:
- base.user_root

- !record {model: res.groups, id: base.group_sale_manager}:
users:
- base.user_root
34 changes: 34 additions & 0 deletions product_replenishment_cost/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * product_replenishment_cost
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-10-30 16:52+0000\n"
"PO-Revision-Date: 2014-10-30 16:52+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: product_replenishment_cost
#: field:product.product,cost_price:0
msgid "Replenishment cost"
msgstr "Coût de réapprovisionnement"

#. module: product_replenishment_cost
#: code:_description:0
#: model:ir.model,name:product_replenishment_cost.model_product_product
#, python-format
msgid "Product"
msgstr "Article"

#. module: product_replenishment_cost
#: help:product.product,cost_price:0
msgid "The cost that you have to support in order to produce or acquire the goods. Depending on the modules installed, this cost may be computed based on various pieces of information, for example Bills of Materials or latest Purchases. By default, the Replenishment cost is the same as the Cost Price."
msgstr "Le coût que vous devez prendre en charge pour produire ou acquerir la marchandise. Selon les modules installés, le calcul de ce coût peut s'appuyer sur diverses informations : par exemple les nomenclatures ou les derniers achats. Par défaut, le coût de réapprovisionnement est le même que le Prix de revient."

37 changes: 37 additions & 0 deletions product_replenishment_cost/i18n/nl.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * product_replenishment_cost
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 6.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-12-23 10:21+0000\n"
"PO-Revision-Date: 2012-12-23 11:28+0100\n"
"Last-Translator: Erwin van der Ploeg | Endian Solutions "
"<erwin@endiansolutions.nl>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"X-Generator: Poedit 1.5.4\n"

#. module: product_replenishment_cost
#: help:product.product,cost_price:0
msgid ""
"The cost price is the standard price or, if the product has a bom, the sum "
"of all standard price of its components. it take also care of the bom "
"costing like cost per cylce."
msgstr "Dit is de kostprijs, inclusief eventuele kosten."

#. module: product_replenishment_cost
#: model:ir.model,name:product_replenishment_cost.model_product_product
msgid "Product"
msgstr "Product"

#. module: product_replenishment_cost
#: field:product.product,cost_price:0
msgid "Cost Price (incl. BoM)"
msgstr "Kostprijs (incl. kosten)"

34 changes: 34 additions & 0 deletions product_replenishment_cost/i18n/product_replenishment_cost.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * product_replenishment_cost
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-10-30 16:51+0000\n"
"PO-Revision-Date: 2014-10-30 16:51+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: product_replenishment_cost
#: field:product.product,cost_price:0
msgid "Replenishment cost"
msgstr ""

#. module: product_replenishment_cost
#: code:_description:0
#: model:ir.model,name:product_replenishment_cost.model_product_product
#, python-format
msgid "Product"
msgstr ""

#. module: product_replenishment_cost
#: help:product.product,cost_price:0
msgid "The cost that you have to support in order to produce or acquire the goods. Depending on the modules installed, this cost may be computed based on various pieces of information, for example Bills of Materials or latest Purchases. By default, the Replenishment cost is the same as the Cost Price."
msgstr ""

22 changes: 22 additions & 0 deletions product_replenishment_cost/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Alexandre Fayolle, Joel Grand-Guillaume
# Copyright 2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from . import product_product
44 changes: 44 additions & 0 deletions product_replenishment_cost/models/product_product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Alexandre Fayolle
# Copyright 2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from openerp import fields, api
from openerp.models import Model

import openerp.addons.decimal_precision as dp


class ProductProduct(Model):
_inherit = 'product.product'

@api.one
@api.depends('product_tmpl_id.standard_price')
def _get_replenishment_cost(self):
self.replenishment_cost = self.standard_price

replenishment_cost = fields.Float(
compute=_get_replenishment_cost, store=True,
digits_compute=dp.get_precision('Product Price'),
help="The cost that you have to support in order to produce or "
"acquire the goods. Depending on the modules installed, "
"this cost may be computed based on various pieces of "
"information, for example Bills of Materials or latest "
"Purchases. By default, the Replenishment cost is the same "
"as the Cost Price.")
50 changes: 50 additions & 0 deletions product_replenishment_cost/test/cost_price_update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
-
Test the following with user admin
-
!context
uid: 'base.user_root'
-
Create a wine A product
-
!record {model: product.product, id: product_product_a}:
categ_id: product.product_category_1
name: Wine A01
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
company_id: 0
standard_price: 50.0
list_price: 75.0
-
Test the prices are updated correctly
-
!python {model: product.product}: |
product = self.browse(cr, uid, ref('product_product_a'))
assert product.standard_price == 50.0, "01 The standard_price has not been recorded correctly"
assert product.replenishment_cost == 50.0, "01 The replenishment_cost has not been recorded correctly"
-
Modify product A set new prices
-
!python {model: product.product}: |
self.write(cr, uid, ref('product_product_a'), {'standard_price':70})
-
Test price are update accordingly
-
!python {model: product.product}: |
product = self.browse(cr, uid, ref('product_product_a'))
assert product.standard_price == 70.0, "02 The standard_price has not been recorded correctly"
assert product.replenishment_cost == 70.0, "02 The replenishment_cost has not been recorded correctly"
-
Modify product A using the template object and set new prices
-
!python {model: product.product}: |
product = self.browse(cr, uid, ref('product_product_a'))
prod_tmpl_id = product.product_tmpl_id.id
self.pool.get('product.template').write(cr, uid, [prod_tmpl_id], {'standard_price':100})
-
Test replenishment_cost is update accordingly
-
!python {model: product.product}: |
product = self.browse(cr, uid, ref('product_product_a'))
assert product.standard_price == 100.0, "03 The standard_price has not been recorded correctly"
assert product.replenishment_cost == 100.0, "03 The replenishment_cost has not been recorded correctly"

15 changes: 15 additions & 0 deletions product_replenishment_cost/views/view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_product_product_form" model="ir.ui.view">
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view" />
<field name="arch" type="xml">
<field name="standard_price" position="after">
<field name="replenishment_cost"/>
</field>
</field>
</record>

</data>
</openerp>