diff --git a/purchase_minimum_amount/README.rst b/purchase_minimum_amount/README.rst new file mode 100644 index 00000000000..e372dbad9c8 --- /dev/null +++ b/purchase_minimum_amount/README.rst @@ -0,0 +1,133 @@ +======================= +Purchase Minimum Amount +======================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:0603c1aabd15f2c92d64a9f18fc734f4274627a3795c34391f7c29500e8a4d98 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fpurchase--workflow-lightgray.png?logo=github + :target: https://github.com/OCA/purchase-workflow/tree/16.0/purchase_minimum_amount + :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-16-0/purchase-workflow-16-0-purchase_minimum_amount + :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=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows you to establish and automate a specific Purchase Order +Approval Block Reason in the system: the 'Minimum Purchase Order Amount per +Vendor'. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +* Go to 'Purchases / Purchase / Vendors' +* Click on a Vendor and inside the 'Sales & Purchases' page specify the + non-required field 'Minimum Purchase Amount'. +* Assign the security group 'Release RFQ with approval block' to users that + should be able to release the block. Users in group 'Purchase / Managers' + are by default assigned to this group. + +Usage +===== + +Set the Purchase Approval Block +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +#. Go to 'Purchases / Purchase / Requests for Quotation' +#. Create a new RFQ and upon saving if the Untaxed Amount is below the + Purchase Minimum Amount specified in that vendor, then the Approval Block + Reason is automatically set and the Approval Block Reason is not editable + anymore. + +Search existing RFQ +~~~~~~~~~~~~~~~~~~~ + +There is a filter 'Blocked' to search for orders that are blocked. +It is also possible to search RFQ’s with the Approval Block Reason 'Minimum +Purchase Order Amount per Vendor'. + +Confirm the RFQ +~~~~~~~~~~~~~~~ + +#. Press the button ‘Confirm’. If there’s an approval block, the order will + be set to status 'To Approve'. You will then need to request a Purchase + Manager to approve it. + +Release the purchase approval block +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +#. All the RFQ’s with a total amount surpassing the specified Minimum Purchase + Order Amount for that vendor (excluding taxes) are automatically released. +#. If a blocked RFQ without surpassing the minimum amount wants to be + released, a user member of the security group 'Release RFQ with approval + block' can see a button 'Release Approval Block'. When pressing it, anyone + seeing that RFQ is able to validate it. + +Notifications to followers +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +#. Followers of the RFQ receive notifications when an approval block has been + set or released. + +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 +~~~~~~~ + +* ForgeFlow + +Contributors +~~~~~~~~~~~~ + +* Jordi Ballester Alomar +* Roser Garcia +* Darshan Patel +* Nikul Chaudhary + +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/purchase_minimum_amount/__init__.py b/purchase_minimum_amount/__init__.py new file mode 100644 index 00000000000..afa5023be15 --- /dev/null +++ b/purchase_minimum_amount/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0). + +from . import models diff --git a/purchase_minimum_amount/__manifest__.py b/purchase_minimum_amount/__manifest__.py new file mode 100644 index 00000000000..6296b9ecf53 --- /dev/null +++ b/purchase_minimum_amount/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2016 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0). + +{ + "name": "Purchase Minimum Amount", + "author": "ForgeFlow, Odoo Community Association (OCA)", + "version": "16.0.1.0.0", + "website": "https://github.com/OCA/purchase-workflow", + "depends": ["purchase_order_approval_block"], + "data": [ + "data/purchase_block_reason_data.xml", + "views/purchase_order_view.xml", + "views/res_partner_view.xml", + ], + "license": "AGPL-3", + "installable": True, +} diff --git a/purchase_minimum_amount/data/purchase_block_reason_data.xml b/purchase_minimum_amount/data/purchase_block_reason_data.xml new file mode 100644 index 00000000000..110f93f233f --- /dev/null +++ b/purchase_minimum_amount/data/purchase_block_reason_data.xml @@ -0,0 +1,14 @@ + + + + + Minimum Amount per Vendor + Set total minimum amount (before taxes) for a vendor. + + diff --git a/purchase_minimum_amount/i18n/de.po b/purchase_minimum_amount/i18n/de.po new file mode 100644 index 00000000000..3a5bdbf5d8b --- /dev/null +++ b/purchase_minimum_amount/i18n/de.po @@ -0,0 +1,66 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_minimum_amount +# +# Translators: +# OCA Transbot , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-23 17:50+0000\n" +"PO-Revision-Date: 2018-02-23 17:50+0000\n" +"Last-Translator: OCA Transbot , 2018\n" +"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" +"Language: de\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" + +#. module: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_res_partner +msgid "Contact" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__display_name +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line__display_name +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__display_name +msgid "Display Name" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__id +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line__id +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__id +msgid "ID" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order____last_update +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line____last_update +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner____last_update +msgid "Last Modified on" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__minimum_po_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_users__minimum_po_amount +msgid "Minimum Purchase Amount" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__minimum_po_amount +msgid "Purchase Minimum Amount" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_purchase_order +msgid "Purchase Order" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "Bestellposition" diff --git a/purchase_minimum_amount/i18n/es.po b/purchase_minimum_amount/i18n/es.po new file mode 100644 index 00000000000..e00e20fced7 --- /dev/null +++ b/purchase_minimum_amount/i18n/es.po @@ -0,0 +1,67 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_minimum_amount +# +# Translators: +# OCA Transbot , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-23 17:50+0000\n" +"PO-Revision-Date: 2024-04-17 19:34+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\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: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_res_partner +msgid "Contact" +msgstr "Contacto" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__display_name +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line__display_name +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__display_name +msgid "Display Name" +msgstr "Mostrar Nombre" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__id +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line__id +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__id +msgid "ID" +msgstr "ID" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order____last_update +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line____last_update +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner____last_update +msgid "Last Modified on" +msgstr "Última Modificación el" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__minimum_po_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_users__minimum_po_amount +msgid "Minimum Purchase Amount" +msgstr "Importe mínimo de compra" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__minimum_po_amount +msgid "Purchase Minimum Amount" +msgstr "Importe mínimo de compra" + +#. module: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_purchase_order +msgid "Purchase Order" +msgstr "Orden de compra" + +#. module: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "Línea orden de compra" diff --git a/purchase_minimum_amount/i18n/es_MX.po b/purchase_minimum_amount/i18n/es_MX.po new file mode 100644 index 00000000000..07936291fc1 --- /dev/null +++ b/purchase_minimum_amount/i18n/es_MX.po @@ -0,0 +1,67 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_minimum_amount +# +# Translators: +# OCA Transbot , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-23 17:50+0000\n" +"PO-Revision-Date: 2018-02-23 17:50+0000\n" +"Last-Translator: OCA Transbot , 2018\n" +"Language-Team: Spanish (Mexico) (https://www.transifex.com/oca/teams/23907/" +"es_MX/)\n" +"Language: es_MX\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" + +#. module: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_res_partner +msgid "Contact" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__display_name +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line__display_name +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__display_name +msgid "Display Name" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__id +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line__id +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__id +msgid "ID" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order____last_update +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line____last_update +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner____last_update +msgid "Last Modified on" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__minimum_po_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_users__minimum_po_amount +msgid "Minimum Purchase Amount" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__minimum_po_amount +msgid "Purchase Minimum Amount" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_purchase_order +msgid "Purchase Order" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "Línea de orden de compra" diff --git a/purchase_minimum_amount/i18n/fr.po b/purchase_minimum_amount/i18n/fr.po new file mode 100644 index 00000000000..91a6e4b9cd4 --- /dev/null +++ b/purchase_minimum_amount/i18n/fr.po @@ -0,0 +1,68 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_minimum_amount +# +# Translators: +# OCA Transbot , 2018 +# Quentin THEURET , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-23 17:50+0000\n" +"PO-Revision-Date: 2020-08-28 17:00+0000\n" +"Last-Translator: Sandie FAVRE \n" +"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\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 3.10\n" + +#. module: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_res_partner +msgid "Contact" +msgstr "Contact" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__display_name +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line__display_name +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__display_name +msgid "Display Name" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__id +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line__id +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__id +msgid "ID" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order____last_update +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line____last_update +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner____last_update +msgid "Last Modified on" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__minimum_po_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_users__minimum_po_amount +msgid "Minimum Purchase Amount" +msgstr "Montant minimum d'achat" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__minimum_po_amount +msgid "Purchase Minimum Amount" +msgstr "Montant minimum d'achat" + +#. module: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_purchase_order +msgid "Purchase Order" +msgstr "Commande" + +#. module: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "Ligne de commande d'achat" diff --git a/purchase_minimum_amount/i18n/it.po b/purchase_minimum_amount/i18n/it.po new file mode 100644 index 00000000000..afc84464ce7 --- /dev/null +++ b/purchase_minimum_amount/i18n/it.po @@ -0,0 +1,67 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_minimum_amount +# +# Translators: +# OCA Transbot , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-23 17:50+0000\n" +"PO-Revision-Date: 2024-01-29 17:34+0000\n" +"Last-Translator: mymage \n" +"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\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: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_res_partner +msgid "Contact" +msgstr "Contatto" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__display_name +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line__display_name +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__id +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line__id +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__id +msgid "ID" +msgstr "ID" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order____last_update +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line____last_update +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__minimum_po_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_users__minimum_po_amount +msgid "Minimum Purchase Amount" +msgstr "Importo minimo acquisto" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__minimum_po_amount +msgid "Purchase Minimum Amount" +msgstr "Importo minimo acquisto" + +#. module: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_purchase_order +msgid "Purchase Order" +msgstr "Ordine di acquisto" + +#. module: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "Riga ordine di acquisto" diff --git a/purchase_minimum_amount/i18n/pt_BR.po b/purchase_minimum_amount/i18n/pt_BR.po new file mode 100644 index 00000000000..2ad75ffe96d --- /dev/null +++ b/purchase_minimum_amount/i18n/pt_BR.po @@ -0,0 +1,68 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_minimum_amount +# +# Translators: +# OCA Transbot , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-23 17:50+0000\n" +"PO-Revision-Date: 2022-10-03 17:36+0000\n" +"Last-Translator: Douglas Custódio \n" +"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/" +"teams/23907/pt_BR/)\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.3.2\n" + +#. module: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_res_partner +msgid "Contact" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__display_name +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line__display_name +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__display_name +msgid "Display Name" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__id +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line__id +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__id +msgid "ID" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order____last_update +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line____last_update +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner____last_update +msgid "Last Modified on" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__minimum_po_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_users__minimum_po_amount +msgid "Minimum Purchase Amount" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__minimum_po_amount +msgid "Purchase Minimum Amount" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_purchase_order +msgid "Purchase Order" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "Linha do Pedido de Compra" diff --git a/purchase_minimum_amount/i18n/purchase_minimum_amount.pot b/purchase_minimum_amount/i18n/purchase_minimum_amount.pot new file mode 100644 index 00000000000..034c53f8aa1 --- /dev/null +++ b/purchase_minimum_amount/i18n/purchase_minimum_amount.pot @@ -0,0 +1,61 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_minimum_amount +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.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: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_res_partner +msgid "Contact" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__display_name +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line__display_name +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__display_name +msgid "Display Name" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__id +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line__id +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__id +msgid "ID" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order____last_update +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line____last_update +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner____last_update +msgid "Last Modified on" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__minimum_po_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_users__minimum_po_amount +msgid "Minimum Purchase Amount" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__minimum_po_amount +msgid "Purchase Minimum Amount" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_purchase_order +msgid "Purchase Order" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "" diff --git a/purchase_minimum_amount/i18n/sl.po b/purchase_minimum_amount/i18n/sl.po new file mode 100644 index 00000000000..2da002107e6 --- /dev/null +++ b/purchase_minimum_amount/i18n/sl.po @@ -0,0 +1,68 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_minimum_amount +# +# Translators: +# OCA Transbot , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-23 17:50+0000\n" +"PO-Revision-Date: 2020-08-12 15:59+0000\n" +"Last-Translator: Matjaz Mozetic \n" +"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\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 3.10\n" + +#. module: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_res_partner +msgid "Contact" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__display_name +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line__display_name +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__display_name +msgid "Display Name" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__id +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line__id +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__id +msgid "ID" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order____last_update +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order_line____last_update +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner____last_update +msgid "Last Modified on" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_partner__minimum_po_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_res_users__minimum_po_amount +msgid "Minimum Purchase Amount" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model.fields,field_description:purchase_minimum_amount.field_purchase_order__minimum_po_amount +msgid "Purchase Minimum Amount" +msgstr "" + +#. module: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_purchase_order +msgid "Purchase Order" +msgstr "Nabavni nalog" + +#. module: purchase_minimum_amount +#: model:ir.model,name:purchase_minimum_amount.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "Postavka nabavnega naloga" diff --git a/purchase_minimum_amount/models/__init__.py b/purchase_minimum_amount/models/__init__.py new file mode 100644 index 00000000000..81b16a61fc8 --- /dev/null +++ b/purchase_minimum_amount/models/__init__.py @@ -0,0 +1,4 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import purchase_order +from . import partner diff --git a/purchase_minimum_amount/models/partner.py b/purchase_minimum_amount/models/partner.py new file mode 100644 index 00000000000..757e689e21d --- /dev/null +++ b/purchase_minimum_amount/models/partner.py @@ -0,0 +1,11 @@ +# Copyright 2017 ForgeFlow S.L. +# Copyright 2017 Serpent Consulting Services Pvt. Ltd. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class ResPartner(models.Model): + _inherit = "res.partner" + + minimum_po_amount = fields.Float("Minimum Purchase Amount") diff --git a/purchase_minimum_amount/models/purchase_order.py b/purchase_minimum_amount/models/purchase_order.py new file mode 100644 index 00000000000..1844866af56 --- /dev/null +++ b/purchase_minimum_amount/models/purchase_order.py @@ -0,0 +1,57 @@ +# Copyright 2017 ForgeFlow S.L. +# Copyright 2017 Serpent Consulting Services Pvt. Ltd. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import api, fields, models + + +class PurchaseOrder(models.Model): + _inherit = "purchase.order" + + minimum_po_amount = fields.Float( + related="partner_id.minimum_po_amount", + string="Purchase Minimum Amount", + ) + + @api.constrains("partner_id") + def _check_minimum_amount(self): + for rec in self: + po_amt_block = rec.env.ref( + "purchase_minimum_amount." "minimum_amount_block_reason", + raise_if_not_found=False, + ) + under_min = rec.amount_untaxed < rec.minimum_po_amount + force_release = rec.env.context.get( + "force_po_approval_block_release", False + ) + if under_min and not rec.approval_block_id and not force_release: + rec.approval_block_id = po_amt_block + elif not under_min and rec.approval_block_id == po_amt_block: + rec.approval_block_id = False + return True + + +class PurchaseOrderLine(models.Model): + _inherit = "purchase.order.line" + + @api.model + def _check_minimum_amount_fields(self): + """As we are adding a hook, we cannot use api.constrain""" + return ["product_qty", "price_unit"] + + @api.model_create_multi + def create(self, mvals): + records = super(PurchaseOrderLine, self).create(mvals) + fields = self._check_minimum_amount_fields() + for vals, res in zip(mvals, records): + if any(field in vals for field in fields): + res.order_id._check_minimum_amount() + return records + + def write(self, vals): + res = super(PurchaseOrderLine, self).write(vals) + fields = self._check_minimum_amount_fields() + for rec in self: + if any(field in vals for field in fields): + rec.order_id._check_minimum_amount() + return res diff --git a/purchase_minimum_amount/readme/CONFIGURE.rst b/purchase_minimum_amount/readme/CONFIGURE.rst new file mode 100644 index 00000000000..a6cf210838b --- /dev/null +++ b/purchase_minimum_amount/readme/CONFIGURE.rst @@ -0,0 +1,6 @@ +* Go to 'Purchases / Purchase / Vendors' +* Click on a Vendor and inside the 'Sales & Purchases' page specify the + non-required field 'Minimum Purchase Amount'. +* Assign the security group 'Release RFQ with approval block' to users that + should be able to release the block. Users in group 'Purchase / Managers' + are by default assigned to this group. diff --git a/purchase_minimum_amount/readme/CONTRIBUTORS.rst b/purchase_minimum_amount/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..df735396d7c --- /dev/null +++ b/purchase_minimum_amount/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* Jordi Ballester Alomar +* Roser Garcia +* Darshan Patel +* Nikul Chaudhary diff --git a/purchase_minimum_amount/readme/DESCRIPTION.rst b/purchase_minimum_amount/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..ec47077a6c1 --- /dev/null +++ b/purchase_minimum_amount/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module allows you to establish and automate a specific Purchase Order +Approval Block Reason in the system: the 'Minimum Purchase Order Amount per +Vendor'. diff --git a/purchase_minimum_amount/readme/USAGE.rst b/purchase_minimum_amount/readme/USAGE.rst new file mode 100644 index 00000000000..58037e5a402 --- /dev/null +++ b/purchase_minimum_amount/readme/USAGE.rst @@ -0,0 +1,38 @@ +Set the Purchase Approval Block +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +#. Go to 'Purchases / Purchase / Requests for Quotation' +#. Create a new RFQ and upon saving if the Untaxed Amount is below the + Purchase Minimum Amount specified in that vendor, then the Approval Block + Reason is automatically set and the Approval Block Reason is not editable + anymore. + +Search existing RFQ +~~~~~~~~~~~~~~~~~~~ + +There is a filter 'Blocked' to search for orders that are blocked. +It is also possible to search RFQ’s with the Approval Block Reason 'Minimum +Purchase Order Amount per Vendor'. + +Confirm the RFQ +~~~~~~~~~~~~~~~ + +#. Press the button ‘Confirm’. If there’s an approval block, the order will + be set to status 'To Approve'. You will then need to request a Purchase + Manager to approve it. + +Release the purchase approval block +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +#. All the RFQ’s with a total amount surpassing the specified Minimum Purchase + Order Amount for that vendor (excluding taxes) are automatically released. +#. If a blocked RFQ without surpassing the minimum amount wants to be + released, a user member of the security group 'Release RFQ with approval + block' can see a button 'Release Approval Block'. When pressing it, anyone + seeing that RFQ is able to validate it. + +Notifications to followers +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +#. Followers of the RFQ receive notifications when an approval block has been + set or released. diff --git a/purchase_minimum_amount/static/description/icon.png b/purchase_minimum_amount/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/purchase_minimum_amount/static/description/icon.png differ diff --git a/purchase_minimum_amount/static/description/index.html b/purchase_minimum_amount/static/description/index.html new file mode 100644 index 00000000000..54d85c4d720 --- /dev/null +++ b/purchase_minimum_amount/static/description/index.html @@ -0,0 +1,493 @@ + + + + + +Purchase Minimum Amount + + + +
+

Purchase Minimum Amount

+ + +

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

+

This module allows you to establish and automate a specific Purchase Order +Approval Block Reason in the system: the ‘Minimum Purchase Order Amount per +Vendor’.

+

Table of contents

+ +
+

Configuration

+
    +
  • Go to ‘Purchases / Purchase / Vendors’
  • +
  • Click on a Vendor and inside the ‘Sales & Purchases’ page specify the +non-required field ‘Minimum Purchase Amount’.
  • +
  • Assign the security group ‘Release RFQ with approval block’ to users that +should be able to release the block. Users in group ‘Purchase / Managers’ +are by default assigned to this group.
  • +
+
+
+

Usage

+
+

Set the Purchase Approval Block

+
    +
  1. Go to ‘Purchases / Purchase / Requests for Quotation’
  2. +
  3. Create a new RFQ and upon saving if the Untaxed Amount is below the +Purchase Minimum Amount specified in that vendor, then the Approval Block +Reason is automatically set and the Approval Block Reason is not editable +anymore.
  4. +
+
+
+

Search existing RFQ

+

There is a filter ‘Blocked’ to search for orders that are blocked. +It is also possible to search RFQ’s with the Approval Block Reason ‘Minimum +Purchase Order Amount per Vendor’.

+
+
+

Confirm the RFQ

+
    +
  1. Press the button ‘Confirm’. If there’s an approval block, the order will +be set to status ‘To Approve’. You will then need to request a Purchase +Manager to approve it.
  2. +
+
+
+

Release the purchase approval block

+
    +
  1. All the RFQ’s with a total amount surpassing the specified Minimum Purchase +Order Amount for that vendor (excluding taxes) are automatically released.
  2. +
  3. If a blocked RFQ without surpassing the minimum amount wants to be +released, a user member of the security group ‘Release RFQ with approval +block’ can see a button ‘Release Approval Block’. When pressing it, anyone +seeing that RFQ is able to validate it.
  4. +
+
+
+

Notifications to followers

+
    +
  1. Followers of the RFQ receive notifications when an approval block has been +set or released.
  2. +
+
+
+
+

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

+
    +
  • ForgeFlow
  • +
+
+
+

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/purchase_minimum_amount/tests/__init__.py b/purchase_minimum_amount/tests/__init__.py new file mode 100644 index 00000000000..93b5de3a7d4 --- /dev/null +++ b/purchase_minimum_amount/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import test_po_minimum_amount_block diff --git a/purchase_minimum_amount/tests/test_po_minimum_amount_block.py b/purchase_minimum_amount/tests/test_po_minimum_amount_block.py new file mode 100644 index 00000000000..08391911922 --- /dev/null +++ b/purchase_minimum_amount/tests/test_po_minimum_amount_block.py @@ -0,0 +1,127 @@ +# Copyright 2017 ForgeFlow S.L. +# Copyright 2017 Serpent Consulting Services Pvt. Ltd. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +import time + +from odoo.tests.common import TransactionCase +from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT + + +class TestPoAmountBlock(TransactionCase): + def setUp(self): + super(TestPoAmountBlock, self).setUp() + self.users_obj = self.env["res.users"] + self.po_obj = self.env["purchase.order"] + self.po_block_obj = self.env["purchase.approval.block.reason"] + # company + self.company1 = self.env.ref("base.main_company") + # groups + self.group_purchase_user = self.env.ref("purchase.group_purchase_user") + self.group_purchase_manager = self.env.ref("purchase.group_purchase_manager") + # Partner + self.partner1 = self.env["res.partner"].create( + { + "name": "Partner", + } + ) + # Products + self.product1 = self.env["product.product"].create({"name": "Product 1"}) + self.product2 = self.env["product.product"].create({"name": "Product 2"}) + self.product3 = self.env["product.product"].create({"name": "Product 3"}) + # Create users + self.user1_id = self._create_user( + "user_1", + [self.group_purchase_user], + self.company1, + ) + self.user2_id = self._create_user( + "user_2", + [self.group_purchase_manager], + self.company1, + ) + + def _create_user(self, login, groups, company): + """Create a user.""" + group_ids = [group.id for group in groups] + user = self.users_obj.with_context(no_reset_password=True).create( + { + "name": "Purchase User", + "login": login, + "password": "test", + "email": "test@yourcompany.com", + "company_id": company.id, + "company_ids": [(4, company.id)], + "groups_id": [(6, 0, group_ids)], + } + ) + return user.id + + def _create_purchase(self, line_products): + """Create a purchase order. + ``line_products`` is a list of tuple [(product, qty)] + """ + lines = [] + for product, qty in line_products: + line_values = { + "name": product.name, + "product_id": product.id, + "product_qty": qty, + "product_uom": product.uom_id.id, + "price_unit": 100, + "date_planned": time.strftime(DEFAULT_SERVER_DATETIME_FORMAT), + } + lines.append((0, 0, line_values)) + purchase = self.po_obj.create( + { + "partner_id": self.partner1.id, + "approval_block_id": self.po_block_obj.id, + "order_line": lines, + "company_id": self.company1.id, + } + ) + return purchase + + def test_po_amount_block_under_minimum_manager_user_release(self): + """Test PO Block for Minimum Threshold Vendor Amount""" + self.partner1.write({"minimum_po_amount": 1500.00}) + + # Create a PO with an amount below the minimum and check that the + # Approval Block Reason is correctly assign + purchase1 = self._create_purchase( + [(self.product1, 1), (self.product2, 5), (self.product3, 8)] + ) + + self.assertEqual( + purchase1.approval_block_id, + self.env.ref("purchase_minimum_amount.minimum_amount_block_reason"), + ) + + purchase1.with_user(self.user1_id).button_confirm() + self.assertEqual(purchase1.state, "draft") + # Release the PO by pressing the button and then confirming the order + purchase1.with_user(self.user2_id).button_release_approval_block() + purchase1.button_confirm() + self.assertEqual(purchase1.state, "purchase") + + def test_po_amount_block_above_minimum_group_user(self): + """Test PO Block for Minimum Threshold Vendor Amount""" + self.partner1.write({"minimum_po_amount": 1500.00}) + + purchase1 = self._create_purchase( + [(self.product1, 1), (self.product2, 5), (self.product3, 8)] + ) + + self.assertEqual( + purchase1.approval_block_id, + self.env.ref("purchase_minimum_amount.minimum_amount_block_reason"), + ) + + for po_line in purchase1.order_line: + if po_line.product_id == self.product1: + po_line.product_qty = 10 + purchase1.flush_recordset() + self.assertFalse(purchase1.approval_block_id) + + purchase1.with_user(self.user1_id).button_confirm() + self.assertEqual(purchase1.state, "purchase") diff --git a/purchase_minimum_amount/views/purchase_order_view.xml b/purchase_minimum_amount/views/purchase_order_view.xml new file mode 100644 index 00000000000..4fe56eda74d --- /dev/null +++ b/purchase_minimum_amount/views/purchase_order_view.xml @@ -0,0 +1,41 @@ + + + + + purchase.order.form.minimum.po.amount + purchase.order + + + + + + + {'invisible': ['|',('approval_block_id', '=', False),('state', 'not in', ['draft', 'sent', 'to approve'])]} + + + + + request.quotation.minimum.block.reason + purchase.order + + + + [('approval_block_id', '!=', False)] + + + + diff --git a/purchase_minimum_amount/views/res_partner_view.xml b/purchase_minimum_amount/views/res_partner_view.xml new file mode 100644 index 00000000000..4b96a7fccf1 --- /dev/null +++ b/purchase_minimum_amount/views/res_partner_view.xml @@ -0,0 +1,21 @@ + + + + + res.partner.form.block.reason + res.partner + + + + + + + + diff --git a/setup/purchase_minimum_amount/odoo/addons/purchase_minimum_amount b/setup/purchase_minimum_amount/odoo/addons/purchase_minimum_amount new file mode 120000 index 00000000000..4ca452ab42e --- /dev/null +++ b/setup/purchase_minimum_amount/odoo/addons/purchase_minimum_amount @@ -0,0 +1 @@ +../../../../purchase_minimum_amount \ No newline at end of file diff --git a/setup/purchase_minimum_amount/setup.py b/setup/purchase_minimum_amount/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/purchase_minimum_amount/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)