diff --git a/product_supplierinfo_disable_autocreation/README.rst b/product_supplierinfo_disable_autocreation/README.rst new file mode 100644 index 00000000000..5a0b6566f20 --- /dev/null +++ b/product_supplierinfo_disable_autocreation/README.rst @@ -0,0 +1,104 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +========================================= +Product Supplierinfo Disable Autocreation +========================================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:92a7c4524192848e26cafb643c83e4437cff80af329181f1ca890e50a79dd5bd + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/license-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github + :target: https://github.com/OCA/purchase-workflow/tree/18.0/product_supplierinfo_disable_autocreation + :alt: OCA/purchase-workflow +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/purchase-workflow-18-0/purchase-workflow-18-0-product_supplierinfo_disable_autocreation + :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/purchase-workflow&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds a configuration option to control the automatic +creation of supplier rates in Odoo, allowing users to enable or disable +the generation of supplier rate lines when validating purchase orders +using a checkbox in the purchasing configuration. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +If you want to control the automatic creation of supplier price lists: + +1. Go to Purchase, then to Configuration, and open the purchasing + settings. +2. In the Orders section, find the "Enable Automatic Supplier Price + Lists" option. +3. Check this box to enable the automatic creation of supplier price + lists when validating purchase orders, or uncheck it to prevent these + lines from being generated automatically. +4. The setting is applied per company, allowing for different + configurations in a multi-company environment. + +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 +------- + +* Sygel + +Contributors +------------ + + - `Sygel `__: + + .. + + - Juan Alberto Raja Martinez + - Valentín Vinagre Urteaga + - Manuel Regidor + +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/purchase-workflow `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/product_supplierinfo_disable_autocreation/__init__.py b/product_supplierinfo_disable_autocreation/__init__.py new file mode 100644 index 00000000000..f13e006e969 --- /dev/null +++ b/product_supplierinfo_disable_autocreation/__init__.py @@ -0,0 +1,3 @@ +# Copyright 2025 Juan Alberto Raja +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from . import models diff --git a/product_supplierinfo_disable_autocreation/__manifest__.py b/product_supplierinfo_disable_autocreation/__manifest__.py new file mode 100644 index 00000000000..1b19bf7fc29 --- /dev/null +++ b/product_supplierinfo_disable_autocreation/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2025 Juan Alberto Raja +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Product Supplierinfo Disable Autocreation", + "version": "19.0.1.0.0", + "category": "Purchase", + "summary": "Add option to disable automatic creation of pricelists for suppliers", + "author": "Sygel, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/purchase-workflow", + "depends": ["purchase"], + "data": [ + "views/res_config_settings_views.xml", + ], + "installable": True, + "application": False, + "license": "LGPL-3", +} diff --git a/product_supplierinfo_disable_autocreation/i18n/ca_ES.po b/product_supplierinfo_disable_autocreation/i18n/ca_ES.po new file mode 100644 index 00000000000..b0f47c9a229 --- /dev/null +++ b/product_supplierinfo_disable_autocreation/i18n/ca_ES.po @@ -0,0 +1,55 @@ +# Translation of Odoo Server. +# * product_supplierinfo_disable_autocreation +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: \n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: ca\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: product_supplierinfo_disable_autocreation +#: model_terms:ir.ui.view,arch_db:product_supplierinfo_disable_autocreation.product_supplierinfo_disable_autocreation_res_config_settings_view_form +msgid "" +"Automatically create supplier pricelists when validating purchase orders" +msgstr "" +"Crear automàticament tarifes de proveïdor en validar comandes de compra" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model,name:product_supplierinfo_disable_autocreation.model_res_company +msgid "Companies" +msgstr "" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model.fields,field_description:product_supplierinfo_disable_autocreation.field_res_company__purchase_pricelist_disable_autocreate +#: model:ir.model.fields,field_description:product_supplierinfo_disable_autocreation.field_res_config_settings__purchase_pricelist_disable_autocreate +#: model_terms:ir.ui.view,arch_db:product_supplierinfo_disable_autocreation.product_supplierinfo_disable_autocreation_res_config_settings_view_form +msgid "Enable Automatic Supplier Pricelists" +msgstr "Activar tarifes automàtiques de proveïdor" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model,name:product_supplierinfo_disable_autocreation.model_res_config_settings +msgid "Procurement purchase grouping settings" +msgstr "" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model,name:product_supplierinfo_disable_autocreation.model_purchase_order +msgid "Purchase Order" +msgstr "" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model.fields,help:product_supplierinfo_disable_autocreation.field_res_company__purchase_pricelist_disable_autocreate +#: model:ir.model.fields,help:product_supplierinfo_disable_autocreation.field_res_config_settings__purchase_pricelist_disable_autocreate +msgid "" +"When enabled, the system will automatically create supplier pricelists when " +"validating purchase orders." +msgstr "" +"Quan està activada, el sistema crearà automàticament tarifes de proveïdor en " +"validar comandes de compra." diff --git a/product_supplierinfo_disable_autocreation/i18n/es.po b/product_supplierinfo_disable_autocreation/i18n/es.po new file mode 100644 index 00000000000..43ef42e6421 --- /dev/null +++ b/product_supplierinfo_disable_autocreation/i18n/es.po @@ -0,0 +1,56 @@ +# Translation of Odoo Server. +# * product_supplierinfo_disable_autocreation +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: 2026-04-19 09:31+0000\n" +"Last-Translator: Ed-Spain \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 5.15.2\n" + +#. module: product_supplierinfo_disable_autocreation +#: model_terms:ir.ui.view,arch_db:product_supplierinfo_disable_autocreation.product_supplierinfo_disable_autocreation_res_config_settings_view_form +msgid "" +"Automatically create supplier pricelists when validating purchase orders" +msgstr "" +"Crear automáticamente tarifas de proveedor al validar pedidos de compra" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model,name:product_supplierinfo_disable_autocreation.model_res_company +msgid "Companies" +msgstr "Empresas" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model.fields,field_description:product_supplierinfo_disable_autocreation.field_res_company__purchase_pricelist_disable_autocreate +#: model:ir.model.fields,field_description:product_supplierinfo_disable_autocreation.field_res_config_settings__purchase_pricelist_disable_autocreate +#: model_terms:ir.ui.view,arch_db:product_supplierinfo_disable_autocreation.product_supplierinfo_disable_autocreation_res_config_settings_view_form +msgid "Enable Automatic Supplier Pricelists" +msgstr "Activar tarifas automáticas de proveedor" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model,name:product_supplierinfo_disable_autocreation.model_res_config_settings +msgid "Procurement purchase grouping settings" +msgstr "Ajustes de agrupación de compras de aprovisionamiento" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model,name:product_supplierinfo_disable_autocreation.model_purchase_order +msgid "Purchase Order" +msgstr "Orden de compra" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model.fields,help:product_supplierinfo_disable_autocreation.field_res_company__purchase_pricelist_disable_autocreate +#: model:ir.model.fields,help:product_supplierinfo_disable_autocreation.field_res_config_settings__purchase_pricelist_disable_autocreate +msgid "" +"When enabled, the system will automatically create supplier pricelists when " +"validating purchase orders." +msgstr "" +"Cuando está activada, el sistema creará automáticamente tarifas de proveedor " +"al validar pedidos de compra." diff --git a/product_supplierinfo_disable_autocreation/i18n/it.po b/product_supplierinfo_disable_autocreation/i18n/it.po new file mode 100644 index 00000000000..0ca5a0928fc --- /dev/null +++ b/product_supplierinfo_disable_autocreation/i18n/it.po @@ -0,0 +1,57 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_supplierinfo_disable_autocreation +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2025-06-04 09:29+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 5.10.4\n" + +#. module: product_supplierinfo_disable_autocreation +#: model_terms:ir.ui.view,arch_db:product_supplierinfo_disable_autocreation.product_supplierinfo_disable_autocreation_res_config_settings_view_form +msgid "" +"Automatically create supplier pricelists when validating purchase orders" +msgstr "" +"Crea automaticamente il listino fornitore alla validazione degli ordini di " +"acquisto" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model,name:product_supplierinfo_disable_autocreation.model_res_company +msgid "Companies" +msgstr "Aziende" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model.fields,field_description:product_supplierinfo_disable_autocreation.field_res_company__purchase_pricelist_disable_autocreate +#: model:ir.model.fields,field_description:product_supplierinfo_disable_autocreation.field_res_config_settings__purchase_pricelist_disable_autocreate +#: model_terms:ir.ui.view,arch_db:product_supplierinfo_disable_autocreation.product_supplierinfo_disable_autocreation_res_config_settings_view_form +msgid "Enable Automatic Supplier Pricelists" +msgstr "Abilita listini automatici fornitori" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model,name:product_supplierinfo_disable_autocreation.model_res_config_settings +msgid "Procurement purchase grouping settings" +msgstr "Impostazioni raggruppamento approvvigionamento acquisti" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model,name:product_supplierinfo_disable_autocreation.model_purchase_order +msgid "Purchase Order" +msgstr "Ordine di acquisto" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model.fields,help:product_supplierinfo_disable_autocreation.field_res_company__purchase_pricelist_disable_autocreate +#: model:ir.model.fields,help:product_supplierinfo_disable_autocreation.field_res_config_settings__purchase_pricelist_disable_autocreate +msgid "" +"When enabled, the system will automatically create supplier pricelists when " +"validating purchase orders." +msgstr "" +"Quando abilitata, il sistema creerà automaticamente i listini fornitore alla " +"validazione degli ordini di acquisto." diff --git a/product_supplierinfo_disable_autocreation/i18n/product_supplierinfo_disable_autocreation.pot b/product_supplierinfo_disable_autocreation/i18n/product_supplierinfo_disable_autocreation.pot new file mode 100644 index 00000000000..05bf3639aed --- /dev/null +++ b/product_supplierinfo_disable_autocreation/i18n/product_supplierinfo_disable_autocreation.pot @@ -0,0 +1,50 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_supplierinfo_disable_autocreation +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.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_supplierinfo_disable_autocreation +#: model_terms:ir.ui.view,arch_db:product_supplierinfo_disable_autocreation.product_supplierinfo_disable_autocreation_res_config_settings_view_form +msgid "" +"Automatically create supplier pricelists when validating purchase orders" +msgstr "" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model,name:product_supplierinfo_disable_autocreation.model_res_company +msgid "Companies" +msgstr "" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model.fields,field_description:product_supplierinfo_disable_autocreation.field_res_company__purchase_pricelist_disable_autocreate +#: model:ir.model.fields,field_description:product_supplierinfo_disable_autocreation.field_res_config_settings__purchase_pricelist_disable_autocreate +#: model_terms:ir.ui.view,arch_db:product_supplierinfo_disable_autocreation.product_supplierinfo_disable_autocreation_res_config_settings_view_form +msgid "Enable Automatic Supplier Pricelists" +msgstr "" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model,name:product_supplierinfo_disable_autocreation.model_res_config_settings +msgid "Procurement purchase grouping settings" +msgstr "" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model,name:product_supplierinfo_disable_autocreation.model_purchase_order +msgid "Purchase Order" +msgstr "" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model.fields,help:product_supplierinfo_disable_autocreation.field_res_company__purchase_pricelist_disable_autocreate +#: model:ir.model.fields,help:product_supplierinfo_disable_autocreation.field_res_config_settings__purchase_pricelist_disable_autocreate +msgid "" +"When enabled, the system will automatically create supplier pricelists when " +"validating purchase orders." +msgstr "" diff --git a/product_supplierinfo_disable_autocreation/i18n/sl.po b/product_supplierinfo_disable_autocreation/i18n/sl.po new file mode 100644 index 00000000000..0140abc824b --- /dev/null +++ b/product_supplierinfo_disable_autocreation/i18n/sl.po @@ -0,0 +1,56 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_supplierinfo_disable_autocreation +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2026-06-01 06:17+0000\n" +"Last-Translator: Matjaz Mozetic \n" +"Language-Team: none\n" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || " +"n%100==4 ? 2 : 3;\n" +"X-Generator: Weblate 5.15.2\n" + +#. module: product_supplierinfo_disable_autocreation +#: model_terms:ir.ui.view,arch_db:product_supplierinfo_disable_autocreation.product_supplierinfo_disable_autocreation_res_config_settings_view_form +msgid "" +"Automatically create supplier pricelists when validating purchase orders" +msgstr "Samodejno ustvari cenike dobaviteljev ob potrjevanju nabavnih nalogov" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model,name:product_supplierinfo_disable_autocreation.model_res_company +msgid "Companies" +msgstr "Družbe" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model.fields,field_description:product_supplierinfo_disable_autocreation.field_res_company__purchase_pricelist_disable_autocreate +#: model:ir.model.fields,field_description:product_supplierinfo_disable_autocreation.field_res_config_settings__purchase_pricelist_disable_autocreate +#: model_terms:ir.ui.view,arch_db:product_supplierinfo_disable_autocreation.product_supplierinfo_disable_autocreation_res_config_settings_view_form +msgid "Enable Automatic Supplier Pricelists" +msgstr "Omogoči samodejne cenike dobaviteljev" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model,name:product_supplierinfo_disable_autocreation.model_res_config_settings +msgid "Procurement purchase grouping settings" +msgstr "Nastavitve združevanja nabavnih oskrbovanj" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model,name:product_supplierinfo_disable_autocreation.model_purchase_order +msgid "Purchase Order" +msgstr "Nabavni nalog" + +#. module: product_supplierinfo_disable_autocreation +#: model:ir.model.fields,help:product_supplierinfo_disable_autocreation.field_res_company__purchase_pricelist_disable_autocreate +#: model:ir.model.fields,help:product_supplierinfo_disable_autocreation.field_res_config_settings__purchase_pricelist_disable_autocreate +msgid "" +"When enabled, the system will automatically create supplier pricelists when " +"validating purchase orders." +msgstr "" +"Ko je omogočeno, bo sistem ob potrjevanju nabavnih nalogov samodejno " +"ustvaril cenike dobaviteljev." diff --git a/product_supplierinfo_disable_autocreation/models/__init__.py b/product_supplierinfo_disable_autocreation/models/__init__.py new file mode 100644 index 00000000000..4c619fad85d --- /dev/null +++ b/product_supplierinfo_disable_autocreation/models/__init__.py @@ -0,0 +1,5 @@ +# Copyright 2025 Juan Alberto Raja +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from . import res_company +from . import res_config_settings +from . import purchase_order diff --git a/product_supplierinfo_disable_autocreation/models/purchase_order.py b/product_supplierinfo_disable_autocreation/models/purchase_order.py new file mode 100644 index 00000000000..69ce943779f --- /dev/null +++ b/product_supplierinfo_disable_autocreation/models/purchase_order.py @@ -0,0 +1,13 @@ +# Copyright 2025 Juan Alberto Raja +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import models + + +class PurchaseOrder(models.Model): + _inherit = "purchase.order" + + def _add_supplier_to_product(self): + result = None + if self.company_id.purchase_pricelist_disable_autocreate: + result = super()._add_supplier_to_product() + return result diff --git a/product_supplierinfo_disable_autocreation/models/res_company.py b/product_supplierinfo_disable_autocreation/models/res_company.py new file mode 100644 index 00000000000..694a877ee67 --- /dev/null +++ b/product_supplierinfo_disable_autocreation/models/res_company.py @@ -0,0 +1,16 @@ +# Copyright 2025 Juan Alberto Raja +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class Company(models.Model): + _inherit = "res.company" + + purchase_pricelist_disable_autocreate = fields.Boolean( + string="Enable Automatic Supplier Pricelists", + help=( + "When enabled, the system will automatically create supplier " + "pricelists when validating purchase orders." + ), + default=True, + ) diff --git a/product_supplierinfo_disable_autocreation/models/res_config_settings.py b/product_supplierinfo_disable_autocreation/models/res_config_settings.py new file mode 100644 index 00000000000..caab0e1d341 --- /dev/null +++ b/product_supplierinfo_disable_autocreation/models/res_config_settings.py @@ -0,0 +1,17 @@ +# Copyright 2025 Juan Alberto Raja +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + purchase_pricelist_disable_autocreate = fields.Boolean( + related="company_id.purchase_pricelist_disable_autocreate", + string="Enable Automatic Supplier Pricelists", + readonly=False, + help=( + "When enabled, the system will automatically create supplier " + "pricelists when validating purchase orders." + ), + ) diff --git a/product_supplierinfo_disable_autocreation/pyproject.toml b/product_supplierinfo_disable_autocreation/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/product_supplierinfo_disable_autocreation/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/product_supplierinfo_disable_autocreation/readme/CONTRIBUTORS.md b/product_supplierinfo_disable_autocreation/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..bbb571f5557 --- /dev/null +++ b/product_supplierinfo_disable_autocreation/readme/CONTRIBUTORS.md @@ -0,0 +1,6 @@ + +> - [Sygel](https://www.sygel.es): +> +> > - Juan Alberto Raja Martinez\<\> +> > - Valentín Vinagre Urteaga\<\> +> > - Manuel Regidor\<\> diff --git a/product_supplierinfo_disable_autocreation/readme/DESCRIPTION.md b/product_supplierinfo_disable_autocreation/readme/DESCRIPTION.md new file mode 100644 index 00000000000..4af73f3a282 --- /dev/null +++ b/product_supplierinfo_disable_autocreation/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module adds a configuration option to control the automatic creation of supplier rates in Odoo, allowing users to enable or disable the generation of supplier rate lines when validating purchase orders using a checkbox in the purchasing configuration. diff --git a/product_supplierinfo_disable_autocreation/readme/USAGE.md b/product_supplierinfo_disable_autocreation/readme/USAGE.md new file mode 100644 index 00000000000..58fe4b505b5 --- /dev/null +++ b/product_supplierinfo_disable_autocreation/readme/USAGE.md @@ -0,0 +1,6 @@ +If you want to control the automatic creation of supplier price lists: + +1. Go to Purchase, then to Configuration, and open the purchasing settings. +2. In the Orders section, find the "Enable Automatic Supplier Price Lists" option. +3. Check this box to enable the automatic creation of supplier price lists when validating purchase orders, or uncheck it to prevent these lines from being generated automatically. +4. The setting is applied per company, allowing for different configurations in a multi-company environment. diff --git a/product_supplierinfo_disable_autocreation/static/description/icon.png b/product_supplierinfo_disable_autocreation/static/description/icon.png new file mode 100644 index 00000000000..207fb7ad553 Binary files /dev/null and b/product_supplierinfo_disable_autocreation/static/description/icon.png differ diff --git a/product_supplierinfo_disable_autocreation/static/description/index.html b/product_supplierinfo_disable_autocreation/static/description/index.html new file mode 100644 index 00000000000..66a576f3202 --- /dev/null +++ b/product_supplierinfo_disable_autocreation/static/description/index.html @@ -0,0 +1,458 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Product Supplierinfo Disable Autocreation

+ +

Beta License: LGPL-3 OCA/purchase-workflow Translate me on Weblate Try me on Runboat

+

This module adds a configuration option to control the automatic +creation of supplier rates in Odoo, allowing users to enable or disable +the generation of supplier rate lines when validating purchase orders +using a checkbox in the purchasing configuration.

+

Table of contents

+ +
+

Usage

+

If you want to control the automatic creation of supplier price lists:

+
    +
  1. Go to Purchase, then to Configuration, and open the purchasing +settings.
  2. +
  3. In the Orders section, find the “Enable Automatic Supplier Price +Lists” option.
  4. +
  5. Check this box to enable the automatic creation of supplier price +lists when validating purchase orders, or uncheck it to prevent these +lines from being generated automatically.
  6. +
  7. The setting is applied per company, allowing for different +configurations in a multi-company environment.
  8. +
+
+
+

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

+
    +
  • Sygel
  • +
+
+
+

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/purchase-workflow project on GitHub.

+

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

+
+
+
+
+ + diff --git a/product_supplierinfo_disable_autocreation/tests/__init__.py b/product_supplierinfo_disable_autocreation/tests/__init__.py new file mode 100644 index 00000000000..38275c600ec --- /dev/null +++ b/product_supplierinfo_disable_autocreation/tests/__init__.py @@ -0,0 +1 @@ +from . import test_purchase_pricelist_disable diff --git a/product_supplierinfo_disable_autocreation/tests/test_purchase_pricelist_disable.py b/product_supplierinfo_disable_autocreation/tests/test_purchase_pricelist_disable.py new file mode 100644 index 00000000000..d5dc90e9bf2 --- /dev/null +++ b/product_supplierinfo_disable_autocreation/tests/test_purchase_pricelist_disable.py @@ -0,0 +1,184 @@ +from odoo.tests import tagged + +from odoo.addons.base.tests.common import BaseCommon + + +@tagged("post_install", "-at_install") +class TestPurchasePricelistDisable(BaseCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + + cls.product = cls.env["product.product"].create( + { + "name": "Test Product", + "type": "consu", + } + ) + + cls.product2 = cls.env["product.product"].create( + { + "name": "Test Product 2", + "type": "consu", + } + ) + + cls.partner1 = cls.env["res.partner"].create( + { + "name": "Vendor with auto pricelist", + } + ) + + cls.partner2 = cls.env["res.partner"].create( + { + "name": "Vendor without auto pricelist", + } + ) + + cls.company2 = cls.env["res.company"].create( + { + "name": "Test Company", + } + ) + + # Create purchase orders and lines for reuse in tests + cls.po1 = cls.env["purchase.order"].create( + { + "partner_id": cls.partner1.id, + } + ) + cls.env["purchase.order.line"].create( + { + "order_id": cls.po1.id, + "product_id": cls.product.id, + "product_qty": 1.0, + "price_unit": 100.0, + "name": "Test Line", + "product_uom_id": cls.product.uom_id.id, + } + ) + + cls.po2 = cls.env["purchase.order"].create( + { + "partner_id": cls.partner2.id, + } + ) + cls.env["purchase.order.line"].create( + { + "order_id": cls.po2.id, + "product_id": cls.product.id, + "product_qty": 1.0, + "price_unit": 100.0, + "name": "Test Line", + "product_uom_id": cls.product.uom_id.id, + } + ) + + # Purchase order with multiple product lines + cls.po_multi1 = cls.env["purchase.order"].create( + { + "partner_id": cls.partner1.id, + } + ) + cls.env["purchase.order.line"].create( + [ + { + "order_id": cls.po_multi1.id, + "product_id": cls.product.id, + "product_qty": 1.0, + "price_unit": 100.0, + "name": "Test Line 1", + "product_uom_id": cls.product.uom_id.id, + }, + { + "order_id": cls.po_multi1.id, + "product_id": cls.product2.id, + "product_qty": 2.0, + "price_unit": 150.0, + "name": "Test Line 2", + "product_uom_id": cls.product2.uom_id.id, + }, + ] + ) + + cls.po_multi2 = cls.env["purchase.order"].create( + { + "partner_id": cls.partner2.id, + } + ) + cls.env["purchase.order.line"].create( + [ + { + "order_id": cls.po_multi2.id, + "product_id": cls.product.id, + "product_qty": 1.0, + "price_unit": 100.0, + "name": "Test Line 1", + "product_uom_id": cls.product.uom_id.id, + }, + { + "order_id": cls.po_multi2.id, + "product_id": cls.product2.id, + "product_qty": 2.0, + "price_unit": 150.0, + "name": "Test Line 2", + "product_uom_id": cls.product2.uom_id.id, + }, + ] + ) + + def test_01_pricelist_enabled(self): + """Test supplier pricelist creation when enabled""" + self.env.company.purchase_pricelist_disable_autocreate = True + + seller_count_before = len(self.product.seller_ids) + self.po1.button_confirm() + seller_count_after = len(self.product.seller_ids) + + self.assertEqual(seller_count_after, seller_count_before + 1) + self.assertIn(self.partner1, self.product.seller_ids.mapped("partner_id")) + + def test_02_pricelist_disabled(self): + """Test supplier pricelist creation when disabled""" + self.env.company.purchase_pricelist_disable_autocreate = False + + seller_count_before = len(self.product.seller_ids) + self.po2.button_confirm() + seller_count_after = len(self.product.seller_ids) + + self.assertEqual(seller_count_after, seller_count_before) + self.assertNotIn(self.partner2, self.product.seller_ids.mapped("partner_id")) + + def test_03_multiple_products_pricelist_enabled(self): + """Test multiple supplier pricelists creation when enabled""" + self.env.company.purchase_pricelist_disable_autocreate = True + + seller_count_before_1 = len(self.product.seller_ids) + seller_count_before_2 = len(self.product2.seller_ids) + + self.po_multi1.button_confirm() + + seller_count_after_1 = len(self.product.seller_ids) + seller_count_after_2 = len(self.product2.seller_ids) + + self.assertEqual(seller_count_after_1, seller_count_before_1 + 1) + self.assertEqual(seller_count_after_2, seller_count_before_2 + 1) + self.assertIn(self.partner1, self.product.seller_ids.mapped("partner_id")) + self.assertIn(self.partner1, self.product2.seller_ids.mapped("partner_id")) + + def test_04_multiple_products_pricelist_disabled(self): + """Test multiple supplier pricelists not created when disabled""" + self.env.company.purchase_pricelist_disable_autocreate = False + + seller_count_before_1 = len(self.product.seller_ids) + seller_count_before_2 = len(self.product2.seller_ids) + + self.po_multi2.button_confirm() + + seller_count_after_1 = len(self.product.seller_ids) + seller_count_after_2 = len(self.product2.seller_ids) + + self.assertEqual(seller_count_after_1, seller_count_before_1) + self.assertEqual(seller_count_after_2, seller_count_before_2) + self.assertNotIn(self.partner2, self.product.seller_ids.mapped("partner_id")) + self.assertNotIn(self.partner2, self.product2.seller_ids.mapped("partner_id")) diff --git a/product_supplierinfo_disable_autocreation/views/res_config_settings_views.xml b/product_supplierinfo_disable_autocreation/views/res_config_settings_views.xml new file mode 100644 index 00000000000..4cafc87ebd5 --- /dev/null +++ b/product_supplierinfo_disable_autocreation/views/res_config_settings_views.xml @@ -0,0 +1,32 @@ + + + + + product.supplierinfo.disable.autocreation.res.config.settings.view.form + res.config.settings + + + + + + + + + +