diff --git a/purchase_reception_status/README.rst b/purchase_reception_status/README.rst new file mode 100644 index 00000000000..afff9b9d7e5 --- /dev/null +++ b/purchase_reception_status/README.rst @@ -0,0 +1,103 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +========================= +Purchase Reception Status +========================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:ffb8b08e10dfeca5608fead37d119b50b8dbbf441adf1e2a9d6af8ceca4122c2 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-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/19.0/purchase_reception_status + :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-19-0/purchase-workflow-19-0-purchase_reception_status + :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=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds a field *Receiption Status* on purchase orders. On a +confirmed purchase order, it can have 3 different values: + +- Nothing Received +- Partially Received +- Fully Received + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +If you are part of the *Purchase Manager* group, you can force a +confirmed purchase order to **Full Received** status: you should first +*lock* the order (to enable locking, ensure the 'Locked' setting is +checked in the Purchase configuration), then check the field **Force +Received** located in the *Other Information* tab. + +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 +------- + +* Akretion + +Contributors +------------ + +- Alexis de Lattre +- Urvisha Desai + +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-alexis-via| image:: https://github.com/alexis-via.png?size=40px + :target: https://github.com/alexis-via + :alt: alexis-via + +Current `maintainer `__: + +|maintainer-alexis-via| + +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_reception_status/__init__.py b/purchase_reception_status/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/purchase_reception_status/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/purchase_reception_status/__manifest__.py b/purchase_reception_status/__manifest__.py new file mode 100644 index 00000000000..cf30ff8fdb4 --- /dev/null +++ b/purchase_reception_status/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2020 Akretion France (http://www.akretion.com/) +# @author: Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Purchase Reception Status", + "version": "19.0.1.0.0", + "category": "Purchases", + "license": "AGPL-3", + "summary": "Add reception status on purchase orders (OCA logic)", + "author": "Akretion,Odoo Community Association (OCA)", + "maintainers": ["alexis-via"], + "website": "https://github.com/OCA/purchase-workflow", + "depends": ["purchase_stock"], + "data": ["views/purchase_order.xml"], + "installable": True, +} diff --git a/purchase_reception_status/i18n/es.po b/purchase_reception_status/i18n/es.po new file mode 100644 index 00000000000..395b58a7ad5 --- /dev/null +++ b/purchase_reception_status/i18n/es.po @@ -0,0 +1,65 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_reception_status +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-12-29 10:35+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: none\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_reception_status +#: model:ir.model.fields,field_description:purchase_reception_status.field_purchase_order__force_received +msgid "Force Received" +msgstr "Forzar Recibido" + +#. module: purchase_reception_status +#: model:ir.model.fields.selection,name:purchase_reception_status.selection__purchase_order__reception_status__received +#: model_terms:ir.ui.view,arch_db:purchase_reception_status.view_purchase_order_filter +msgid "Fully Received" +msgstr "Totalmente Recibido" + +#. module: purchase_reception_status +#: model:ir.model.fields,help:purchase_reception_status.field_purchase_order__force_received +msgid "" +"If true, the reception status will be forced to Fully Received, even if some" +" lines are not fully received. To be able to modify this field, you must " +"first lock the order." +msgstr "" +"Si es verdadero, el estado de recepción será forzado a Recibido " +"Completamente, incluso si algunas líneas no se reciben en su totalidad. Para " +"poder modificar este campo, primero debes bloquear el pedido." + +#. module: purchase_reception_status +#: model_terms:ir.ui.view,arch_db:purchase_reception_status.view_purchase_order_filter +msgid "Not Fully Received" +msgstr "No se ha Recibido Totalmente" + +#. module: purchase_reception_status +#: model:ir.model.fields.selection,name:purchase_reception_status.selection__purchase_order__reception_status__no +msgid "Nothing Received" +msgstr "Nada Recibido" + +#. module: purchase_reception_status +#: model:ir.model.fields.selection,name:purchase_reception_status.selection__purchase_order__reception_status__partial +msgid "Partially Received" +msgstr "Parcialmente Recibido" + +#. module: purchase_reception_status +#: model:ir.model,name:purchase_reception_status.model_purchase_order +msgid "Purchase Order" +msgstr "Orden de Compra" + +#. module: purchase_reception_status +#: model:ir.model.fields,field_description:purchase_reception_status.field_purchase_order__reception_status +#: model_terms:ir.ui.view,arch_db:purchase_reception_status.view_purchase_order_filter +msgid "Reception Status" +msgstr "Estado de Recepción" diff --git a/purchase_reception_status/i18n/fr.po b/purchase_reception_status/i18n/fr.po new file mode 100644 index 00000000000..adc9ca99523 --- /dev/null +++ b/purchase_reception_status/i18n/fr.po @@ -0,0 +1,62 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_reception_status +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2025-05-27 09:26+0000\n" +"Last-Translator: MDgrap \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.10.4\n" + +#. module: purchase_reception_status +#: model:ir.model.fields,field_description:purchase_reception_status.field_purchase_order__force_received +msgid "Force Received" +msgstr "Forcer réception" + +#. module: purchase_reception_status +#: model:ir.model.fields.selection,name:purchase_reception_status.selection__purchase_order__reception_status__received +#: model_terms:ir.ui.view,arch_db:purchase_reception_status.view_purchase_order_filter +msgid "Fully Received" +msgstr "Totalement réceptionné" + +#. module: purchase_reception_status +#: model:ir.model.fields,help:purchase_reception_status.field_purchase_order__force_received +msgid "" +"If true, the reception status will be forced to Fully Received, even if some " +"lines are not fully received. To be able to modify this field, you must " +"first lock the order." +msgstr "" + +#. module: purchase_reception_status +#: model_terms:ir.ui.view,arch_db:purchase_reception_status.view_purchase_order_filter +msgid "Not Fully Received" +msgstr "" + +#. module: purchase_reception_status +#: model:ir.model.fields.selection,name:purchase_reception_status.selection__purchase_order__reception_status__no +msgid "Nothing Received" +msgstr "" + +#. module: purchase_reception_status +#: model:ir.model.fields.selection,name:purchase_reception_status.selection__purchase_order__reception_status__partial +msgid "Partially Received" +msgstr "" + +#. module: purchase_reception_status +#: model:ir.model,name:purchase_reception_status.model_purchase_order +msgid "Purchase Order" +msgstr "" + +#. module: purchase_reception_status +#: model:ir.model.fields,field_description:purchase_reception_status.field_purchase_order__reception_status +#: model_terms:ir.ui.view,arch_db:purchase_reception_status.view_purchase_order_filter +msgid "Reception Status" +msgstr "" diff --git a/purchase_reception_status/i18n/it.po b/purchase_reception_status/i18n/it.po new file mode 100644 index 00000000000..bc0a69f80e6 --- /dev/null +++ b/purchase_reception_status/i18n/it.po @@ -0,0 +1,65 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_reception_status +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2025-09-17 10:36+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: purchase_reception_status +#: model:ir.model.fields,field_description:purchase_reception_status.field_purchase_order__force_received +msgid "Force Received" +msgstr "Forza a ricevuto" + +#. module: purchase_reception_status +#: model:ir.model.fields.selection,name:purchase_reception_status.selection__purchase_order__reception_status__received +#: model_terms:ir.ui.view,arch_db:purchase_reception_status.view_purchase_order_filter +msgid "Fully Received" +msgstr "Ricevuto completamente" + +#. module: purchase_reception_status +#: model:ir.model.fields,help:purchase_reception_status.field_purchase_order__force_received +msgid "" +"If true, the reception status will be forced to Fully Received, even if some " +"lines are not fully received. To be able to modify this field, you must " +"first lock the order." +msgstr "" +"Se vero, lo stato di ricezione sarà forzato a Completamente Ricevuto, anche " +"se alcune righe non sono state completamente ricevute. Per essere in grado " +"di modificare questo campo, devi prima aver bloccato l'ordine." + +#. module: purchase_reception_status +#: model_terms:ir.ui.view,arch_db:purchase_reception_status.view_purchase_order_filter +msgid "Not Fully Received" +msgstr "Ricevuto Parzialmente" + +#. module: purchase_reception_status +#: model:ir.model.fields.selection,name:purchase_reception_status.selection__purchase_order__reception_status__no +msgid "Nothing Received" +msgstr "Nulla ricevuto" + +#. module: purchase_reception_status +#: model:ir.model.fields.selection,name:purchase_reception_status.selection__purchase_order__reception_status__partial +msgid "Partially Received" +msgstr "Ricevuto parzialmente" + +#. module: purchase_reception_status +#: model:ir.model,name:purchase_reception_status.model_purchase_order +msgid "Purchase Order" +msgstr "Ordine di acquisto" + +#. module: purchase_reception_status +#: model:ir.model.fields,field_description:purchase_reception_status.field_purchase_order__reception_status +#: model_terms:ir.ui.view,arch_db:purchase_reception_status.view_purchase_order_filter +msgid "Reception Status" +msgstr "Stato ricezione" diff --git a/purchase_reception_status/i18n/ja.po b/purchase_reception_status/i18n/ja.po new file mode 100644 index 00000000000..f5f5614a922 --- /dev/null +++ b/purchase_reception_status/i18n/ja.po @@ -0,0 +1,65 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_reception_status +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-01-10 02:02+0000\n" +"Last-Translator: Wang-TKurata \n" +"Language-Team: none\n" +"Language: ja\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 4.14.1\n" + +#. module: purchase_reception_status +#: model:ir.model.fields,field_description:purchase_reception_status.field_purchase_order__force_received +msgid "Force Received" +msgstr "強制受領" + +#. module: purchase_reception_status +#: model:ir.model.fields.selection,name:purchase_reception_status.selection__purchase_order__reception_status__received +#: model_terms:ir.ui.view,arch_db:purchase_reception_status.view_purchase_order_filter +msgid "Fully Received" +msgstr "完納" + +#. module: purchase_reception_status +#: model:ir.model.fields,help:purchase_reception_status.field_purchase_order__force_received +msgid "" +"If true, the reception status will be forced to Fully Received, even if some " +"lines are not fully received. To be able to modify this field, you must " +"first lock the order." +msgstr "" +"チェックを付けた場合、未受領の明細が有ったとしても受領ステータスは強制的に完" +"全受領済みとなります。この項目を編集するためにはオーダーのロックを解除する必" +"要があります。" + +#. module: purchase_reception_status +#: model_terms:ir.ui.view,arch_db:purchase_reception_status.view_purchase_order_filter +msgid "Not Fully Received" +msgstr "未完納" + +#. module: purchase_reception_status +#: model:ir.model.fields.selection,name:purchase_reception_status.selection__purchase_order__reception_status__no +msgid "Nothing Received" +msgstr "未受領" + +#. module: purchase_reception_status +#: model:ir.model.fields.selection,name:purchase_reception_status.selection__purchase_order__reception_status__partial +msgid "Partially Received" +msgstr "分納" + +#. module: purchase_reception_status +#: model:ir.model,name:purchase_reception_status.model_purchase_order +msgid "Purchase Order" +msgstr "購買オーダ" + +#. module: purchase_reception_status +#: model:ir.model.fields,field_description:purchase_reception_status.field_purchase_order__reception_status +#: model_terms:ir.ui.view,arch_db:purchase_reception_status.view_purchase_order_filter +msgid "Reception Status" +msgstr "納入状況" diff --git a/purchase_reception_status/i18n/pt.po b/purchase_reception_status/i18n/pt.po new file mode 100644 index 00000000000..eac7a8351b5 --- /dev/null +++ b/purchase_reception_status/i18n/pt.po @@ -0,0 +1,65 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_reception_status +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2025-02-25 20:06+0000\n" +"Last-Translator: Peter Romão \n" +"Language-Team: none\n" +"Language: pt\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 5.6.2\n" + +#. module: purchase_reception_status +#: model:ir.model.fields,field_description:purchase_reception_status.field_purchase_order__force_received +msgid "Force Received" +msgstr "Forçar Recebido" + +#. module: purchase_reception_status +#: model:ir.model.fields.selection,name:purchase_reception_status.selection__purchase_order__reception_status__received +#: model_terms:ir.ui.view,arch_db:purchase_reception_status.view_purchase_order_filter +msgid "Fully Received" +msgstr "Completamente Recebido" + +#. module: purchase_reception_status +#: model:ir.model.fields,help:purchase_reception_status.field_purchase_order__force_received +msgid "" +"If true, the reception status will be forced to Fully Received, even if some" +" lines are not fully received. To be able to modify this field, you must " +"first lock the order." +msgstr "" +"Se verdadeiro o estado da recepção será forçado a Completamente Recebido, " +"mesmo que algumas linhas não tenham sido completamente recebidas. Para poder " +"modificar este campo, primeiro, deve-se bloquear a encomenda." + +#. module: purchase_reception_status +#: model_terms:ir.ui.view,arch_db:purchase_reception_status.view_purchase_order_filter +msgid "Not Fully Received" +msgstr "Não Recebido Completamente" + +#. module: purchase_reception_status +#: model:ir.model.fields.selection,name:purchase_reception_status.selection__purchase_order__reception_status__no +msgid "Nothing Received" +msgstr "Nada Recebido" + +#. module: purchase_reception_status +#: model:ir.model.fields.selection,name:purchase_reception_status.selection__purchase_order__reception_status__partial +msgid "Partially Received" +msgstr "Parcialmente Recebido" + +#. module: purchase_reception_status +#: model:ir.model,name:purchase_reception_status.model_purchase_order +msgid "Purchase Order" +msgstr "Ordem de Compra" + +#. module: purchase_reception_status +#: model:ir.model.fields,field_description:purchase_reception_status.field_purchase_order__reception_status +#: model_terms:ir.ui.view,arch_db:purchase_reception_status.view_purchase_order_filter +msgid "Reception Status" +msgstr "Estado da Receção" diff --git a/purchase_reception_status/i18n/purchase_reception_status.pot b/purchase_reception_status/i18n/purchase_reception_status.pot new file mode 100644 index 00000000000..d26504cfc61 --- /dev/null +++ b/purchase_reception_status/i18n/purchase_reception_status.pot @@ -0,0 +1,66 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_reception_status +# +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: purchase_reception_status +#: model:ir.model.fields,field_description:purchase_reception_status.field_purchase_order__force_received +msgid "Force Received" +msgstr "" + +#. module: purchase_reception_status +#: model:ir.model.fields.selection,name:purchase_reception_status.selection__purchase_order__receipt_status__full +#: model_terms:ir.ui.view,arch_db:purchase_reception_status.view_purchase_order_filter +msgid "Fully Received" +msgstr "" + +#. module: purchase_reception_status +#: model:ir.model.fields,help:purchase_reception_status.field_purchase_order__force_received +msgid "" +"If true, the order is marked forced only when all lines are fully received " +"and at least one line was manually forced." +msgstr "" + +#. module: purchase_reception_status +#: model_terms:ir.ui.view,arch_db:purchase_reception_status.view_purchase_order_filter +msgid "Not Fully Received" +msgstr "" + +#. module: purchase_reception_status +#: model:ir.model.fields.selection,name:purchase_reception_status.selection__purchase_order__receipt_status__pending +msgid "Nothing Received" +msgstr "" + +#. module: purchase_reception_status +#: model:ir.model.fields.selection,name:purchase_reception_status.selection__purchase_order__receipt_status__partial +msgid "Partially Received" +msgstr "" + +#. module: purchase_reception_status +#: model:ir.model,name:purchase_reception_status.model_purchase_order +msgid "Purchase Order" +msgstr "" + +#. module: purchase_reception_status +#: model:ir.model.fields,field_description:purchase_reception_status.field_purchase_order__receipt_status +#: model_terms:ir.ui.view,arch_db:purchase_reception_status.view_purchase_order_filter +msgid "Receipt Status" +msgstr "" + +#. module: purchase_reception_status +#: model:ir.model.fields,help:purchase_reception_status.field_purchase_order__receipt_status +msgid "" +"Red: Late\n" +" Orange: To process today\n" +" Green: On time" +msgstr "" diff --git a/purchase_reception_status/models/__init__.py b/purchase_reception_status/models/__init__.py new file mode 100644 index 00000000000..9f03530643d --- /dev/null +++ b/purchase_reception_status/models/__init__.py @@ -0,0 +1 @@ +from . import purchase_order diff --git a/purchase_reception_status/models/purchase_order.py b/purchase_reception_status/models/purchase_order.py new file mode 100644 index 00000000000..94173f257dc --- /dev/null +++ b/purchase_reception_status/models/purchase_order.py @@ -0,0 +1,60 @@ +# Copyright 2020 Akretion France (http://www.akretion.com/) +# @author: Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models +from odoo.tools import float_compare + + +class PurchaseOrder(models.Model): + _inherit = "purchase.order" + + receipt_status = fields.Selection( + [ + ("pending", "Nothing Received"), + ("partial", "Partially Received"), + ("full", "Fully Received"), + ], + compute="_compute_oca_receipt_status", + store=True, + ) + force_received = fields.Boolean( + readonly=True, + copy=False, + help="If true, the reception status will be forced to Fully Received, " + "even if some lines are not fully received. " + "To be able to modify this field, you must first lock the order.", + ) + + @api.depends( + "state", + "force_received", + "locked", + "order_line.qty_received", + "order_line.product_qty", + ) + def _compute_oca_receipt_status(self): + prec = self.env["decimal.precision"].precision_get("Product Unit") + for order in self: + status = "pending" + if order.state == "purchase" or order.locked: + if order.force_received: + status = "full" + elif all( + [ + float_compare( + line.qty_received, line.product_qty, precision_digits=prec + ) + >= 0 + for line in order.order_line + ] + ): + status = "full" + elif any( + [ + float_compare(line.qty_received, 0, precision_digits=prec) > 0 + for line in order.order_line + ] + ): + status = "partial" + order.receipt_status = status diff --git a/purchase_reception_status/pyproject.toml b/purchase_reception_status/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/purchase_reception_status/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/purchase_reception_status/readme/CONTRIBUTORS.md b/purchase_reception_status/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..4a6a2bbeba9 --- /dev/null +++ b/purchase_reception_status/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- Alexis de Lattre \ +- Urvisha Desai \ diff --git a/purchase_reception_status/readme/DESCRIPTION.md b/purchase_reception_status/readme/DESCRIPTION.md new file mode 100644 index 00000000000..d57922f543d --- /dev/null +++ b/purchase_reception_status/readme/DESCRIPTION.md @@ -0,0 +1,6 @@ +This module adds a field *Receiption Status* on purchase orders. On a +confirmed purchase order, it can have 3 different values: + +- Nothing Received +- Partially Received +- Fully Received diff --git a/purchase_reception_status/readme/USAGE.md b/purchase_reception_status/readme/USAGE.md new file mode 100644 index 00000000000..c676e7b9532 --- /dev/null +++ b/purchase_reception_status/readme/USAGE.md @@ -0,0 +1,5 @@ +If you are part of the *Purchase Manager* group, you can force a +confirmed purchase order to **Full Received** status: you should first +*lock* the order (to enable locking, ensure the 'Locked' setting is checked +in the Purchase configuration), then check the field **Force Received** located in the +*Other Information* tab. diff --git a/purchase_reception_status/static/description/icon.png b/purchase_reception_status/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/purchase_reception_status/static/description/icon.png differ diff --git a/purchase_reception_status/static/description/index.html b/purchase_reception_status/static/description/index.html new file mode 100644 index 00000000000..4398b01975d --- /dev/null +++ b/purchase_reception_status/static/description/index.html @@ -0,0 +1,447 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Purchase Reception Status

+ +

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

+

This module adds a field Receiption Status on purchase orders. On a +confirmed purchase order, it can have 3 different values:

+
    +
  • Nothing Received
  • +
  • Partially Received
  • +
  • Fully Received
  • +
+

Table of contents

+ +
+

Usage

+

If you are part of the Purchase Manager group, you can force a +confirmed purchase order to Full Received status: you should first +lock the order (to enable locking, ensure the ‘Locked’ setting is +checked in the Purchase configuration), then check the field Force +Received located in the Other Information tab.

+
+
+

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

+
    +
  • Akretion
  • +
+
+ +
+

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:

+

alexis-via

+

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_reception_status/tests/__init__.py b/purchase_reception_status/tests/__init__.py new file mode 100644 index 00000000000..59dbd4c385a --- /dev/null +++ b/purchase_reception_status/tests/__init__.py @@ -0,0 +1 @@ +from . import test_purchase_reception_status diff --git a/purchase_reception_status/tests/test_purchase_reception_status.py b/purchase_reception_status/tests/test_purchase_reception_status.py new file mode 100644 index 00000000000..bf6f3cb8327 --- /dev/null +++ b/purchase_reception_status/tests/test_purchase_reception_status.py @@ -0,0 +1,92 @@ +# Copyright 2025 ForgeFlow S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields +from odoo.tests.common import TransactionCase + + +class TestPurchaseReceptionStatus(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.supplier = cls.env["res.partner"].create( + { + "name": "Test Supplier", + "is_company": True, + "supplier_rank": 1, + } + ) + cls.product_1 = cls.env["product.product"].create( + { + "name": "Test Product 1", + "type": "consu", + "purchase_method": "receive", + "list_price": 100.0, + "is_storable": True, + } + ) + + def test_01_receipt_status_functionality(self): + po = self.env["purchase.order"].create( + { + "partner_id": self.supplier.id, + } + ) + pol = self.env["purchase.order.line"].create( + { + "order_id": po.id, + "product_id": self.product_1.id, + "name": self.product_1.name, + "product_qty": 10.0, + "product_uom_id": self.product_1.uom_id.id, + "price_unit": 100.0, + "date_planned": fields.Date.today(), + } + ) + po.button_confirm() + self.assertEqual(po.receipt_status, "pending") + pol.qty_received = 5.0 + self.assertEqual(po.receipt_status, "partial") + po.button_lock() + po.force_received = True + self.assertEqual(po.receipt_status, "full") + + def test_02_receipt_status_draft_state(self): + po = self.env["purchase.order"].create( + { + "partner_id": self.supplier.id, + } + ) + self.env["purchase.order.line"].create( + { + "order_id": po.id, + "product_id": self.product_1.id, + "name": self.product_1.name, + "product_qty": 10.0, + "product_uom_id": self.product_1.uom_id.id, + "price_unit": 100.0, + "date_planned": fields.Date.today(), + } + ) + self.assertEqual(po.receipt_status, "pending") + + def test_03_receipt_status_over_received(self): + po = self.env["purchase.order"].create( + { + "partner_id": self.supplier.id, + } + ) + pol = self.env["purchase.order.line"].create( + { + "order_id": po.id, + "product_id": self.product_1.id, + "name": self.product_1.name, + "product_qty": 10.0, + "product_uom_id": self.product_1.uom_id.id, + "price_unit": 100.0, + "date_planned": fields.Date.today(), + } + ) + po.button_confirm() + pol.qty_received = 15.0 + self.assertEqual(po.receipt_status, "full") diff --git a/purchase_reception_status/views/purchase_order.xml b/purchase_reception_status/views/purchase_order.xml new file mode 100644 index 00000000000..a0396312b50 --- /dev/null +++ b/purchase_reception_status/views/purchase_order.xml @@ -0,0 +1,67 @@ + + + + + received_status.purchase.order.form + purchase.order + + + + + + + + + received_status.purchase.order.tree + purchase.order + + + + + + + + + received_status.purchase.order.search + purchase.order + + + + + + + + + + + + +