diff --git a/mrp_bom_product_price_margin/README.rst b/mrp_bom_product_price_margin/README.rst index 2a320e5a7..ae4c2c87b 100644 --- a/mrp_bom_product_price_margin/README.rst +++ b/mrp_bom_product_price_margin/README.rst @@ -7,7 +7,7 @@ MRP BoM Product Price Margin !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:aa37e05e4d2c66e364b2d427982b676b8f8dab4171dca239ab8a992ae5eeae62 + !! source digest: sha256:29d32daaf1104aac3d5d6277b0370d603872ee94f8cb9a9c8f5a2d185fb54cbf !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -28,7 +28,7 @@ MRP BoM Product Price Margin |badge1| |badge2| |badge3| |badge4| |badge5| -Help handling cost and sale price of product variant linked to bill of material. +Help handling cost and sale price of product template linked to bill of material. **Table of contents** @@ -38,13 +38,12 @@ Help handling cost and sale price of product variant linked to bill of material. Usage ===== -Set Product Variant in your Bill of Material. Change BoM quantity or BoM lines quantity or price in one component. -See new panel to change Product Variant Standard Price. +See new panel to change Product Standard Price. - .. figure:: https://raw.githubusercontent.com/OCA/manufacture/16.0/mrp_bom_product_price_margin/static/mrp_bom_product_price_margin_diff.png + .. figure:: https://raw.githubusercontent.com/OCA/manufacture/16.0/mrp_bom_product_price_margin/static/mrp_bom_product_price_margin_diff.jpeg - .. figure:: https://raw.githubusercontent.com/OCA/manufacture/16.0/mrp_bom_product_price_margin/static/mrp_bom_product_price_margin_no_diff.png + .. figure:: https://raw.githubusercontent.com/OCA/manufacture/16.0/mrp_bom_product_price_margin/static/mrp_bom_product_price_margin_no_diff.jpeg In tree view, quickly see difference between Product standard price and BoM cost. You can also change Product standard price here diff --git a/mrp_bom_product_price_margin/i18n/fr.po b/mrp_bom_product_price_margin/i18n/fr.po index e8c614bb0..00da10e59 100644 --- a/mrp_bom_product_price_margin/i18n/fr.po +++ b/mrp_bom_product_price_margin/i18n/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-11 15:59+0000\n" -"PO-Revision-Date: 2024-03-11 15:59+0000\n" +"POT-Creation-Date: 2024-11-08 13:58+0000\n" +"PO-Revision-Date: 2024-11-08 13:58+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -17,8 +17,8 @@ msgstr "" #. module: mrp_bom_product_price_margin #: model_terms:ir.ui.view,arch_db:mrp_bom_product_price_margin.view_mrp_bom_sale_product_margin_form -msgid " (for 1x" -msgstr " (pour 1x" +msgid "(for 1x" +msgstr "(pour 1x" #. module: mrp_bom_product_price_margin #: model_terms:ir.ui.view,arch_db:mrp_bom_product_price_margin.view_mrp_bom_sale_product_margin_form @@ -30,11 +30,20 @@ msgstr "(marge" msgid "(margin:" msgstr "(marge :" +#. module: mrp_bom_product_price_margin +#: model_terms:ir.ui.view,arch_db:mrp_bom_product_price_margin.view_mrp_bom_sale_product_margin_form +msgid "" +").
\n" +" Product sale price:" +msgstr "" +").
\n" +" Prix de vente du produit :" + #. module: mrp_bom_product_price_margin #: model_terms:ir.ui.view,arch_db:mrp_bom_product_price_margin.view_mrp_bom_sale_product_margin_form msgid "" "
\n" -" Product variant cost :" +" Product cost :" msgstr "" "
\n" " Coût du produit :" @@ -43,7 +52,7 @@ msgstr "" #: model_terms:ir.ui.view,arch_db:mrp_bom_product_price_margin.view_mrp_bom_sale_product_margin_form msgid "" "
\n" -" Product variant sale price:" +" Product sale price:" msgstr "" "
\n" " Prix de vente du produit :" @@ -77,7 +86,7 @@ msgstr "" "nomenclature." #. module: mrp_bom_product_price_margin -#: model:ir.model.fields,field_description:mrp_bom_product_price_margin.field_product_product__standard_price +#: model:ir.model.fields,field_description:mrp_bom_product_price_margin.field_product_template__standard_price msgid "Cost" msgstr "Coût" @@ -85,7 +94,7 @@ msgstr "Coût" #: model:ir.model.fields,field_description:mrp_bom_product_price_margin.field_mrp_bom__currency_id #: model:ir.model.fields,field_description:mrp_bom_product_price_margin.field_mrp_bom_line__currency_id msgid "Currency" -msgstr "" +msgstr "Devise" #. module: mrp_bom_product_price_margin #: model_terms:ir.ui.view,arch_db:mrp_bom_product_price_margin.view_mrp_bom_tree @@ -98,7 +107,7 @@ msgid "Diff Product Bom Standard Price" msgstr "" #. module: mrp_bom_product_price_margin -#: model:ir.model.fields,help:mrp_bom_product_price_margin.field_product_product__standard_price +#: model:ir.model.fields,help:mrp_bom_product_price_margin.field_product_template__standard_price msgid "" "In Standard Price & AVCO: value of the product (automatically computed in AVCO).\n" " In FIFO: value of the next unit that will leave the stock (automatically computed).\n" @@ -113,17 +122,32 @@ msgstr "" #. module: mrp_bom_product_price_margin #: model_terms:ir.ui.view,arch_db:mrp_bom_product_price_margin.view_mrp_bom_sale_product_margin_form #: model_terms:ir.ui.view,arch_db:mrp_bom_product_price_margin.view_mrp_bom_tree -msgid "It will set product variant's standard price with this price" +msgid "It will set Product's standard price with this price" msgstr "Cela définira le coût du Produit avec ce total." +#. module: mrp_bom_product_price_margin +#: model:ir.model.fields,field_description:mrp_bom_product_price_margin.field_mrp_bom__product_margin_rate +msgid "Margin (%)" +msgstr "Marge théorique (%)" + #. module: mrp_bom_product_price_margin #: model:ir.model.fields,help:mrp_bom_product_price_margin.field_mrp_bom__product_margin_rate msgid "" -"Margin rate is [ Theorical Margin / sale price (Wo Tax) ] of the product " -"form (not based on historical values).Take care of tax include and exclude.." -" If no sale price set, will display 999.0" +"Margin rate is [ Margin / sale price (Wo Tax) ] of the product form (not " +"based on historical values).Take care of tax include and exclude.. If no " +"sale price set, will display 999.0" msgstr "" +#. module: mrp_bom_product_price_margin +#: model:ir.model.fields,help:mrp_bom_product_price_margin.field_mrp_bom__product_sale_price +msgid "Price at which the product is sold to customers." +msgstr "" + +#. module: mrp_bom_product_price_margin +#: model:ir.model,name:mrp_bom_product_price_margin.model_product_template +msgid "Product" +msgstr "Produit" + #. module: mrp_bom_product_price_margin #: model:ir.model.fields,field_description:mrp_bom_product_price_margin.field_mrp_bom__product_margin_rate_percentage msgid "Product Margin" @@ -139,19 +163,10 @@ msgstr "Produit - Prix de vente" msgid "Product Standard Price" msgstr "Produit - Coût" -#. module: mrp_bom_product_price_margin -#: model:ir.model,name:mrp_bom_product_price_margin.model_product_product -msgid "Product Variant" -msgstr "Variante de produit" - #. module: mrp_bom_product_price_margin #: model_terms:ir.ui.view,arch_db:mrp_bom_product_price_margin.view_mrp_bom_sale_product_margin_form -msgid "" -"Product cost is based on this Bill of Material.
\n" -" Product variant sale price:" -msgstr "" -"Le coût du Produit est basé sur cette Nomenclature.
\n" -" Prix de vente du produit :" +msgid "Product cost is based on the cost of this Bill of Material (" +msgstr "Le coût du Produit est basé sur le coût de cette Nomenclature (" #. module: mrp_bom_product_price_margin #: model_terms:ir.ui.view,arch_db:mrp_bom_product_price_margin.view_mrp_bom_sale_product_margin_form @@ -173,18 +188,6 @@ msgstr "Sous-total" msgid "Subtotal price %" msgstr "Sous-total %" -#. module: mrp_bom_product_price_margin -#: model:ir.model.fields,help:mrp_bom_product_price_margin.field_mrp_bom__product_sale_price -msgid "" -"The sale price is managed from the product template. Click on the 'Configure" -" Variants' button to set the extra attribute prices." -msgstr "" - -#. module: mrp_bom_product_price_margin -#: model:ir.model.fields,field_description:mrp_bom_product_price_margin.field_mrp_bom__product_margin_rate -msgid "Theorical Margin (%)" -msgstr "Marge théorique (%)" - #. module: mrp_bom_product_price_margin #: model_terms:ir.ui.view,arch_db:mrp_bom_product_price_margin.view_mrp_bom_sale_product_margin_form msgid "Total" @@ -202,5 +205,5 @@ msgstr "pour 1x" #. module: mrp_bom_product_price_margin #: model_terms:ir.ui.view,arch_db:mrp_bom_product_price_margin.view_mrp_bom_sale_product_margin_form -msgid "⇙ Apply this cost to Product variant standard price" -msgstr "⇙ Définir le coût du Produit avec ce prix." +msgid "⇙ Apply this cost to Product standard price" +msgstr "⇙ Définir le coût du Produit avec ce prix." \ No newline at end of file diff --git a/mrp_bom_product_price_margin/models/__init__.py b/mrp_bom_product_price_margin/models/__init__.py index 177a1fbc4..d6c08450b 100644 --- a/mrp_bom_product_price_margin/models/__init__.py +++ b/mrp_bom_product_price_margin/models/__init__.py @@ -1,3 +1,3 @@ from . import mrp_bom from . import mrp_bom_line -from . import product_product +from . import product_template diff --git a/mrp_bom_product_price_margin/models/mrp_bom.py b/mrp_bom_product_price_margin/models/mrp_bom.py index 4d8717cf6..982769afc 100644 --- a/mrp_bom_product_price_margin/models/mrp_bom.py +++ b/mrp_bom_product_price_margin/models/mrp_bom.py @@ -27,20 +27,20 @@ class MrpBom(models.Model): # Fields related to sale price product_sale_price = fields.Float( - string="Product Sale Price", related="product_id.lst_price" + string="Product Sale Price", related="product_tmpl_id.list_price" ) - product_margin_rate = fields.Float(related="product_id.standard_margin_rate") + product_margin_rate = fields.Float(related="product_tmpl_id.standard_margin_rate") product_margin_rate_percentage = fields.Float( string="Product Margin", compute="_compute_product_margin_rate_percentage" ) # Compute functions - @api.depends("product_id", "product_id.standard_price") + @api.depends("product_tmpl_id", "product_tmpl_id.standard_price") def _compute_product_standard_price(self): for bom in self: - bom.product_standard_price = bom.product_id.standard_price + bom.product_standard_price = bom.product_tmpl_id.standard_price - @api.depends("product_id", "bom_line_ids", "product_qty") + @api.depends("product_tmpl_id", "bom_line_ids", "product_qty") def _compute_standard_price(self): for bom in self: qty_to_divide = bom.product_qty if bom.product_qty != 0 else 1 @@ -48,12 +48,12 @@ class MrpBom(models.Model): sum(x.standard_price_subtotal for x in bom.bom_line_ids) / qty_to_divide ) - @api.depends("product_id.standard_price", "standard_price") + @api.depends("product_tmpl_id.standard_price", "standard_price") def _compute_diff_product_bom_standard_price(self): price_dp = self.env["decimal.precision"].precision_get("Product Price") for bom in self: - if bom.product_id: - diff = bom.product_id.standard_price - bom.standard_price + if bom.product_tmpl_id: + diff = bom.product_tmpl_id.standard_price - bom.standard_price bom.diff_product_bom_standard_price = float_round(diff, price_dp) else: bom.diff_product_bom_standard_price = False @@ -65,5 +65,5 @@ class MrpBom(models.Model): # Functions to change product fields def set_product_standard_price(self): - for bom in self.filtered(lambda x: x.product_id): - bom.product_id.standard_price = bom.standard_price + for bom in self.filtered(lambda x: x.product_tmpl_id): + bom.product_tmpl_id.standard_price = bom.standard_price diff --git a/mrp_bom_product_price_margin/models/product_product.py b/mrp_bom_product_price_margin/models/product_template.py similarity index 63% rename from mrp_bom_product_price_margin/models/product_product.py rename to mrp_bom_product_price_margin/models/product_template.py index 2d184bfc5..27e764b8d 100644 --- a/mrp_bom_product_price_margin/models/product_product.py +++ b/mrp_bom_product_price_margin/models/product_template.py @@ -1,12 +1,12 @@ -# Copyright (C) 2022 - Today: GRAP (http://www.grap.coop) +# Copyright (C) 2024 - Today: GRAP (http://www.grap.coop) # @author: Quentin DUPONT (quentin.dupont@grap.coop) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import fields, models -class ProductProduct(models.Model): - _inherit = "product.product" +class ProductTemplate(models.Model): + _inherit = "product.template" standard_price = fields.Float( tracking=True, diff --git a/mrp_bom_product_price_margin/readme/DESCRIPTION.rst b/mrp_bom_product_price_margin/readme/DESCRIPTION.rst index dec750e9a..1625b5855 100644 --- a/mrp_bom_product_price_margin/readme/DESCRIPTION.rst +++ b/mrp_bom_product_price_margin/readme/DESCRIPTION.rst @@ -1 +1 @@ -Help handling cost and sale price of product variant linked to bill of material. +Help handling cost and sale price of product template linked to bill of material. diff --git a/mrp_bom_product_price_margin/readme/USAGE.rst b/mrp_bom_product_price_margin/readme/USAGE.rst index baf6e8467..33f61016b 100644 --- a/mrp_bom_product_price_margin/readme/USAGE.rst +++ b/mrp_bom_product_price_margin/readme/USAGE.rst @@ -1,10 +1,9 @@ -Set Product Variant in your Bill of Material. Change BoM quantity or BoM lines quantity or price in one component. -See new panel to change Product Variant Standard Price. +See new panel to change Product Standard Price. - .. figure:: ../static/mrp_bom_product_price_margin_diff.png + .. figure:: ../static/mrp_bom_product_price_margin_diff.jpeg - .. figure:: ../static/mrp_bom_product_price_margin_no_diff.png + .. figure:: ../static/mrp_bom_product_price_margin_no_diff.jpeg In tree view, quickly see difference between Product standard price and BoM cost. You can also change Product standard price here diff --git a/mrp_bom_product_price_margin/static/description/index.html b/mrp_bom_product_price_margin/static/description/index.html index 7ed53ba7b..07b3fbd7b 100644 --- a/mrp_bom_product_price_margin/static/description/index.html +++ b/mrp_bom_product_price_margin/static/description/index.html @@ -9,10 +9,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -275,7 +276,7 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code { margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -301,7 +302,7 @@ span.option { span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -367,10 +368,10 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:aa37e05e4d2c66e364b2d427982b676b8f8dab4171dca239ab8a992ae5eeae62 +!! source digest: sha256:29d32daaf1104aac3d5d6277b0370d603872ee94f8cb9a9c8f5a2d185fb54cbf !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

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

-

Help handling cost and sale price of product variant linked to bill of material.

+

Help handling cost and sale price of product template linked to bill of material.

Table of contents

Usage

-

Set Product Variant in your Bill of Material. -Change BoM quantity or BoM lines quantity or price in one component. -See new panel to change Product Variant Standard Price.

+

Change BoM quantity or BoM lines quantity or price in one component. +See new panel to change Product Standard Price.

-https://raw.githubusercontent.com/OCA/manufacture/16.0/mrp_bom_product_price_margin/static/mrp_bom_product_price_margin_diff.png +https://raw.githubusercontent.com/OCA/manufacture/16.0/mrp_bom_product_price_margin/static/mrp_bom_product_price_margin_diff.jpeg
-https://raw.githubusercontent.com/OCA/manufacture/16.0/mrp_bom_product_price_margin/static/mrp_bom_product_price_margin_no_diff.png +https://raw.githubusercontent.com/OCA/manufacture/16.0/mrp_bom_product_price_margin/static/mrp_bom_product_price_margin_no_diff.jpeg

In tree view, quickly see difference between Product standard price and BoM cost. @@ -429,7 +429,9 @@ If you spotted it first, help us to smash it by providing a detailed and welcome

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +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.

diff --git a/mrp_bom_product_price_margin/static/mrp_bom_product_price_margin_diff.jpeg b/mrp_bom_product_price_margin/static/mrp_bom_product_price_margin_diff.jpeg new file mode 100644 index 000000000..db08da395 Binary files /dev/null and b/mrp_bom_product_price_margin/static/mrp_bom_product_price_margin_diff.jpeg differ diff --git a/mrp_bom_product_price_margin/static/mrp_bom_product_price_margin_diff.png b/mrp_bom_product_price_margin/static/mrp_bom_product_price_margin_diff.png deleted file mode 100644 index 4686879cd..000000000 Binary files a/mrp_bom_product_price_margin/static/mrp_bom_product_price_margin_diff.png and /dev/null differ diff --git a/mrp_bom_product_price_margin/static/mrp_bom_product_price_margin_no_diff.jpeg b/mrp_bom_product_price_margin/static/mrp_bom_product_price_margin_no_diff.jpeg new file mode 100644 index 000000000..e4276304d Binary files /dev/null and b/mrp_bom_product_price_margin/static/mrp_bom_product_price_margin_no_diff.jpeg differ diff --git a/mrp_bom_product_price_margin/static/mrp_bom_product_price_margin_no_diff.png b/mrp_bom_product_price_margin/static/mrp_bom_product_price_margin_no_diff.png deleted file mode 100644 index 747ddd97d..000000000 Binary files a/mrp_bom_product_price_margin/static/mrp_bom_product_price_margin_no_diff.png and /dev/null differ diff --git a/mrp_bom_product_price_margin/tests/test_mrp_bom_sale_margin.py b/mrp_bom_product_price_margin/tests/test_mrp_bom_sale_margin.py index b74bdb7e4..6f1655c03 100644 --- a/mrp_bom_product_price_margin/tests/test_mrp_bom_sale_margin.py +++ b/mrp_bom_product_price_margin/tests/test_mrp_bom_sale_margin.py @@ -8,15 +8,17 @@ from odoo.tests.common import TransactionCase class TestMrpBomSaleMargin(TransactionCase): def setUp(self): super(TestMrpBomSaleMargin, self).setUp() - self.bom_desk = self.env.ref("mrp.mrp_bom_desk") - self.product_computer_desk = self.env.ref("mrp.product_product_computer_desk") + self.bom_desk = self.env.ref("mrp.mrp_bom_desk") # [FURN_9666] Table + self.product_computer_desk = self.env.ref( + "mrp.product_product_computer_desk_product_template" + ) def test_01_bom_product_product_set_cost(self): # Set product product - self.bom_desk.product_id = self.product_computer_desk + self.bom_desk.product_tmpl_id = self.product_computer_desk self.assertNotEqual( self.bom_desk.standard_price, - self.bom_desk.product_id.standard_price, + self.bom_desk.product_tmpl_id.standard_price, ) self.assertNotEqual( self.bom_desk.diff_product_bom_standard_price, @@ -30,5 +32,5 @@ class TestMrpBomSaleMargin(TransactionCase): ) self.assertEqual( self.bom_desk.standard_price, - self.bom_desk.product_id.standard_price, + self.bom_desk.product_tmpl_id.standard_price, ) diff --git a/mrp_bom_product_price_margin/views/view_mrp_bom.xml b/mrp_bom_product_price_margin/views/view_mrp_bom.xml index bd70d3f98..ad820cd01 100644 --- a/mrp_bom_product_price_margin/views/view_mrp_bom.xml +++ b/mrp_bom_product_price_margin/views/view_mrp_bom.xml @@ -31,18 +31,18 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). />)