Skip to content

Commit 7f3f629

Browse files
author
Lionel Sausin (Numérigraphe)
committed
[IMP] Rename cost_price to 'Replenishment cost'
Fixes OCA#6 This change is meant as a short-term solution, to avoid confusion between standard_price and cost_price since both are named 'Cost Price' in the GUI. The accounting best practise seems to be that if a Cost price is known, it MUST be used for the valuation of the stock. So the right 'Cost price' field is standard_price and we have to name cost_price something else. Translation into French is provided. The description of the fields in the modules which override it is changed too, because for some reason the server seems unable to export the new names in the .po files.
1 parent 0858e06 commit 7f3f629

File tree

11 files changed

+82
-67
lines changed

11 files changed

+82
-67
lines changed

product_cost_incl_bom/__openerp__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
#
2020
##############################################################################
21-
{'name': 'Product Cost incl. BOM',
22-
'version': '1.0',
21+
{'name': 'Replenishment Cost incl. BOM',
22+
'version': '1.1',
2323
'author': 'Camptocamp',
2424
'maintainer': 'Camptocamp',
2525
'category': 'Products',
@@ -28,14 +28,14 @@
2828
'mrp',
2929
],
3030
'description': """
31-
Product Cost including BOM costs
32-
================================
31+
Replenishment Cost including BOM costs
32+
======================================
3333
34-
Compute product cost price by recursively summing parts cost prices according
35-
to product BOM. It takes into account the BoM costing (cost per cycle and
36-
so...). If no BOM define for a product, the cost_price is always equal to the
37-
standard_price field of the product, so we always have a value to base our
38-
reporting on.
34+
Compute product's Replenishment cost by recursively summing the Replenishment
35+
costs of the parts according to product BOM. It takes into account the BoM
36+
costing (cost per cycle and so...). If no BOM define for a product,
37+
the Replenishment cost is always equal to the Cost price of the product,
38+
so we always have a value to base our reporting on.
3939
4040
The computed value is stored in the DB and can be used in 3rd party report.
4141

product_cost_incl_bom/product_cost_incl_bom.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def _compute_purchase_price(self, cr, uid, ids, context=None):
107107
The price of all theses products are computed at the same
108108
time in this function, the effect is that we should take:
109109
110-
1. to not read the cost price of a product in the browse_record,
110+
1. to not read the cost of a product in the browse_record,
111111
if it is computed here because it has likely changed, but use
112112
the new cost instead
113113
2. compute the prices in a topological order, so we start at the
@@ -184,7 +184,7 @@ def _compute_purchase_price(self, cr, uid, ids, context=None):
184184
for product_id in ordered:
185185
if product_id not in ids:
186186
# the product is a dependency so it appears in the
187-
# topological sort, but the cost price should not be
187+
# topological sort, but the cost should not be
188188
# recomputed
189189
continue
190190
if product_id not in product_bom:
@@ -196,7 +196,7 @@ def _compute_purchase_price(self, cr, uid, ids, context=None):
196196
for subproduct_info in subproduct_infos:
197197
subproduct_id = subproduct_info['product_id']
198198
subproduct = subproduct_costs[subproduct_id]
199-
# The cost price could have been recomputed in an
199+
# The cost could have been recomputed in an
200200
# earlier iteration. Thanks to the topological sort,
201201
# the subproducts are always computed before their
202202
# parents
@@ -329,10 +329,12 @@ def _get_product_from_template2(self, cr, uid, ids, context=None):
329329
'cost_price': fields.function(
330330
_cost_price,
331331
store=_cost_price_triggers,
332-
string='Cost Price (incl. BoM)',
332+
string='Replenishment cost',
333333
digits_compute=dp.get_precision('Product Price'),
334-
help="The cost price is the standard price or, if the "
335-
"product has a bom, the sum of all standard price "
336-
"of its components. it take also care of the bom "
337-
"costing like cost per cycle.")
334+
help="The cost that you have to support in order to produce or "
335+
"acquire the goods. Depending on the modules installed, "
336+
"this cost may be computed based on various pieces of "
337+
"information, for example Bills of Materials or latest "
338+
"Purchases. By default, the Replenishment cost is the same "
339+
"as the Cost Price.")
338340
}

product_cost_incl_bom_price_history/__openerp__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@
2121
##############################################################################
2222

2323
{
24-
"name": "Product Cost incl. BoM and Price History",
25-
"version": "1.2",
24+
"name": "Replenishment Cost incl. BoM and Price History",
25+
"version": "1.3",
2626
"author": "Camptocamp",
2727
"category": "Generic Modules/Inventory Control",
2828
"depends": ["product_cost_incl_bom",
2929
"product_price_history",
3030
],
3131
"description": """
32-
Product Cost incl. BoM and Price History
33-
========================================
32+
Replenishment Cost incl. BoM and Price History
33+
==============================================
3434
3535
This module make the glue between product_cost_incl_bom and
36-
product_price_history and allow to have your cost price computed from the
37-
component of the BoM, while having it also historized by company.
36+
product_price_history and allow to have your Replenishment cost computed from
37+
the component of the BoM, while having it also historized by company.
3838
3939
It display now this value for the inventory valuation provided by
4040
product_price_history module.

product_cost_incl_bom_price_history/product.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,14 @@ def _product_value(self, cr, uid, ids, field_names=None,
222222
'cost_price': fields.function(
223223
_cost_price,
224224
store=_cost_price_triggers,
225-
string='Cost Price (incl. BoM)',
225+
string='Replenishment cost',
226226
digits_compute=dp.get_precision('Product Price'),
227-
help="The cost price is the standard price or, if the product has "
228-
"a bom, the sum of all standard price of its components. it "
229-
"take also care of the bom costing like cost per cylce."),
227+
help="The cost that you have to support in order to produce or "
228+
"acquire the goods. Depending on the modules installed, "
229+
"this cost may be computed based on various pieces of "
230+
"information, for example Bills of Materials or latest "
231+
"Purchases. By default, the Replenishment cost is the same "
232+
"as the Cost Price."),
230233
'value_available': fields.function(
231234
_product_value,
232235
type='float', digits_compute=dp.get_precision('Product Price'),

product_get_cost_field/__openerp__.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,27 @@
1818
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
#
2020
##############################################################################
21-
{'name': 'Product Cost field',
22-
'version': '1.0.1',
21+
{'name': 'Replenishment cost',
22+
'version': '1.0.3',
2323
'author': 'Camptocamp',
2424
'maintainer': 'Camptocamp',
2525
'category': 'Products',
26-
'complexity': "normal", # easy, normal, expert
2726
'depends': [
2827
'product',
2928
],
3029
'description': """
31-
Product Cost field
32-
==================
30+
Product Replenishment Cost
31+
==========================
3332
34-
Provides an overridable method on product which compute the cost_price field of
35-
a product. By default it just return the value of standard_price field, but
33+
Provides an overridable method on product which compute the Replenishment cost
34+
of a product. By default it just returns the value of "Cost price" field, but
3635
using the product_cost_incl_bom module, it will return the costing from the
3736
bom.
3837
3938
As it is a generic module, you can also setup your own way of computing the
4039
cost_price for your product.
4140
42-
All our modules to compute margin are based on it, so you'll ba able to use
41+
All OCA modules to compute margins are based on it, so you'll be able to use
4342
them in your own way.
4443
4544
Contributors
@@ -53,12 +52,8 @@
5352
'data': [
5453
'product_view.xml'
5554
],
56-
'demo': [],
5755
'test': [
5856
'test/cost_price_update.yml',
5957
],
60-
'installable': True,
61-
'auto_install': False,
6258
'license': 'AGPL-3',
63-
'application': False
6459
}

product_get_cost_field/i18n/fr.po

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ msgid ""
66
msgstr ""
77
"Project-Id-Version: OpenERP Server 7.0\n"
88
"Report-Msgid-Bugs-To: \n"
9-
"POT-Creation-Date: 2013-11-05 15:57+0000\n"
10-
"PO-Revision-Date: 2013-11-05 15:57+0000\n"
9+
"POT-Creation-Date: 2014-10-30 16:52+0000\n"
10+
"PO-Revision-Date: 2014-10-30 16:52+0000\n"
1111
"Last-Translator: <>\n"
1212
"Language-Team: \n"
1313
"MIME-Version: 1.0\n"
@@ -16,18 +16,19 @@ msgstr ""
1616
"Plural-Forms: \n"
1717

1818
#. module: product_get_cost_field
19-
#: help:product.product,cost_price:0
20-
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."
21-
msgstr "Le prix coûtant est le prix standard ou, si le produit est défini par une nomenclature, la somme de tout les prix standard de ses composants. les coûts de la nomenclature comme le coût par cycle sont pris en compte."
19+
#: field:product.product,cost_price:0
20+
msgid "Replenishment cost"
21+
msgstr "Coût de réapprovisionnement"
2222

2323
#. module: product_get_cost_field
24+
#: code:_description:0
2425
#: model:ir.model,name:product_get_cost_field.model_product_product
26+
#, python-format
2527
msgid "Product"
2628
msgstr "Article"
2729

2830
#. module: product_get_cost_field
29-
#: model:ir.model.fields,field_description:product_get_cost_field.field_product_product_cost_price
30-
#: field:product.product,cost_price:0
31-
msgid "Cost Price (incl. BoM)"
32-
msgstr "Prix coûtant (BoM incl.)"
31+
#: help:product.product,cost_price:0
32+
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."
33+
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."
3334

product_get_cost_field/i18n/product_get_cost_field.pot

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ msgid ""
66
msgstr ""
77
"Project-Id-Version: OpenERP Server 7.0\n"
88
"Report-Msgid-Bugs-To: \n"
9-
"POT-Creation-Date: 2013-11-05 15:57+0000\n"
10-
"PO-Revision-Date: 2013-11-05 15:57+0000\n"
9+
"POT-Creation-Date: 2014-10-30 16:51+0000\n"
10+
"PO-Revision-Date: 2014-10-30 16:51+0000\n"
1111
"Last-Translator: <>\n"
1212
"Language-Team: \n"
1313
"MIME-Version: 1.0\n"
@@ -16,18 +16,19 @@ msgstr ""
1616
"Plural-Forms: \n"
1717

1818
#. module: product_get_cost_field
19-
#: help:product.product,cost_price:0
20-
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."
19+
#: field:product.product,cost_price:0
20+
msgid "Replenishment cost"
2121
msgstr ""
2222

2323
#. module: product_get_cost_field
24+
#: code:_description:0
2425
#: model:ir.model,name:product_get_cost_field.model_product_product
26+
#, python-format
2527
msgid "Product"
2628
msgstr ""
2729

2830
#. module: product_get_cost_field
29-
#: model:ir.model.fields,field_description:product_get_cost_field.field_product_product_cost_price
30-
#: field:product.product,cost_price:0
31-
msgid "Cost Price (incl. BoM)"
31+
#: help:product.product,cost_price:0
32+
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."
3233
msgstr ""
3334

product_get_cost_field/product_get_cost_field.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class product_product(orm.Model):
2929
_inherit = 'product.product'
3030

3131
def _compute_purchase_price(self, cr, uid, ids, context=None):
32+
""""Use standard_price's value for cost_price"""
33+
# TODO: merge with _cost_price in v8, use new API
3234
res = {}
3335
if isinstance(ids, (int, long)):
3436
ids = [ids]
@@ -39,21 +41,26 @@ def _compute_purchase_price(self, cr, uid, ids, context=None):
3941
return res
4042

4143
def _cost_price(self, cr, uid, ids, field_name, arg, context=None):
42-
if context is None:
43-
context = {}
44+
""""Proxy method to make the function field modular
45+
46+
Submodules have only to override _compute_purchase_price(), without
47+
having to redefine the whole function field"""
48+
# TODO: merge with _compute_purchase_price in v8, use new API
4449
return self._compute_purchase_price(cr, uid, ids, context=context)
4550

4651
def get_cost_field(self, cr, uid, ids, context=None):
4752
return self._cost_price(cr, uid, ids, '', [], context=context)
4853

4954
def _get_product_from_template(self, cr, uid, ids, context=None):
55+
"""Find the products to trigger when a template changes"""
56+
# self may be product template so we need to lookup the pool
5057
prod_obj = self.pool.get('product.product')
5158
prod_ids = prod_obj.search(cr, uid,
5259
[('product_tmpl_id', 'in', ids)],
5360
context=context)
5461
return prod_ids
5562

56-
# Trigger on product.product is set to None, otherwise do not trigg
63+
# Trigger on product.product is set to None, otherwise do not trigger
5764
# on product creation !
5865
_cost_price_triggers = {
5966
'product.product': (lambda self, cr, uid, ids, context=None:
@@ -67,8 +74,12 @@ def _get_product_from_template(self, cr, uid, ids, context=None):
6774
'cost_price': fields.function(
6875
_cost_price,
6976
store=_cost_price_triggers,
70-
string='Cost Price',
77+
string='Replenishment cost',
7178
digits_compute=dp.get_precision('Product Price'),
72-
help="The cost price is the standard price unless you install the "
73-
"product_cost_incl_bom module.")
79+
help="The cost that you have to support in order to produce or "
80+
"acquire the goods. Depending on the modules installed, "
81+
"this cost may be computed based on various pieces of "
82+
"information, for example Bills of Materials or latest "
83+
"Purchases. By default, the Replenishment cost is the same "
84+
"as the Cost Price.")
7485
}

product_get_cost_field/product_view.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<field name="model">product.product</field>
88
<field name="inherit_id" ref="product.product_normal_form_view" />
99
<field name="arch" type="xml">
10+
<!-- Add the Replenishment cost -->
1011
<field name="cost_method" groups="product.group_costing_method" position="after">
1112
<field name="cost_price"/>
1213
</field>

product_stock_cost_field_report/__openerp__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
#
2020
##############################################################################
21-
{'name': 'Product Cost field Report',
21+
{'name': 'Replenishment Cost Report',
2222
'version': '1.0',
2323
'author': 'Camptocamp',
2424
'maintainer': 'Camptocamp',
@@ -28,12 +28,13 @@
2828
'stock',
2929
],
3030
'description': """
31-
Product Cost field Report
31+
Replenishment Cost Report
3232
=========================
3333
3434
This module override the reporting view of OpenERP to replace the
35-
standard_price field used by the new cost_price one. This way all reporting of
36-
OpenERP will now take this field into account and display the correct result.
35+
Cost price field used with the Replenishment cost one. This way all reporting
36+
of OpenERP will now take this field into account and display the correct
37+
result.
3738
3839
We're talking here about the reporting found under: Reporting -> Warehouse
3940

0 commit comments

Comments
 (0)