diff --git a/product_replenishment_cost/README.rst b/product_replenishment_cost/README.rst new file mode 100644 index 000000000..44e39edda --- /dev/null +++ b/product_replenishment_cost/README.rst @@ -0,0 +1,115 @@ +========================== +Product Replenishment Cost +========================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:11c36c6abdc64d2df703b1e6a520296b6566111a90c1782d8093576c121677a1 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github + :target: https://github.com/OCA/margin-analysis/tree/17.0/product_replenishment_cost + :alt: OCA/margin-analysis +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/margin-analysis-17-0/margin-analysis-17-0-product_replenishment_cost + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/margin-analysis&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +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. + +"Cost price" is the cost assigned for each product in the warehouse and +the "Replenishment cost" is the cost it would cost to buy a new product. +They are different costs because the cost price depends on your +valuation method and the operations you have performed while the +replenishment cost is determined by the current market conditions. + +For example: The price of the product in the supplier's catalog is +€15/piece. Therefore, if I want to buy a new unit, my replenishment cost +would be €15. But if my stock comes from having bought it in a special +offer that allowed me to buy it for €10, then my cost price is +€10/piece. + +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. + +**Table of contents** + +.. contents:: + :local: + +Known issues / Roadmap +====================== + +Due to framework limitation, the field ``replenishment_cost`` is not +company dependent, while ``standard_price`` is. (in the recent Odoo +versions) + +It is due to the current impossibility to make working computed field +between two field ``company_dependent=True``. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Camptocamp +* GRAP + +Contributors +------------ + +- Alexandre Fayolle +- Yannick Vaucher +- Joël Grand-Guillaume +- Sylvain Le Gal (https://twitter.com/legalsylvain) +- Marc Poch Mallandrich +- `Heliconia Solutions Pvt. Ltd. `__ + + - Bhavesh Heliconia + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +This module is part of the `OCA/margin-analysis `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/product_replenishment_cost/__init__.py b/product_replenishment_cost/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/product_replenishment_cost/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/product_replenishment_cost/__manifest__.py b/product_replenishment_cost/__manifest__.py new file mode 100644 index 000000000..44f0b38ff --- /dev/null +++ b/product_replenishment_cost/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2012 - Today: Camptocamp SA +# Copyright (C) 2016 - Today: GRAP (http://www.grap.coop) +# @author: Alexandre Fayolle +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "Product Replenishment Cost", + "summary": "Provides an overridable method on product which compute" + "the Replenishment cost of a product", + "version": "17.0.1.0.0", + "author": "Camptocamp,GRAP,Odoo Community Association (OCA)", + "license": "AGPL-3", + "category": "Products", + "depends": [ + "product", + ], + "website": "https://github.com/OCA/margin-analysis", + "data": [ + "views/product_view.xml", + ], + "installable": True, +} diff --git a/product_replenishment_cost/i18n/es.po b/product_replenishment_cost/i18n/es.po new file mode 100644 index 000000000..2cda61c34 --- /dev/null +++ b/product_replenishment_cost/i18n/es.po @@ -0,0 +1,47 @@ +# # Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_replenishment_cost +# +# Translators: +# PlanetaTIC - Marc Poch , 2019 +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: 2023-09-02 18:17+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: product_replenishment_cost +#: model:ir.model,name:product_replenishment_cost.model_product_product +msgid "Product Variant" +msgstr "Variante del producto" + +#. module: product_replenishment_cost +#: model:ir.model.fields,field_description:product_replenishment_cost.field_product_product__replenishment_cost +msgid "Replenishment cost" +msgstr "Coste de reposición" + +#. module: product_replenishment_cost +#: model:ir.model.fields,help:product_replenishment_cost.field_product_product__replenishment_cost +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 "" +"El coste que tiene que pagar para producir o adquirir los bienes. " +"Dependiendo de los módulos instalados, este coste puede calcularse en " +"función de diversos datos, por ejemplo, listas de materiales o compras más " +"recientes. De forma predeterminada, el coste de reposición es el mismo que " +"el precio de coste." + +#~ msgid "Product" +#~ msgstr "Producto" diff --git a/product_replenishment_cost/i18n/fr.po b/product_replenishment_cost/i18n/fr.po new file mode 100644 index 000000000..826e6a866 --- /dev/null +++ b/product_replenishment_cost/i18n/fr.po @@ -0,0 +1,45 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_replenishment_cost +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-08-09 17:05+0000\n" +"PO-Revision-Date: 2024-01-09 00:49+0000\n" +"Last-Translator: kbentaleb \n" +"Language-Team: \n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: product_replenishment_cost +#: model:ir.model,name:product_replenishment_cost.model_product_product +msgid "Product Variant" +msgstr "Variantes de produit" + +#. module: product_replenishment_cost +#: model:ir.model.fields,field_description:product_replenishment_cost.field_product_product__replenishment_cost +msgid "Replenishment cost" +msgstr "Coût de réapprovisionnement" + +#. module: product_replenishment_cost +#: model:ir.model.fields,help:product_replenishment_cost.field_product_product__replenishment_cost +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." + +#~ msgid "Product" +#~ msgstr "Article" diff --git a/product_replenishment_cost/i18n/it.po b/product_replenishment_cost/i18n/it.po new file mode 100644 index 000000000..9b5019055 --- /dev/null +++ b/product_replenishment_cost/i18n/it.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_replenishment_cost +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-01-19 10:33+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: product_replenishment_cost +#: model:ir.model,name:product_replenishment_cost.model_product_product +msgid "Product Variant" +msgstr "Variante prodotto" + +#. module: product_replenishment_cost +#: model:ir.model.fields,field_description:product_replenishment_cost.field_product_product__replenishment_cost +msgid "Replenishment cost" +msgstr "Costo rifornimento" + +#. module: product_replenishment_cost +#: model:ir.model.fields,help:product_replenishment_cost.field_product_product__replenishment_cost +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 "" +"Il costo che si sostiene per produrre o acquistare il bene. In funzione dei " +"moduli installati, questo costo può essere calcolato in base a varie " +"informazioni, per esempio distinte base o gli ultimi acquisti. Il costo di " +"rifornimento predefinito è lo stesso del prezzo di costo." + +#~ msgid "Product" +#~ msgstr "Prodotto" diff --git a/product_replenishment_cost/i18n/nl.po b/product_replenishment_cost/i18n/nl.po new file mode 100644 index 000000000..91f1a5384 --- /dev/null +++ b/product_replenishment_cost/i18n/nl.po @@ -0,0 +1,41 @@ +# 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 " +"\n" +"Language-Team: \n" +"Language: \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 +#: model:ir.model,name:product_replenishment_cost.model_product_product +msgid "Product Variant" +msgstr "" + +#. module: product_replenishment_cost +#: model:ir.model.fields,field_description:product_replenishment_cost.field_product_product__replenishment_cost +msgid "Replenishment cost" +msgstr "Kostprijs (incl. kosten)" + +#. module: product_replenishment_cost +#: model:ir.model.fields,help:product_replenishment_cost.field_product_product__replenishment_cost +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 "Dit is de kostprijs, inclusief eventuele kosten." + +#~ msgid "Product" +#~ msgstr "Product" diff --git a/product_replenishment_cost/i18n/product_replenishment_cost.pot b/product_replenishment_cost/i18n/product_replenishment_cost.pot new file mode 100644 index 000000000..5ba675bf0 --- /dev/null +++ b/product_replenishment_cost/i18n/product_replenishment_cost.pot @@ -0,0 +1,33 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_replenishment_cost +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \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 +#: model:ir.model,name:product_replenishment_cost.model_product_product +msgid "Product Variant" +msgstr "" + +#. module: product_replenishment_cost +#: model:ir.model.fields,field_description:product_replenishment_cost.field_product_product__replenishment_cost +msgid "Replenishment cost" +msgstr "" + +#. module: product_replenishment_cost +#: model:ir.model.fields,help:product_replenishment_cost.field_product_product__replenishment_cost +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 "" diff --git a/product_replenishment_cost/i18n/pt.po b/product_replenishment_cost/i18n/pt.po new file mode 100644 index 000000000..5eda83d72 --- /dev/null +++ b/product_replenishment_cost/i18n/pt.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_replenishment_cost +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-04-12 16:46+0000\n" +"Last-Translator: alvarorib \n" +"Language-Team: none\n" +"Language: pt\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: product_replenishment_cost +#: model:ir.model,name:product_replenishment_cost.model_product_product +msgid "Product Variant" +msgstr "" + +#. module: product_replenishment_cost +#: model:ir.model.fields,field_description:product_replenishment_cost.field_product_product__replenishment_cost +msgid "Replenishment cost" +msgstr "Custo de Reposição" + +#. module: product_replenishment_cost +#: model:ir.model.fields,help:product_replenishment_cost.field_product_product__replenishment_cost +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 "" +"O custo que deverá suportar para produzir ou adquirir os bens. Dependendo " +"dos módulos instalados, esse custo pode ser calculado com base em várias " +"informações, por exemplo, listas de materiais ou compras mais recentes. Por " +"pré definição, o custo de Reposição é igual ao Preço de custo." + +#~ msgid "Product" +#~ msgstr "Produto" diff --git a/product_replenishment_cost/i18n/pt_BR.po b/product_replenishment_cost/i18n/pt_BR.po new file mode 100644 index 000000000..1e3e4fc8c --- /dev/null +++ b/product_replenishment_cost/i18n/pt_BR.po @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_replenishment_cost +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-05-21 20:34+0000\n" +"Last-Translator: Rodrigo Macedo \n" +"Language-Team: none\n" +"Language: pt_BR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: product_replenishment_cost +#: model:ir.model,name:product_replenishment_cost.model_product_product +msgid "Product Variant" +msgstr "Variante do Produto" + +#. module: product_replenishment_cost +#: model:ir.model.fields,field_description:product_replenishment_cost.field_product_product__replenishment_cost +msgid "Replenishment cost" +msgstr "Custo de reposição" + +#. module: product_replenishment_cost +#: model:ir.model.fields,help:product_replenishment_cost.field_product_product__replenishment_cost +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 "" +"O custo que você deve suportar para produzir ou adquirir os bens. Dependendo " +"dos módulos instalados, este custo pode ser calculado com base em diversas " +"informações, por exemplo Listas de Materiais ou Últimas Compras. Por padrão, " +"o custo de reabastecimento é igual ao preço de custo." diff --git a/product_replenishment_cost/i18n/zh_CN.po b/product_replenishment_cost/i18n/zh_CN.po new file mode 100644 index 000000000..ba50a5379 --- /dev/null +++ b/product_replenishment_cost/i18n/zh_CN.po @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_replenishment_cost +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2019-09-18 19:24+0000\n" +"Last-Translator: 黎伟杰 <674416404@qq.com>\n" +"Language-Team: none\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 3.8\n" + +#. module: product_replenishment_cost +#: model:ir.model,name:product_replenishment_cost.model_product_product +msgid "Product Variant" +msgstr "" + +#. module: product_replenishment_cost +#: model:ir.model.fields,field_description:product_replenishment_cost.field_product_product__replenishment_cost +msgid "Replenishment cost" +msgstr "补货成本" + +#. module: product_replenishment_cost +#: model:ir.model.fields,help:product_replenishment_cost.field_product_product__replenishment_cost +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 "" +"为生产或获得货物而必须支付的费用。根据安装的模块,此成本可根据各种信息(例如" +"物料清单或最新采购)计算。默认情况下,补货成本与成本价相同。" + +#~ msgid "Product" +#~ msgstr "产品" diff --git a/product_replenishment_cost/models/__init__.py b/product_replenishment_cost/models/__init__.py new file mode 100644 index 000000000..5c74c8c30 --- /dev/null +++ b/product_replenishment_cost/models/__init__.py @@ -0,0 +1 @@ +from . import product_product diff --git a/product_replenishment_cost/models/product_product.py b/product_replenishment_cost/models/product_product.py new file mode 100644 index 000000000..78007a708 --- /dev/null +++ b/product_replenishment_cost/models/product_product.py @@ -0,0 +1,30 @@ +# Copyright (C) 2012 - Today: Camptocamp SA +# Copyright (C) 2016 - Today: GRAP (http://www.grap.coop) +# @author: Alexandre Fayolle +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + + +from odoo import api, fields +from odoo.models import Model + + +class ProductProduct(Model): + _inherit = "product.product" + + @api.depends("product_tmpl_id.standard_price", "standard_price") + def _compute_replenishment_cost(self): + for product in self: + product.replenishment_cost = product.standard_price + + replenishment_cost = fields.Float( + string="Replenishment cost", + compute="_compute_replenishment_cost", + store=True, + digits="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.", + ) diff --git a/product_replenishment_cost/pyproject.toml b/product_replenishment_cost/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/product_replenishment_cost/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/product_replenishment_cost/readme/CONTRIBUTORS.md b/product_replenishment_cost/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..f4860f40a --- /dev/null +++ b/product_replenishment_cost/readme/CONTRIBUTORS.md @@ -0,0 +1,7 @@ +- Alexandre Fayolle \<\> +- Yannick Vaucher \<\> +- Joël Grand-Guillaume \<\> +- Sylvain Le Gal () +- Marc Poch Mallandrich \<\> +- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io) + - Bhavesh Heliconia diff --git a/product_replenishment_cost/readme/DESCRIPTION.md b/product_replenishment_cost/readme/DESCRIPTION.md new file mode 100644 index 000000000..720270c5a --- /dev/null +++ b/product_replenishment_cost/readme/DESCRIPTION.md @@ -0,0 +1,22 @@ +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. + +"Cost price" is the cost assigned for each product in the warehouse and +the "Replenishment cost" is the cost it would cost to buy a new product. +They are different costs because the cost price depends on your +valuation method and the operations you have performed while the +replenishment cost is determined by the current market conditions. + +For example: The price of the product in the supplier's catalog is +€15/piece. Therefore, if I want to buy a new unit, my replenishment cost +would be €15. But if my stock comes from having bought it in a special +offer that allowed me to buy it for €10, then my cost price is +€10/piece. + +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. diff --git a/product_replenishment_cost/readme/ROADMAP.md b/product_replenishment_cost/readme/ROADMAP.md new file mode 100644 index 000000000..6dda61fa8 --- /dev/null +++ b/product_replenishment_cost/readme/ROADMAP.md @@ -0,0 +1,6 @@ +Due to framework limitation, the field `replenishment_cost` is not +company dependent, while `standard_price` is. (in the recent Odoo +versions) + +It is due to the current impossibility to make working computed field +between two field `company_dependent=True`. diff --git a/product_replenishment_cost/static/description/icon.png b/product_replenishment_cost/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/product_replenishment_cost/static/description/icon.png differ diff --git a/product_replenishment_cost/static/description/index.html b/product_replenishment_cost/static/description/index.html new file mode 100644 index 000000000..f2e68776d --- /dev/null +++ b/product_replenishment_cost/static/description/index.html @@ -0,0 +1,458 @@ + + + + + +Product Replenishment Cost + + + +
+

Product Replenishment Cost

+ + +

Beta License: AGPL-3 OCA/margin-analysis Translate me on Weblate Try me on Runboat

+

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.

+

“Cost price” is the cost assigned for each product in the warehouse and +the “Replenishment cost” is the cost it would cost to buy a new product. +They are different costs because the cost price depends on your +valuation method and the operations you have performed while the +replenishment cost is determined by the current market conditions.

+

For example: The price of the product in the supplier’s catalog is +€15/piece. Therefore, if I want to buy a new unit, my replenishment cost +would be €15. But if my stock comes from having bought it in a special +offer that allowed me to buy it for €10, then my cost price is +€10/piece.

+

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.

+

Table of contents

+ +
+

Known issues / Roadmap

+

Due to framework limitation, the field replenishment_cost is not +company dependent, while standard_price is. (in the recent Odoo +versions)

+

It is due to the current impossibility to make working computed field +between two field company_dependent=True.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp
  • +
  • GRAP
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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.

+

This module is part of the OCA/margin-analysis project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/product_replenishment_cost/tests/__init__.py b/product_replenishment_cost/tests/__init__.py new file mode 100644 index 000000000..d9b96c4fa --- /dev/null +++ b/product_replenishment_cost/tests/__init__.py @@ -0,0 +1 @@ +from . import test_module diff --git a/product_replenishment_cost/tests/test_module.py b/product_replenishment_cost/tests/test_module.py new file mode 100644 index 000000000..9b17804f4 --- /dev/null +++ b/product_replenishment_cost/tests/test_module.py @@ -0,0 +1,32 @@ +# Copyright (C) 2019 - Today: GRAP (http://www.grap.coop) +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo.addons.base.tests.common import BaseCommon + + +class TestModule(BaseCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.ProductProduct = cls.env["product.product"] + + # Test Section + def test_create_or_update(self): + # Test compute on creation + product = self.ProductProduct.create( + { + "name": "Wine A01", + "standard_price": 50, + } + ) + self.assertEqual(product.replenishment_cost, 50.0) + + # Test Update + product.standard_price = 70.0 + + self.assertEqual(product.replenishment_cost, 70.0) + + # Test Update via template + product.product_tmpl_id.standard_price = 100.0 + self.assertEqual(product.replenishment_cost, 100.0) diff --git a/product_replenishment_cost/views/product_view.xml b/product_replenishment_cost/views/product_view.xml new file mode 100644 index 000000000..f803787f9 --- /dev/null +++ b/product_replenishment_cost/views/product_view.xml @@ -0,0 +1,17 @@ + + + + + product.product + + + + + + + + +