diff --git a/product_pricelist_simulation_margin/README.rst b/product_pricelist_simulation_margin/README.rst new file mode 100644 index 00000000000..de33afcc44a --- /dev/null +++ b/product_pricelist_simulation_margin/README.rst @@ -0,0 +1,115 @@ +=================================== +Product Pricelist Simulation Margin +=================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:cd434080f349c39b1a5fe08ed404def07b49dc3ee8b70f549a2dcd707deae15b + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fproduct--attribute-lightgray.png?logo=github + :target: https://github.com/OCA/product-attribute/tree/17.0/product_pricelist_simulation_margin + :alt: OCA/product-attribute +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/product-attribute-17-0/product-attribute-17-0-product_pricelist_simulation_margin + :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/product-attribute&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module is designed to extend Product Module in Odoo to preview +product margin depending on the different pricelists. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +- Go to "Sale > Products > Products" + +- Open a product form + +- on the button incorporated in the module +https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/ https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/ https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/ https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/'https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/phttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/rhttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/ohttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/dhttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/uhttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/chttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/thttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/_https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/phttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/rhttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/ihttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/chttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/ehttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/lhttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/ihttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/shttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/thttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/_https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/shttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/ihttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/mhttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/uhttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/lhttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/ahttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/thttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/ihttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/ohttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/nhttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/'https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/ https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/.https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/.https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/ https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/ihttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/mhttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/ahttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/ghttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/ehttps://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/:https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/:https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/ +https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/ ../static/description/product_template_form.png + +- Click on the button, and check if the margins are correct + + |image| + +- you can optionnaly change date, or quantity, if you have complex + pricelist depending on such parameters. + +.. |image| image:: https://raw.githubusercontent.com/OCA/product-attribute/17.0/product_pricelist_simulation_margin/static/description/wizard_preview_pricelist_margin_form.png + +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 +------- + +* FactorLibre + +Contributors +------------ + +- Sylvain LE GAL +- Hugo Córdoba - FactorLibre +- Khoi (Kien Kim) + +Other credits +------------- + +The migration of this module from 16.0 to 17.0 was financially supported +by: + +- Camptocamp + +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. + +.. |maintainer-legalsylvain| image:: https://github.com/legalsylvain.png?size=40px + :target: https://github.com/legalsylvain + :alt: legalsylvain + +Current `maintainer `__: + +|maintainer-legalsylvain| + +This module is part of the `OCA/product-attribute `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/product_pricelist_simulation_margin/__init__.py b/product_pricelist_simulation_margin/__init__.py new file mode 100644 index 00000000000..5cb1c49143f --- /dev/null +++ b/product_pricelist_simulation_margin/__init__.py @@ -0,0 +1 @@ +from . import wizards diff --git a/product_pricelist_simulation_margin/__manifest__.py b/product_pricelist_simulation_margin/__manifest__.py new file mode 100644 index 00000000000..26b82a25686 --- /dev/null +++ b/product_pricelist_simulation_margin/__manifest__.py @@ -0,0 +1,23 @@ +# Copyright 2023 FactorLibre - Hugo Córdoba (hugo.cordoba@factorlibre.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +{ + "name": "Product Pricelist Simulation Margin", + "summary": "Add margin of product price for all pricelists", + "version": "17.0.1.0.1", + "category": "Product", + "website": "https://github.com/OCA/product-attribute", + "author": "Odoo Community Association (OCA), FactorLibre", + "maintainers": ["legalsylvain"], + "license": "AGPL-3", + "application": False, + "installable": True, + "depends": [ + "account", + "product_pricelist_simulation", + ], + "data": [ + "security/ir.model.access.csv", + "wizards/wizard_preview_pricelist_views.xml", + ], +} diff --git a/product_pricelist_simulation_margin/i18n/es.po b/product_pricelist_simulation_margin/i18n/es.po new file mode 100644 index 00000000000..e42a7982fd6 --- /dev/null +++ b/product_pricelist_simulation_margin/i18n/es.po @@ -0,0 +1,53 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_pricelist_simulation_margin +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-06-19 09:16+0000\n" +"PO-Revision-Date: 2023-08-29 08:30+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_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist__standard_price +msgid "Cost" +msgstr "Coste" + +#. module: product_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist_line__margin +msgid "Margin" +msgstr "Margen" + +#. module: product_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist_line__margin_percent +msgid "Margin (%)" +msgstr "Margen (%)" + +#. module: product_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist_line__price_vat_excl +msgid "Unit Sales Price (Excl.)" +msgstr "Precio de venta unitario (Excl.)" + +#. module: product_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist_line__price_vat_incl +msgid "Unit Sales Price (Incl.)" +msgstr "Precio de venta unitario (Incl.)" + +#. module: product_pricelist_simulation_margin +#: model:ir.model,name:product_pricelist_simulation_margin.model_wizard_preview_pricelist +msgid "wizard - Preview Pricelist" +msgstr "asistente - Vista previa de la Lista de Precios" + +#. module: product_pricelist_simulation_margin +#: model:ir.model,name:product_pricelist_simulation_margin.model_wizard_preview_pricelist_line +msgid "wizard - Preview Pricelist Line" +msgstr "asistente - Vista previa de línea de lista de precios" diff --git a/product_pricelist_simulation_margin/i18n/fr.po b/product_pricelist_simulation_margin/i18n/fr.po new file mode 100644 index 00000000000..b65cdfce1e8 --- /dev/null +++ b/product_pricelist_simulation_margin/i18n/fr.po @@ -0,0 +1,52 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_pricelist_simulation_margin +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-10-30 10:06+0000\n" +"Last-Translator: Sandie FAVRE \n" +"Language-Team: none\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 5.6.2\n" + +#. module: product_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist__standard_price +msgid "Cost" +msgstr "Coût" + +#. module: product_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist_line__margin +msgid "Margin" +msgstr "Marge" + +#. module: product_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist_line__margin_percent +msgid "Margin (%)" +msgstr "Taux de marque (%)" + +#. module: product_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist_line__price_vat_excl +msgid "Unit Sales Price (Excl.)" +msgstr "Prix unitaire (HT)" + +#. module: product_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist_line__price_vat_incl +msgid "Unit Sales Price (Incl.)" +msgstr "Prix unitaire (TTC)" + +#. module: product_pricelist_simulation_margin +#: model:ir.model,name:product_pricelist_simulation_margin.model_wizard_preview_pricelist +msgid "wizard - Preview Pricelist" +msgstr "" + +#. module: product_pricelist_simulation_margin +#: model:ir.model,name:product_pricelist_simulation_margin.model_wizard_preview_pricelist_line +msgid "wizard - Preview Pricelist Line" +msgstr "" diff --git a/product_pricelist_simulation_margin/i18n/it.po b/product_pricelist_simulation_margin/i18n/it.po new file mode 100644 index 00000000000..f1d7c904bca --- /dev/null +++ b/product_pricelist_simulation_margin/i18n/it.po @@ -0,0 +1,52 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_pricelist_simulation_margin +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-10-29 15:40+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_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist__standard_price +msgid "Cost" +msgstr "Costo" + +#. module: product_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist_line__margin +msgid "Margin" +msgstr "Margine" + +#. module: product_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist_line__margin_percent +msgid "Margin (%)" +msgstr "Margine (%)" + +#. module: product_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist_line__price_vat_excl +msgid "Unit Sales Price (Excl.)" +msgstr "Prezzo di vendita unitario (esclusa)" + +#. module: product_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist_line__price_vat_incl +msgid "Unit Sales Price (Incl.)" +msgstr "Prezzo vendita unitario (inclusa)" + +#. module: product_pricelist_simulation_margin +#: model:ir.model,name:product_pricelist_simulation_margin.model_wizard_preview_pricelist +msgid "wizard - Preview Pricelist" +msgstr "procedura quidata - anteprima listino" + +#. module: product_pricelist_simulation_margin +#: model:ir.model,name:product_pricelist_simulation_margin.model_wizard_preview_pricelist_line +msgid "wizard - Preview Pricelist Line" +msgstr "procedura quidata - riga anteprima listino" diff --git a/product_pricelist_simulation_margin/i18n/product_pricelist_simulation_margin.pot b/product_pricelist_simulation_margin/i18n/product_pricelist_simulation_margin.pot new file mode 100644 index 00000000000..d479574fa6c --- /dev/null +++ b/product_pricelist_simulation_margin/i18n/product_pricelist_simulation_margin.pot @@ -0,0 +1,49 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_pricelist_simulation_margin +# +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_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist__standard_price +msgid "Cost" +msgstr "" + +#. module: product_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist_line__margin +msgid "Margin" +msgstr "" + +#. module: product_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist_line__margin_percent +msgid "Margin (%)" +msgstr "" + +#. module: product_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist_line__price_vat_excl +msgid "Unit Sales Price (Excl.)" +msgstr "" + +#. module: product_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist_line__price_vat_incl +msgid "Unit Sales Price (Incl.)" +msgstr "" + +#. module: product_pricelist_simulation_margin +#: model:ir.model,name:product_pricelist_simulation_margin.model_wizard_preview_pricelist +msgid "wizard - Preview Pricelist" +msgstr "" + +#. module: product_pricelist_simulation_margin +#: model:ir.model,name:product_pricelist_simulation_margin.model_wizard_preview_pricelist_line +msgid "wizard - Preview Pricelist Line" +msgstr "" diff --git a/product_pricelist_simulation_margin/i18n/tr.po b/product_pricelist_simulation_margin/i18n/tr.po new file mode 100644 index 00000000000..fab921ad156 --- /dev/null +++ b/product_pricelist_simulation_margin/i18n/tr.po @@ -0,0 +1,52 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_pricelist_simulation_margin +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-03-11 08:37+0000\n" +"Last-Translator: Ömer KÜLAK \n" +"Language-Team: none\n" +"Language: tr\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_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist__standard_price +msgid "Cost" +msgstr "Maliyet" + +#. module: product_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist_line__margin +msgid "Margin" +msgstr "Marj" + +#. module: product_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist_line__margin_percent +msgid "Margin (%)" +msgstr "Marj (%)" + +#. module: product_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist_line__price_vat_excl +msgid "Unit Sales Price (Excl.)" +msgstr "Satış Fiyatı (Vergi Hariç)" + +#. module: product_pricelist_simulation_margin +#: model:ir.model.fields,field_description:product_pricelist_simulation_margin.field_wizard_preview_pricelist_line__price_vat_incl +msgid "Unit Sales Price (Incl.)" +msgstr "Satış Fiyatı (Vergi Dahil)" + +#. module: product_pricelist_simulation_margin +#: model:ir.model,name:product_pricelist_simulation_margin.model_wizard_preview_pricelist +msgid "wizard - Preview Pricelist" +msgstr "Fiyat Listesini İncele" + +#. module: product_pricelist_simulation_margin +#: model:ir.model,name:product_pricelist_simulation_margin.model_wizard_preview_pricelist_line +msgid "wizard - Preview Pricelist Line" +msgstr "Fiyat Listesi Satırlarını İncele" diff --git a/product_pricelist_simulation_margin/pyproject.toml b/product_pricelist_simulation_margin/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/product_pricelist_simulation_margin/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/product_pricelist_simulation_margin/readme/CONTRIBUTORS.md b/product_pricelist_simulation_margin/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..bd5f2cde4f3 --- /dev/null +++ b/product_pricelist_simulation_margin/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- Sylvain LE GAL \<\> +- Hugo Córdoba - FactorLibre \<\> +- Khoi (Kien Kim) \<\> diff --git a/product_pricelist_simulation_margin/readme/CREDITS.md b/product_pricelist_simulation_margin/readme/CREDITS.md new file mode 100644 index 00000000000..9770e59ab9c --- /dev/null +++ b/product_pricelist_simulation_margin/readme/CREDITS.md @@ -0,0 +1,3 @@ +The migration of this module from 16.0 to 17.0 was financially supported by: + +- Camptocamp diff --git a/product_pricelist_simulation_margin/readme/DESCRIPTION.md b/product_pricelist_simulation_margin/readme/DESCRIPTION.md new file mode 100644 index 00000000000..ceebc90dca0 --- /dev/null +++ b/product_pricelist_simulation_margin/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This module is designed to extend Product Module in Odoo to preview +product margin depending on the different pricelists. diff --git a/product_pricelist_simulation_margin/readme/USAGE.md b/product_pricelist_simulation_margin/readme/USAGE.md new file mode 100644 index 00000000000..e27a81e664c --- /dev/null +++ b/product_pricelist_simulation_margin/readme/USAGE.md @@ -0,0 +1,14 @@ +- Go to "Sale \> Products \> Products" + +- Open a product form + +- on the button incorporated in the module + 'product_pricelist_simulation' .. image:: + ../static/description/product_template_form.png + +- Click on the button, and check if the margins are correct + + ![image](../static/description/wizard_preview_pricelist_margin_form.png) + +- you can optionnaly change date, or quantity, if you have complex + pricelist depending on such parameters. diff --git a/product_pricelist_simulation_margin/security/ir.model.access.csv b/product_pricelist_simulation_margin/security/ir.model.access.csv new file mode 100644 index 00000000000..a40cfc9ce6e --- /dev/null +++ b/product_pricelist_simulation_margin/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +product_pricelist_simulation_margin.access_wizard_preview_pricelist_line,access_wizard_preview_pricelist_line,product_pricelist_simulation_margin.model_wizard_preview_pricelist_line,base.group_user,1,1,1,1 diff --git a/product_pricelist_simulation_margin/static/description/icon.png b/product_pricelist_simulation_margin/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/product_pricelist_simulation_margin/static/description/icon.png differ diff --git a/product_pricelist_simulation_margin/static/description/index.html b/product_pricelist_simulation_margin/static/description/index.html new file mode 100644 index 00000000000..c7aadb1b006 --- /dev/null +++ b/product_pricelist_simulation_margin/static/description/index.html @@ -0,0 +1,443 @@ + + + + + +Product Pricelist Simulation Margin + + + +
+

Product Pricelist Simulation Margin

+ + +

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

+

This module is designed to extend Product Module in Odoo to preview product margin +depending on the different pricelists.

+

Table of contents

+ +
+

Usage

+ +
+
+

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

+
    +
  • FactorLibre
  • +
+
+
+

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.

+

Current maintainer:

+

legalsylvain

+

This module is part of the OCA/product-attribute project on GitHub.

+

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

+
+
+
+ + diff --git a/product_pricelist_simulation_margin/static/description/product_template_form.png b/product_pricelist_simulation_margin/static/description/product_template_form.png new file mode 100644 index 00000000000..26c4069dafb Binary files /dev/null and b/product_pricelist_simulation_margin/static/description/product_template_form.png differ diff --git a/product_pricelist_simulation_margin/static/description/wizard_preview_pricelist_margin_form.png b/product_pricelist_simulation_margin/static/description/wizard_preview_pricelist_margin_form.png new file mode 100644 index 00000000000..33c07493aee Binary files /dev/null and b/product_pricelist_simulation_margin/static/description/wizard_preview_pricelist_margin_form.png differ diff --git a/product_pricelist_simulation_margin/tests/__init__.py b/product_pricelist_simulation_margin/tests/__init__.py new file mode 100644 index 00000000000..d9b96c4fa5a --- /dev/null +++ b/product_pricelist_simulation_margin/tests/__init__.py @@ -0,0 +1 @@ +from . import test_module diff --git a/product_pricelist_simulation_margin/tests/test_module.py b/product_pricelist_simulation_margin/tests/test_module.py new file mode 100644 index 00000000000..4a2abf5f5dd --- /dev/null +++ b/product_pricelist_simulation_margin/tests/test_module.py @@ -0,0 +1,55 @@ +# Copyright (C) 2021 - Today: GRAP (http://www.grap.coop) +# Copyright (C) 2023 - Hugo Córdoba FactorLibre (http://www.factorlibre.coop) +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo.tests import common + + +class TestModule(common.TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.tax = cls.env["account.tax"].create( + { + "name": "C02 Tax", + "amount": "0.00", + } + ) + cls.product = cls.env["product.product"].create( + { + "default_code": "pricelist-margin-product", + "name": "Demo Product (Margin per Pricelist module)", + "list_price": 40.0, + "standard_price": 20.0, + "taxes_id": cls.tax, + } + ) + cls.pricelist = cls.env["product.pricelist"].create( + { + "name": "pricelist", + "discount_policy": "without_discount", + } + ) + cls.wizard = ( + cls.env["wizard.preview.pricelist"] + .with_context(active_model="product.product", active_id=cls.product.id) + .create({}) + ) + + def test_margin_computation(self): + line = self.wizard._prepare_simulation_lines_vals(self.product, self.pricelist) + self.assertEqual(line.get("margin"), 20.0) + self.assertEqual(line.get("margin_percent"), 50.0) + self.env["product.pricelist.item"].create( + { + "pricelist_id": self.pricelist.id, + "product_tmpl_id": self.product.product_tmpl_id.id, + "compute_price": "fixed", + "applied_on": "1_product", + "fixed_price": 35, + } + ) + line = self.wizard._prepare_simulation_lines_vals(self.product, self.pricelist) + self.assertEqual(line.get("margin"), 15.0) + self.assertEqual(line.get("margin_percent"), 42.857142857142854) diff --git a/product_pricelist_simulation_margin/wizards/__init__.py b/product_pricelist_simulation_margin/wizards/__init__.py new file mode 100644 index 00000000000..dc21fe9d97d --- /dev/null +++ b/product_pricelist_simulation_margin/wizards/__init__.py @@ -0,0 +1 @@ +from . import wizard_preview_pricelist diff --git a/product_pricelist_simulation_margin/wizards/wizard_preview_pricelist.py b/product_pricelist_simulation_margin/wizards/wizard_preview_pricelist.py new file mode 100644 index 00000000000..cd8d0e2a89f --- /dev/null +++ b/product_pricelist_simulation_margin/wizards/wizard_preview_pricelist.py @@ -0,0 +1,87 @@ +# Copyright 2023 FactorLibre - Hugo Córdoba +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + + +from odoo import fields, models + + +class WizardPricelistSimulation(models.TransientModel): + _inherit = "wizard.preview.pricelist" + _description = "wizard - Preview Pricelist" + + standard_price = fields.Float( + string="Cost", + ) + + def _set_standard_price(self): + if self.template_id: + self.standard_price = self.template_id.standard_price + elif self.product_id: + self.standard_price = self.product_id.standard_price + + def _get_product(self, pricelist): + if self.template_id: + product = self.template_id.with_context( + quantity=self.product_qty, + pricelist=pricelist.id, + date=self.price_date, + ) + elif self.product_id: + product = self.product_id.with_context( + quantity=self.product_qty, + pricelist=pricelist.id, + date=self.price_date, + ) + return product + + def _prepare_simulation_lines_vals(self, variant, pricelist): + rslt = super()._prepare_simulation_lines_vals(variant, pricelist) + to_currency = pricelist.currency_id + self._set_standard_price() + product = self._get_product(pricelist) + res = product.taxes_id.compute_all( + rslt.get("price"), + to_currency, + self.product_qty, + product=product, + ) + price_vat_excl = res["total_excluded"] / self.product_qty + price_vat_incl = res["total_included"] / self.product_qty + + cost = self.env.user.company_id.currency_id._convert( + self.standard_price, + to_currency, + self.env.user.company_id, + self.price_date, + round=False, + ) + rslt.update( + { + "price_vat_excl": price_vat_excl, + "price_vat_incl": price_vat_incl, + "margin": price_vat_excl - cost, + "margin_percent": price_vat_excl + and ((price_vat_excl - cost) / price_vat_excl) * 100, + } + ) + return rslt + + +class PricelistSimulationLine(models.TransientModel): + _inherit = "wizard.preview.pricelist.line" + _description = "wizard - Preview Pricelist Line" + + price_vat_excl = fields.Monetary(string="Unit Sales Price (Excl.)", readonly=True) + price_vat_incl = fields.Monetary(string="Unit Sales Price (Incl.)", readonly=True) + + margin = fields.Monetary( + store=True, + readonly=True, + ) + + margin_percent = fields.Float( + string="Margin (%)", + store=True, + digits="Price", + readonly=True, + ) diff --git a/product_pricelist_simulation_margin/wizards/wizard_preview_pricelist_views.xml b/product_pricelist_simulation_margin/wizards/wizard_preview_pricelist_views.xml new file mode 100644 index 00000000000..452f7e0b095 --- /dev/null +++ b/product_pricelist_simulation_margin/wizards/wizard_preview_pricelist_views.xml @@ -0,0 +1,45 @@ + + + + + wizard.preview.pricelist.form + wizard.preview.pricelist + + + + + + + 1 + + + + + + + + + + + + + + + +