diff --git a/fieldservice_stock_request/README.rst b/fieldservice_stock_request/README.rst new file mode 100644 index 0000000000..3cbc6081a1 --- /dev/null +++ b/fieldservice_stock_request/README.rst @@ -0,0 +1,145 @@ +============================= +Field Service - Stock Request +============================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:814fcea97c78db0a0d9f0de05677ba2b6a1a64c55a1404934702e65f3835b431 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Ffield--service-lightgray.png?logo=github + :target: https://github.com/OCA/field-service/tree/16.0/fieldservice_stock_request + :alt: OCA/field-service +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/field-service-16-0/field-service-16-0-fieldservice_stock_request + :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/field-service&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module is an add-on for the Field Service application in Odoo. +It provides stock requests in field service orders. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To configure this module, you need to: + +* Go to Inventory > Configuration > Routes +* Select the routes that you want to use from a FSM order +* Check the box 'FSM Order Line' for outbound transfer +* Check the box 'FSM Return Line' for inbound transfer + +The route 'Receipt in 1 step' has no procurement rule so if you want items to be +returned from the service location to your warehouse, you need to create a new +procurement rule for that route: + +* Name: YourCompany: Return +* Action: Move From Another Location +* Procurement Location: WH/Stock +* Served Warehouse: YourCompany +* Source Location: Partner Locations/Customers +* Move Supply Method: Take From Stock +* Operation Type: YourCompany: Receipts + +Usage +===== + +To use this module, you need to: + +* Create a new service order +* Under the Inventory tab, select the warehouse and add products with quantity +* Confirm the order to create the delivery orders +* Validate the transfers in the Inventory app. Quantities delivered on FSM + Order Line will be updated. + +Known issues / Roadmap +====================== + +The roadmap of the Field Service application is documented on +`Github `_. + +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 +~~~~~~~ + +* Open Source Integrators +* Brian McMaster + +Contributors +~~~~~~~~~~~~ + +* Brian McMaster +* Sandip Mangukiya +* Serpent Consulting Services Pvt. Ltd. +* [APSL](https://apsl.tech): + * Antoni Marroig + +Other credits +~~~~~~~~~~~~~ + +The development of this module has been financially supported by: + +* Open Source Integrators + +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-brian10048| image:: https://github.com/brian10048.png?size=40px + :target: https://github.com/brian10048 + :alt: brian10048 +.. |maintainer-wolfhall| image:: https://github.com/wolfhall.png?size=40px + :target: https://github.com/wolfhall + :alt: wolfhall +.. |maintainer-max3903| image:: https://github.com/max3903.png?size=40px + :target: https://github.com/max3903 + :alt: max3903 +.. |maintainer-smangukiya| image:: https://github.com/smangukiya.png?size=40px + :target: https://github.com/smangukiya + :alt: smangukiya + +Current `maintainers `__: + +|maintainer-brian10048| |maintainer-wolfhall| |maintainer-max3903| |maintainer-smangukiya| + +This module is part of the `OCA/field-service `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/fieldservice_stock_request/__init__.py b/fieldservice_stock_request/__init__.py new file mode 100644 index 0000000000..e2a511ea6f --- /dev/null +++ b/fieldservice_stock_request/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2021 - TODAY, Brian McMaster +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/fieldservice_stock_request/__manifest__.py b/fieldservice_stock_request/__manifest__.py new file mode 100644 index 0000000000..ba01c72a25 --- /dev/null +++ b/fieldservice_stock_request/__manifest__.py @@ -0,0 +1,29 @@ +# Copyright (C) 2021 - TODAY, Brian McMaster +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Field Service - Stock Request", + "summary": "Integrate Stock Requests with Field Service Orders", + "version": "16.0.1.0.0", + "category": "Field Service", + "author": "Open Source Integrators, " + "Brian McMaster, " + "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/field-service", + "depends": [ + "fieldservice_stock", + "stock_request_direction", + "stock_request_picking_type", + "stock_request_submit", + ], + "data": [ + "security/ir.model.access.csv", + "views/fsm_order.xml", + "views/stock.xml", + "views/stock_request.xml", + "views/stock_request_order.xml", + ], + "license": "AGPL-3", + "development_status": "Beta", + "maintainers": ["brian10048", "wolfhall", "max3903", "smangukiya"], +} diff --git a/fieldservice_stock_request/i18n/es.po b/fieldservice_stock_request/i18n/es.po new file mode 100644 index 0000000000..10b87cef96 --- /dev/null +++ b/fieldservice_stock_request/i18n/es.po @@ -0,0 +1,160 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_stock_request +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-02-22 19:34+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: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Cancel" +msgstr "Cancelar" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__cancel +msgid "Cancelled" +msgstr "Cancelado" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line__display_name +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__display_name +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__display_name +msgid "Display Name" +msgstr "Mostrar Nombre" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__done +msgid "Done" +msgstr "Realizado" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__draft +msgid "Draft" +msgstr "Borrador" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__fsm_order_id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__fsm_order_id +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search +msgid "FSM Order" +msgstr "Orden FSM" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_fsm_order +msgid "Field Service Order" +msgstr "Orden de Servicio de Campo" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__id +msgid "ID" +msgstr "ID" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__open +msgid "In progress" +msgstr "En progreso" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order____last_update +msgid "Last Modified on" +msgstr "Última Modificación el" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__display_name +msgid "Order" +msgstr "Orden" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__stock_request_ids +msgid "Order Lines" +msgstr "Líneas de Pedido" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/fsm_order.py:0 +#: code:addons/fieldservice_stock_request/models/fsm_order.py:0 +#: code:addons/fieldservice_stock_request/models/fsm_order.py:0 +#, python-format +msgid "Please create a stock request." +msgstr "Por favor, cree una solicitud de existencias." + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_move_line +msgid "Product Moves (Stock Move Line)" +msgstr "Movimientos de producto (línea de movimiento de existencias)" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__request_stage +msgid "Request State" +msgstr "Estado de la Solicitud" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Set to Draft" +msgstr "Establecer a Borrador" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_request +msgid "Stock Request" +msgstr "Solicitud de Existencias" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_request_order +msgid "Stock Request Order" +msgstr "Solicitud de Pedido de Existencias" + +#. module: fieldservice_stock_request +#: model:ir.ui.menu,name:fieldservice_stock_request.menu_fsm_stock_request +msgid "Stock Requests" +msgstr "Solicitudes de Existencias" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Submit" +msgstr "Confirmar" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__submitted +msgid "Submitted" +msgstr "Enviado" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/stock_request.py:0 +#, python-format +msgid "" +"There is already a Stock Request Order " +"with the same Field Service Order and " +"Warehouse that is in Draft state. Please " +"add this Stock Request there. (%s)" +msgstr "" +"Ya existe un Pedido de Existencias con el mismo Pedido de Servicio de Campo y" +" " +" Almacén que está en estado Borrador. Por favor, " +"añada esta Solicitud de Existencias allí. " +"(%s)" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/stock_request.py:0 +#, python-format +msgid "" +"There is no any inventory Operations Type:stock_request_order record for %s " +"Warehouse." +msgstr "" +"No hay ningún registro de operaciones de inventario Tipo:stock_request_order " +"para %s Almacén." diff --git a/fieldservice_stock_request/i18n/es_AR.po b/fieldservice_stock_request/i18n/es_AR.po new file mode 100644 index 0000000000..906865c4c6 --- /dev/null +++ b/fieldservice_stock_request/i18n/es_AR.po @@ -0,0 +1,157 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_stock_request +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-01-17 06:05+0000\n" +"Last-Translator: Ignacio Buioli \n" +"Language-Team: none\n" +"Language: es_AR\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.14.1\n" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Cancel" +msgstr "Cancelar" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__cancel +msgid "Cancelled" +msgstr "Cancelado" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line__display_name +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__display_name +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__display_name +msgid "Display Name" +msgstr "Mostrar Nombre" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__done +msgid "Done" +msgstr "Hecho" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__draft +msgid "Draft" +msgstr "Borrador" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__fsm_order_id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__fsm_order_id +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search +msgid "FSM Order" +msgstr "Pedido FSM" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_fsm_order +msgid "Field Service Order" +msgstr "Pedido de Servicio de Campo" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__id +msgid "ID" +msgstr "ID" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__open +msgid "In progress" +msgstr "En progreso" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order____last_update +msgid "Last Modified on" +msgstr "Última Modificación el" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__display_name +msgid "Order" +msgstr "Pedido" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__stock_request_ids +msgid "Order Lines" +msgstr "Líneas de Pedido" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/fsm_order.py:0 +#, python-format +msgid "Please create a stock request." +msgstr "Por favor, cree una solicitud de inventario." + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_move_line +msgid "Product Moves (Stock Move Line)" +msgstr "Movimientos de Producto (Stock Move Line)" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__request_stage +msgid "Request State" +msgstr "Estado de Solicitud" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Set to Draft" +msgstr "Establecer a Borrador" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_request +msgid "Stock Request" +msgstr "Solicitud de Inventario" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_request_order +msgid "Stock Request Order" +msgstr "Pedido de Solicitud de Stock" + +#. module: fieldservice_stock_request +#: model:ir.ui.menu,name:fieldservice_stock_request.menu_fsm_stock_request +msgid "Stock Requests" +msgstr "Solicitudes de Inventario" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Submit" +msgstr "Enviar" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__submitted +msgid "Submitted" +msgstr "Presentado" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/stock_request.py:0 +#, python-format +msgid "" +"There is already a Stock Request Order " +"with the same Field Service Order and " +"Warehouse that is in Draft state. Please " +"add this Stock Request there. (%s)" +msgstr "" +"Ya existe una Orden de Solicitud de Stock " +"con la misma Orden de Servicio de Campo y " +"Almacén que está en estado Borrador. " +"Agregue esta solicitud de stock allí. (%s)" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/stock_request.py:0 +#, python-format +msgid "" +"There is no any inventory Operations Type:stock_request_order record for %s " +"Warehouse." +msgstr "" +"No hay ningún registro Tipo de operaciones de inventario: " +"stock_request_order para %s Warehouse." diff --git a/fieldservice_stock_request/i18n/fieldservice_stock_request.pot b/fieldservice_stock_request/i18n/fieldservice_stock_request.pot new file mode 100644 index 0000000000..2c03061be8 --- /dev/null +++ b/fieldservice_stock_request/i18n/fieldservice_stock_request.pot @@ -0,0 +1,150 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_stock_request +# +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: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Cancel" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__cancel +msgid "Cancelled" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line__display_name +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__display_name +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__display_name +msgid "Display Name" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__done +msgid "Done" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__draft +msgid "Draft" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__fsm_order_id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__fsm_order_id +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search +msgid "FSM Order" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_fsm_order +msgid "Field Service Order" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__id +msgid "ID" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__open +msgid "In progress" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order____last_update +msgid "Last Modified on" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__display_name +msgid "Order" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__stock_request_ids +msgid "Order Lines" +msgstr "" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/fsm_order.py:0 +#: code:addons/fieldservice_stock_request/models/fsm_order.py:0 +#: code:addons/fieldservice_stock_request/models/fsm_order.py:0 +#, python-format +msgid "Please create a stock request." +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_move_line +msgid "Product Moves (Stock Move Line)" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__request_stage +msgid "Request State" +msgstr "" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Set to Draft" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_request +msgid "Stock Request" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_request_order +msgid "Stock Request Order" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.ui.menu,name:fieldservice_stock_request.menu_fsm_stock_request +msgid "Stock Requests" +msgstr "" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Submit" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__submitted +msgid "Submitted" +msgstr "" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/stock_request.py:0 +#, python-format +msgid "" +"There is already a Stock Request Order " +"with the same Field Service Order and " +"Warehouse that is in Draft state. Please " +"add this Stock Request there. (%s)" +msgstr "" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/stock_request.py:0 +#, python-format +msgid "" +"There is no any inventory Operations Type:stock_request_order record for %s " +"Warehouse." +msgstr "" diff --git a/fieldservice_stock_request/i18n/it.po b/fieldservice_stock_request/i18n/it.po new file mode 100644 index 0000000000..8e47181624 --- /dev/null +++ b/fieldservice_stock_request/i18n/it.po @@ -0,0 +1,158 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_stock_request +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-07-12 12:11+0000\n" +"Last-Translator: Francesco Foresti \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Cancel" +msgstr "Annulla" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__cancel +msgid "Cancelled" +msgstr "Annullata" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line__display_name +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__display_name +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__done +msgid "Done" +msgstr "Evasa" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__draft +msgid "Draft" +msgstr "Bozza" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__fsm_order_id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__fsm_order_id +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search +msgid "FSM Order" +msgstr "Ordine FSM" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_fsm_order +msgid "Field Service Order" +msgstr "Ordine assistenza sul campo" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__id +msgid "ID" +msgstr "ID" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__open +msgid "In progress" +msgstr "In corso" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__display_name +msgid "Order" +msgstr "Ordine" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__stock_request_ids +msgid "Order Lines" +msgstr "Righe ordine" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/fsm_order.py:0 +#, python-format +msgid "Please create a stock request." +msgstr "Creare una richiesta di magazzino." + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_move_line +msgid "Product Moves (Stock Move Line)" +msgstr "Movimenti prodotto (riga movimento di magazzino)" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__request_stage +msgid "Request State" +msgstr "Stato richiesta" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Set to Draft" +msgstr "Imposta a bozza" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_request +msgid "Stock Request" +msgstr "Richiesta di magazzino" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_request_order +msgid "Stock Request Order" +msgstr "Ordine richiesta di magazzino" + +#. module: fieldservice_stock_request +#: model:ir.ui.menu,name:fieldservice_stock_request.menu_fsm_stock_request +msgid "Stock Requests" +msgstr "Richieste di magazzino" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Submit" +msgstr "Invia" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__submitted +msgid "Submitted" +msgstr "Inviata" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/stock_request.py:0 +#, python-format +msgid "" +"There is already a Stock Request Order " +"with the same Field Service Order and " +"Warehouse that is in Draft state. Please " +"add this Stock Request there. (%s)" +msgstr "" +"Esiste già un ordine di richiesta di " +"magazzino con lo stesso ordine di " +"assistenza sul campo e magazzino che è in " +"stato bozza. Aggiungere a questa la " +"richiesta di magazzino. (%s)" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/stock_request.py:0 +#, python-format +msgid "" +"There is no any inventory Operations Type:stock_request_order record for %s " +"Warehouse." +msgstr "" +"Non è presente un record tipo operazione di magazzino:stock_request_order " +"per il magazzino %s." diff --git a/fieldservice_stock_request/i18n/pt_BR.po b/fieldservice_stock_request/i18n/pt_BR.po new file mode 100644 index 0000000000..90c1cbe662 --- /dev/null +++ b/fieldservice_stock_request/i18n/pt_BR.po @@ -0,0 +1,156 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_stock_request +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-03-15 05:45+0000\n" +"Last-Translator: Marcel Savegnago \n" +"Language-Team: none\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: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Cancel" +msgstr "Cancelar" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__cancel +msgid "Cancelled" +msgstr "Cancelado" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line__display_name +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__display_name +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__display_name +msgid "Display Name" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__done +msgid "Done" +msgstr "Concluído" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__draft +msgid "Draft" +msgstr "Provisório" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__fsm_order_id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__fsm_order_id +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search +msgid "FSM Order" +msgstr "Ordem FSM" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_fsm_order +msgid "Field Service Order" +msgstr "Ordem de Serviço de Campo" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__id +msgid "ID" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__open +msgid "In progress" +msgstr "Em andamento" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order____last_update +msgid "Last Modified on" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__display_name +msgid "Order" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__stock_request_ids +msgid "Order Lines" +msgstr "Itens do Pedido" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/fsm_order.py:0 +#, python-format +msgid "Please create a stock request." +msgstr "Por favor, crie uma requisição de estoque." + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_move_line +msgid "Product Moves (Stock Move Line)" +msgstr "Movimentos do Produto (Linha do Movimento do Estoque)" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__request_stage +msgid "Request State" +msgstr "Estado de Requisição" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Set to Draft" +msgstr "Definir como Provisório" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_request +msgid "Stock Request" +msgstr "Requisição de Estoque" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_request_order +msgid "Stock Request Order" +msgstr "Ordens de Requisição de Estoque" + +#. module: fieldservice_stock_request +#: model:ir.ui.menu,name:fieldservice_stock_request.menu_fsm_stock_request +msgid "Stock Requests" +msgstr "Requisições de Estoque" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Submit" +msgstr "Enviar" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__submitted +msgid "Submitted" +msgstr "Enviado" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/stock_request.py:0 +#, python-format +msgid "" +"There is already a Stock Request Order " +"with the same Field Service Order and " +"Warehouse that is in Draft state. Please " +"add this Stock Request there. (%s)" +msgstr "" +"Já existe uma Ordem de Requisição de " +"Estoque com a mesma Order de Serviço de " +"Campo e Estoque em estado de Rascunho. Por " +"favor e adicione esta Requisição de " +"Estoque lá. (%s)" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/stock_request.py:0 +#, python-format +msgid "" +"There is no any inventory Operations Type:stock_request_order record for %s " +"Warehouse." +msgstr "" diff --git a/fieldservice_stock_request/models/__init__.py b/fieldservice_stock_request/models/__init__.py new file mode 100644 index 0000000000..c1024e45cc --- /dev/null +++ b/fieldservice_stock_request/models/__init__.py @@ -0,0 +1,6 @@ +from . import ( + fsm_order, + stock_move_line, + stock_request, + stock_request_order, +) diff --git a/fieldservice_stock_request/models/fsm_order.py b/fieldservice_stock_request/models/fsm_order.py new file mode 100644 index 0000000000..83fe763110 --- /dev/null +++ b/fieldservice_stock_request/models/fsm_order.py @@ -0,0 +1,63 @@ +# Copyright (C) 2021 - TODAY, Brian McMaster +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import _, fields, models +from odoo.exceptions import UserError + +REQUEST_STATES = [ + ("draft", "Draft"), + ("submitted", "Submitted"), + ("open", "In progress"), + ("done", "Done"), + ("cancel", "Cancelled"), +] + + +class FSMOrder(models.Model): + _inherit = "fsm.order" + + stock_request_ids = fields.One2many( + "stock.request", "fsm_order_id", string="Order Lines" + ) + request_stage = fields.Selection( + REQUEST_STATES, + string="Request State", + default="draft", + readonly=True, + ) + + def action_request_submit(self): + for rec in self: + if not rec.stock_request_ids: + raise UserError(_("Please create a stock request.")) + for line in rec.stock_request_ids: + if line.state == "draft": + if line.order_id: + line.order_id.action_submit() + else: + line.action_submit() + rec.request_stage = "submitted" + + def action_request_cancel(self): + for rec in self: + if not rec.stock_request_ids: + raise UserError(_("Please create a stock request.")) + for line in rec.stock_request_ids.filtered( + lambda l: l.state in ("draft", "open") + ): + if line.order_id: + line.order_id.action_cancel() + else: + line.action_cancel() + rec.request_stage = "cancel" + + def action_request_draft(self): + for rec in self: + if not rec.stock_request_ids: + raise UserError(_("Please create a stock request.")) + for line in rec.stock_request_ids.filtered(lambda l: l.state == "cancel"): + if line.order_id: + line.order_id.action_draft() + else: + line.action_draft() + rec.request_stage = "draft" diff --git a/fieldservice_stock_request/models/stock_move_line.py b/fieldservice_stock_request/models/stock_move_line.py new file mode 100644 index 0000000000..db5d950bdd --- /dev/null +++ b/fieldservice_stock_request/models/stock_move_line.py @@ -0,0 +1,25 @@ +# Copyright (C) 2021 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import exceptions, models + + +class StockMoveLine(models.Model): + _inherit = "stock.move.line" + + def _action_done(self): + res = super(StockMoveLine, self)._action_done() + for rec in self: + # cases were found where self contained deleted records + # example is creating a backorder for Products with lot number + try: + move_id = rec.move_id + except exceptions.MissingError: + move_id = None + if move_id: + for request in rec.move_id.allocation_ids: + if ( + request.stock_request_id.state == "done" + and request.stock_request_id.fsm_order_id + ): + request.stock_request_id.fsm_order_id.request_stage = "done" + return res diff --git a/fieldservice_stock_request/models/stock_request.py b/fieldservice_stock_request/models/stock_request.py new file mode 100644 index 0000000000..a879dd552e --- /dev/null +++ b/fieldservice_stock_request/models/stock_request.py @@ -0,0 +1,177 @@ +# Copyright (C) 2021 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import _, api, fields, models +from odoo.exceptions import UserError + + +class StockRequest(models.Model): + _inherit = "stock.request" + + fsm_order_id = fields.Many2one( + "fsm.order", string="FSM Order", ondelete="cascade", index=True, copy=False + ) + + def _update_stock_request_order_data(self): + if self.order_id and self.direction and self.state == "draft": + picking_type_id = self.env["stock.picking.type"].search( + [ + ("code", "=", "stock_request_order"), + ("warehouse_id", "=", self.warehouse_id.id), + ], + limit=1, + ) + order = self.env["stock.request.order"].search( + [ + ("fsm_order_id", "=", self.fsm_order_id.id), + ("warehouse_id", "=", self.warehouse_id.id), + ("picking_type_id", "=", picking_type_id.id), + ("direction", "=", self.direction), + ("state", "=", "draft"), + ], + order="id asc", + ) + self.order_id = order.id + + @api.onchange("direction", "fsm_order_id") + def _onchange_location_id(self): + res = super()._onchange_location_id() + if self.fsm_order_id: + if self.direction == "outbound": + # Inventory location of the FSM location of the order + self.location_id = ( + self.fsm_order_id.location_id.inventory_location_id.id + ) + else: + self.location_id = self.fsm_order_id.warehouse_id.lot_stock_id.id + self._update_stock_request_order_data() + return res + + def prepare_stock_request_order_values(self): + res = { + "expected_date": self.expected_date, + "picking_policy": self.picking_policy, + "warehouse_id": self.warehouse_id.id, + "direction": self.direction, + "location_id": self.location_id.id, + } + return res + + def prepare_order_values(self, vals): + res = { + "expected_date": vals["expected_date"], + "picking_policy": vals["picking_policy"], + "warehouse_id": vals["warehouse_id"], + "direction": vals["direction"], + "location_id": vals["location_id"], + } + if "fsm_order_id" in vals and vals["fsm_order_id"]: + res.update({"fsm_order_id": vals["fsm_order_id"]}) + return res + + @api.model + def create(self, vals): + if "fsm_order_id" in vals and vals["fsm_order_id"]: + fsm_order = self.env["fsm.order"].browse(vals["fsm_order_id"]) + fsm_order.request_stage = "draft" + vals["warehouse_id"] = fsm_order.warehouse_id.id + picking_type_id = self.env["stock.picking.type"].search( + [ + ("code", "=", "stock_request_order"), + ("warehouse_id", "=", vals["warehouse_id"]), + ], + limit=1, + ) + if not picking_type_id: + raise UserError( + _( + "There is no any inventory Operations Type:" + "stock_request_order record for %s Warehouse." + ) + % fsm_order.warehouse_id.display_name + ) + order = self.env["stock.request.order"].search( + [ + ("fsm_order_id", "=", vals["fsm_order_id"]), + ("warehouse_id", "=", vals["warehouse_id"]), + ("picking_type_id", "=", picking_type_id.id), + ("direction", "=", vals["direction"]), + ("state", "=", "draft"), + ], + order="id asc", + ) + + # User created a new SRO Manually + if len(order) > 1: + raise UserError( + _( + "There is already a Stock Request Order \ + with the same Field Service Order and \ + Warehouse that is in Draft state. Please \ + add this Stock Request there. \ + (%s)" + ) + % order[0].name + ) + # Made from an FSO for the first time, create the SRO here + elif not order and vals.get("fsm_order_id"): + values = self.prepare_order_values(vals) + values.update( + { + "picking_type_id": picking_type_id.id, + "warehouse_id": vals["warehouse_id"], + } + ) + if values["direction"] == "inbound": + values.update( + { + "location_id": self.env["stock.warehouse"] + .browse(vals["warehouse_id"]) + .lot_stock_id.id + } + ) + vals["order_id"] = self.env["stock.request.order"].create(values).id + # There is an SRO made from FSO, assign here + elif len(order) == 1 and vals.get("fsm_order_id"): + vals["expected_date"] = order.expected_date + vals["order_id"] = order.id + return super().create(vals) + + def _prepare_procurement_values(self, group_id=False): + res = super()._prepare_procurement_values(group_id=group_id) + if self.fsm_order_id: + res.update( + { + "fsm_order_id": self.fsm_order_id.id, + "partner_id": self.fsm_order_id.location_id.shipping_address_id.id + or self.fsm_order_id.location_id.partner_id.id, + } + ) + return res + + def _prepare_procurement_group_values(self): + if self.fsm_order_id: + return { + "name": self.fsm_order_id.display_name, + "fsm_order_id": self.fsm_order_id.id, + "move_type": "direct", + } + return {} + + def _action_confirm(self): + for req in self: + if (not req.procurement_group_id) and req.fsm_order_id: + group = self.env["procurement.group"].search( + [("fsm_order_id", "=", req.fsm_order_id.id)] + ) + if not group: + values = req._prepare_procurement_group_values() + group = req.env["procurement.group"].create(values) + if req.order_id: + req.order_id.procurement_group_id = group.id + req.procurement_group_id = group.id + res = super(StockRequest, req)._action_confirm() + req.fsm_order_id.request_stage = "open" + else: + res = super(StockRequest, req)._action_confirm() + return res diff --git a/fieldservice_stock_request/models/stock_request_order.py b/fieldservice_stock_request/models/stock_request_order.py new file mode 100644 index 0000000000..48138f3961 --- /dev/null +++ b/fieldservice_stock_request/models/stock_request_order.py @@ -0,0 +1,55 @@ +# Copyright (C) 2021 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class StockRequestOrder(models.Model): + _inherit = "stock.request.order" + + fsm_order_id = fields.Many2one( + "fsm.order", string="FSM Order", ondelete="cascade", index=True, copy=False + ) + + @api.onchange("warehouse_id", "direction", "fsm_order_id") + def _onchange_location_id(self): + res = super()._onchange_location_id() + if self.fsm_order_id: + if self.direction == "outbound": + # Inventory location of the FSM location of the order + self.location_id = ( + self.fsm_order_id.location_id.inventory_location_id.id + ) + else: + # Otherwise the stock location of the warehouse + self.location_id = self.fsm_order_id.warehouse_id.lot_stock_id.id + self.change_childs() + return res + + def change_childs(self): + res = super().change_childs() + if not self._context.get("no_change_childs", False): + for line in self.stock_request_ids: + line.fsm_order_id = self.fsm_order_id.id + return res + + def _prepare_procurement_group_values(self): + if self.fsm_order_id: + return { + "name": self.fsm_order_id.display_name, + "fsm_order_id": self.fsm_order_id.id, + "move_type": "direct", + } + return {} + + def action_confirm(self): + if self.fsm_order_id: + group = self.env["procurement.group"].search( + [("fsm_order_id", "=", self.fsm_order_id.id)] + ) + if not group: + values = self._prepare_procurement_group_values() + group = self.env["procurement.group"].create(values) + self.procurement_group_id = group[0].id + self.change_childs() + return super().action_confirm() diff --git a/fieldservice_stock_request/readme/CONFIGURE.rst b/fieldservice_stock_request/readme/CONFIGURE.rst new file mode 100644 index 0000000000..dac98e9fde --- /dev/null +++ b/fieldservice_stock_request/readme/CONFIGURE.rst @@ -0,0 +1,18 @@ +To configure this module, you need to: + +* Go to Inventory > Configuration > Routes +* Select the routes that you want to use from a FSM order +* Check the box 'FSM Order Line' for outbound transfer +* Check the box 'FSM Return Line' for inbound transfer + +The route 'Receipt in 1 step' has no procurement rule so if you want items to be +returned from the service location to your warehouse, you need to create a new +procurement rule for that route: + +* Name: YourCompany: Return +* Action: Move From Another Location +* Procurement Location: WH/Stock +* Served Warehouse: YourCompany +* Source Location: Partner Locations/Customers +* Move Supply Method: Take From Stock +* Operation Type: YourCompany: Receipts diff --git a/fieldservice_stock_request/readme/CONTRIBUTORS.rst b/fieldservice_stock_request/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..99b9bcf096 --- /dev/null +++ b/fieldservice_stock_request/readme/CONTRIBUTORS.rst @@ -0,0 +1,5 @@ +* Brian McMaster +* Sandip Mangukiya +* Serpent Consulting Services Pvt. Ltd. +* [APSL](https://apsl.tech): + * Antoni Marroig diff --git a/fieldservice_stock_request/readme/CREDITS.rst b/fieldservice_stock_request/readme/CREDITS.rst new file mode 100644 index 0000000000..0eff0acf4e --- /dev/null +++ b/fieldservice_stock_request/readme/CREDITS.rst @@ -0,0 +1,3 @@ +The development of this module has been financially supported by: + +* Open Source Integrators diff --git a/fieldservice_stock_request/readme/DESCRIPTION.rst b/fieldservice_stock_request/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..77e98fffa9 --- /dev/null +++ b/fieldservice_stock_request/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module is an add-on for the Field Service application in Odoo. +It provides stock requests in field service orders. diff --git a/fieldservice_stock_request/readme/ROADMAP.rst b/fieldservice_stock_request/readme/ROADMAP.rst new file mode 100644 index 0000000000..f607015959 --- /dev/null +++ b/fieldservice_stock_request/readme/ROADMAP.rst @@ -0,0 +1,2 @@ +The roadmap of the Field Service application is documented on +`Github `_. diff --git a/fieldservice_stock_request/readme/USAGE.rst b/fieldservice_stock_request/readme/USAGE.rst new file mode 100644 index 0000000000..a9332d58c5 --- /dev/null +++ b/fieldservice_stock_request/readme/USAGE.rst @@ -0,0 +1,7 @@ +To use this module, you need to: + +* Create a new service order +* Under the Inventory tab, select the warehouse and add products with quantity +* Confirm the order to create the delivery orders +* Validate the transfers in the Inventory app. Quantities delivered on FSM + Order Line will be updated. diff --git a/fieldservice_stock_request/security/ir.model.access.csv b/fieldservice_stock_request/security/ir.model.access.csv new file mode 100644 index 0000000000..a7d2956a32 --- /dev/null +++ b/fieldservice_stock_request/security/ir.model.access.csv @@ -0,0 +1,7 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_stock_request_allocation_fsm_user,stock.request.allocation.user,stock_request.model_stock_request_allocation,base.group_user,1,0,0,0 +access_stock_request_allocation_portal,access.stock.request.allocation.portal,stock_request.model_stock_request_allocation,base.group_portal,1,0,0,0 +access_stock_request_fsm_user,stock.request.user,stock_request.model_stock_request,fieldservice.group_fsm_user,1,0,0,0 +access_stock_request_fsm_dispatcher,stock.request.dispatcher,stock_request.model_stock_request,fieldservice.group_fsm_dispatcher,1,1,1,1 +access_stock_request_portal,access.stock.request.portal,stock_request.model_stock_request,base.group_portal,1,0,0,0 +access_stock_move_line_portal,access.stock.move.line.portal,stock.model_stock_move_line,base.group_portal,1,0,0,0 diff --git a/fieldservice_stock_request/static/description/icon.png b/fieldservice_stock_request/static/description/icon.png new file mode 100755 index 0000000000..3a0328b516 Binary files /dev/null and b/fieldservice_stock_request/static/description/icon.png differ diff --git a/fieldservice_stock_request/static/description/index.html b/fieldservice_stock_request/static/description/index.html new file mode 100755 index 0000000000..d8c065ecef --- /dev/null +++ b/fieldservice_stock_request/static/description/index.html @@ -0,0 +1,478 @@ + + + + + + +Field Service - Stock Request + + + +
+

Field Service - Stock Request

+ + +

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

+

This module is an add-on for the Field Service application in Odoo. +It provides stock requests in field service orders.

+

Table of contents

+ +
+

Configuration

+

To configure this module, you need to:

+
    +
  • Go to Inventory > Configuration > Routes
  • +
  • Select the routes that you want to use from a FSM order
  • +
  • Check the box ‘FSM Order Line’ for outbound transfer
  • +
  • Check the box ‘FSM Return Line’ for inbound transfer
  • +
+

The route ‘Receipt in 1 step’ has no procurement rule so if you want items to be +returned from the service location to your warehouse, you need to create a new +procurement rule for that route:

+
    +
  • Name: YourCompany: Return
  • +
  • Action: Move From Another Location
  • +
  • Procurement Location: WH/Stock
  • +
  • Served Warehouse: YourCompany
  • +
  • Source Location: Partner Locations/Customers
  • +
  • Move Supply Method: Take From Stock
  • +
  • Operation Type: YourCompany: Receipts
  • +
+
+
+

Usage

+

To use this module, you need to:

+
    +
  • Create a new service order
  • +
  • Under the Inventory tab, select the warehouse and add products with quantity
  • +
  • Confirm the order to create the delivery orders
  • +
  • Validate the transfers in the Inventory app. Quantities delivered on FSM +Order Line will be updated.
  • +
+
+
+

Known issues / Roadmap

+

The roadmap of the Field Service application is documented on +Github.

+
+
+

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

+
    +
  • Open Source Integrators
  • +
  • Brian McMaster
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The development of this module has been financially supported by:

+ +
+
+

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 maintainers:

+

brian10048 wolfhall max3903 smangukiya

+

This module is part of the OCA/field-service project on GitHub.

+

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

+
+
+
+ + diff --git a/fieldservice_stock_request/tests/__init__.py b/fieldservice_stock_request/tests/__init__.py new file mode 100644 index 0000000000..8e8d509d59 --- /dev/null +++ b/fieldservice_stock_request/tests/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2020, Brian McMaster +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) + +from . import test_fsm_stock_request diff --git a/fieldservice_stock_request/tests/test_fsm_stock_request.py b/fieldservice_stock_request/tests/test_fsm_stock_request.py new file mode 100644 index 0000000000..cc640574b1 --- /dev/null +++ b/fieldservice_stock_request/tests/test_fsm_stock_request.py @@ -0,0 +1,479 @@ +# Copyright (C) 2020, Brian McMaster +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) + +import datetime + +from odoo import fields +from odoo.exceptions import UserError + +from odoo.addons.fieldservice_stock.tests.test_fsm_stock import TestFSMStockCommon + + +class TestFSMStockRequest(TestFSMStockCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + # disable tracking in test + cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) + # Setup for Stock Request + cls.StockRequest = cls.env["stock.request"] + cls.StockRequestOrder = cls.env["stock.request.order"] + cls.StockPickingType = cls.env["stock.picking.type"] + cls.Product = cls.env["product.product"] + + cls.product_1 = cls.Product.create( + { + "name": "Product 1", + "type": "product", + "categ_id": cls.env.ref("product.product_category_all").id, + } + ) + cls.product_2 = cls.Product.create( + { + "name": "Product 2", + "type": "product", + "categ_id": cls.env.ref("product.product_category_all").id, + } + ) + cls.warehouse = cls.env["stock.warehouse"].search( + [("company_id", "=", cls.env.user.company_id.id)], limit=1 + ) + + # cls.route = cls.env["stock.location.route"].create( + # { + # "name": "Transfer", + # "product_categ_selectable": False, + # "product_selectable": True, + # "company_id": cls.env.user.company_id.id, + # "sequence": 10, + # "rule_ids": [ + # ( + # 0, + # 0, + # { + # "name": "Stock -> output rule", + # "action": "pull", + # "picking_type_id": cls.ref("stock.picking_type_out"), + # "location_src_id": cls.ref("stock.stock_location_stock"), + # "location_id": cls.ref("stock.stock_location_customers"), + # }, + # ), + # ( + # 0, + # 0, + # { + # "name": "Stock -> output rule", + # "action": "pull", + # "picking_type_id": cls.ref("stock.picking_type_out"), + # "location_src_id": cls.warehouse.lot_stock_id.id, + # "location_id": cls.ref("stock.stock_location_customers"), + # }, + # ), + # ], + # } + # ) + + cls.ressuply_loc = cls.env["stock.location"].create( + { + "name": "Ressuply", + "location_id": cls.warehouse.view_location_id.id, + "usage": "internal", + "company_id": cls.env.user.company_id.id, + } + ) + cls.stock_request_user_group = cls.env.ref( + "stock_request.group_stock_request_user" + ) + cls.fsm_dispatcher_group = cls.env.ref("fieldservice.group_fsm_dispatcher") + cls.group_stock_request_manager = cls.env.ref( + "stock_request.group_stock_request_manager" + ) + cls.stock_request_user = ( + cls.env["res.users"] + .with_context(no_reset_password=True) + .create( + { + "name": "stock_request_user1", + "password": "demo", + "login": "stock_request_user1", + "email": "@".join(["stock_request_user", "test.com"]), + "groups_id": [ + ( + 6, + 0, + [ + cls.stock_request_user_group.id, + cls.fsm_dispatcher_group.id, + ], + ) + ], + "company_ids": [(6, 0, [cls.env.user.company_id.id])], + } + ) + ) + cls.stock_request_manager = ( + cls.env["res.users"] + .with_context(no_reset_password=True) + .create( + { + "name": "stock_request_manager1", + "password": "demo", + "login": "stock_request_manager1", + "email": "@".join(["stock_request_user", "test.com"]), + "groups_id": [ + ( + 6, + 0, + [ + cls.fsm_dispatcher_group.id, + cls.group_stock_request_manager.id, + ], + ) + ], + "company_ids": [(6, 0, [cls.env.user.company_id.id])], + } + ) + ) + + def test_fsm_order_stock_request(self): + # Create a new FS Order and add to it some SR + FSO = self.FSMOrder.create({"location_id": self.test_location.id}) + fsm_order = self.FSMOrder.create({"location_id": self.test_location.id}) + + self.StockPickingType.create( + { + "name": "Stock Request wh", + "sequence_id": self.env.ref("stock_request.seq_stock_request_order").id, + "code": "stock_request_order", + "sequence_code": "SRO", + "warehouse_id": FSO.warehouse_id.id, + } + ) + SR_1 = self.StockRequest.create( + { + "warehouse_id": FSO.warehouse_id.id, + "location_id": FSO.inventory_location_id.id, + "product_id": self.product_1.id, + "product_uom_qty": 1, + "product_uom_id": self.product_1.uom_id.id, + "fsm_order_id": FSO.id, + "direction": "outbound", + "expected_date": datetime.datetime.now(), + "picking_policy": "direct", + } + ) + # After create the SR linked to FSO, validate a SRO + # was created and linked to this FSO + SRO = self.StockRequestOrder.search( + [("fsm_order_id", "=", FSO.id), ("warehouse_id", "=", FSO.warehouse_id.id)] + ) + self.assertTrue(SRO) + SRO._onchange_location_id() + + # Add a second SR to the FSO + SR_2 = self.StockRequest.create( + { + "warehouse_id": FSO.warehouse_id.id, + "location_id": FSO.inventory_location_id.id, + "product_id": self.product_2.id, + "product_uom_qty": 4, + "product_uom_id": self.product_2.uom_id.id, + "fsm_order_id": FSO.id, + "direction": "outbound", + "expected_date": datetime.datetime.now(), + "picking_policy": "direct", + } + ) + # After create the 2nd SR linked to same FSO, validate + # this SR is assigned to the same SRO + self.assertEqual(SR_2.order_id, SRO) + with self.assertRaises(UserError): + fsm_order.action_request_cancel() + + # Cancel the SRs from FSO. Confirm SR are cancelled + FSO.action_request_cancel() + self.assertEqual(FSO.request_stage, "cancel") + self.assertEqual(SR_1.state, "cancel") + self.assertEqual(SR_2.state, "cancel") + self.assertEqual(SRO.state, "cancel") + + with self.assertRaises(UserError): + fsm_order.action_request_draft() + + # Set the SR to draft. Confirm SR are draft + FSO.action_request_draft() + self.assertEqual(FSO.request_stage, "draft") + self.assertEqual(SR_1.state, "draft") + self.assertEqual(SR_2.state, "draft") + self.assertEqual(SRO.state, "draft") + + # Submit the SRs from FSO. Confirm FSO request, SR & SRO are submitted + FSO.action_request_submit() + self.assertEqual(FSO.request_stage, "submitted") + self.assertEqual(SR_1.state, "submitted") + self.assertEqual(SR_2.state, "submitted") + self.assertEqual(SRO.state, "submitted") + + with self.assertRaises(UserError): + fsm_order.action_request_submit() + self.StockRequest.create( + { + "warehouse_id": fsm_order.warehouse_id.id, + "location_id": fsm_order.inventory_location_id.id, + "product_id": self.product_2.id, + "product_uom_qty": 4, + "product_uom_id": self.product_2.uom_id.id, + "fsm_order_id": fsm_order.id, + "direction": "outbound", + "expected_date": datetime.datetime.now(), + "picking_policy": "direct", + } + ) + fsm_order.stock_request_ids.order_id = False + fsm_order.action_request_cancel() + fsm_order.action_request_draft() + fsm_order.action_request_submit() + + def test_stock_move_line(self): + expected_date = fields.Datetime.now() + FSO = self.FSMOrder.create({"location_id": self.test_location.id}) + procurement_group = self.env["procurement.group"].create({"name": "TEST"}) + self.StockPickingType.create( + { + "name": "Stock Request wh", + "sequence_id": self.env.ref("stock_request.seq_stock_request_order").id, + "code": "stock_request_order", + "sequence_code": "SRO", + "warehouse_id": FSO.warehouse_id.id, + } + ) + vals = { + "company_id": self.env.user.company_id.id, + "warehouse_id": self.warehouse.id, + "location_id": self.warehouse.lot_stock_id.id, + "expected_date": expected_date, + "requested_by": self.env.uid, + } + order = self.env["stock.request.order"].with_user(self.env.user).create(vals) + self.StockRequest.create( + { + "product_id": self.product_1.id, + "product_uom_id": self.env.ref("uom.product_uom_unit").id, + "product_uom_qty": 5.0, + "fsm_order_id": FSO.id, + "company_id": self.env.user.company_id.id, + "warehouse_id": self.warehouse.id, + "location_id": self.warehouse.lot_stock_id.id, + "expected_date": expected_date, + "direction": "outbound", + "picking_policy": "direct", + "requested_by": self.env.uid, + }, + ) + order.with_user(self.stock_request_manager).write( + {"stock_request_ids": [(6, 0, FSO.stock_request_ids.ids)]} + ) + stock_request = order.stock_request_ids + order.procurement_group_id = procurement_group + self.env["stock.rule"].create( + { + "name": "Rule Supplier", + "route_id": self.warehouse.reception_route_id.id, + "location_dest_id": self.warehouse.lot_stock_id.id, + "location_src_id": self.env.ref("stock.stock_location_suppliers").id, + "action": "pull", + "delay": 1.0, + "procure_method": "make_to_stock", + "picking_type_id": self.warehouse.in_type_id.id, + } + ) + self.env["procurement.group"].run( + [ + procurement_group.Procurement( + self.product_1, + 2.0, + self.product_1.uom_id, + self.warehouse.lot_stock_id, + "wave_part_1", + "wave_part_1", + self.warehouse.company_id, + {"warehouse_id": self.warehouse, "group_id": procurement_group}, + ) + ] + ) + order.with_user(self.stock_request_manager).action_confirm() + + self.env["stock.quant"].create( + { + "product_id": self.product_1.id, + "location_id": self.ressuply_loc.id, + "quantity": 5.0, + } + ) + picking = stock_request.picking_ids[0] + picking.with_user(self.stock_request_manager).action_confirm() + picking.with_user(self.stock_request_manager).action_assign() + packout1 = picking.move_line_ids[0] + packout1.qty_done = 5 + picking.with_user(self.stock_request_manager)._action_done() + + def test_08_stock_request(self): + expected_date = fields.Datetime.now() + FSO = self.FSMOrder.create({"location_id": self.test_location.id}) + self.StockPickingType.create( + { + "name": "Stock Request wh", + "sequence_id": self.env.ref("stock_request.seq_stock_request_order").id, + "code": "stock_request_order", + "sequence_code": "SRO", + "warehouse_id": FSO.warehouse_id.id, + } + ) + stock_request = self.StockRequest.create( + { + "product_id": self.product_1.id, + "product_uom_id": self.env.ref("uom.product_uom_unit").id, + "product_uom_qty": 5.0, + "fsm_order_id": FSO.id, + "company_id": self.env.user.company_id.id, + "warehouse_id": self.warehouse.id, + "location_id": self.warehouse.lot_stock_id.id, + "expected_date": expected_date, + "direction": "inbound", + "picking_policy": "direct", + "requested_by": self.env.uid, + }, + ) + stock_request._onchange_location_id() + stock_request.prepare_stock_request_order_values() + + def test_stock_request_confirm(self): + expected_date = fields.Datetime.now() + FSO = self.FSMOrder.create({"location_id": self.test_location.id}) + procurement_group = self.env["procurement.group"].create({"name": "TEST"}) + self.StockPickingType.create( + { + "name": "Stock Request wh", + "sequence_id": self.env.ref("stock_request.seq_stock_request_order").id, + "code": "stock_request_order", + "sequence_code": "SRO", + "warehouse_id": FSO.warehouse_id.id, + } + ) + vals = { + "company_id": self.env.user.company_id.id, + "warehouse_id": self.warehouse.id, + "location_id": self.warehouse.lot_stock_id.id, + "expected_date": expected_date, + "requested_by": self.env.uid, + "fsm_order_id": FSO.id, + } + order = self.env["stock.request.order"].with_user(self.env.user).create(vals) + self.StockRequest.create( + { + "product_id": self.product_1.id, + "product_uom_id": self.env.ref("uom.product_uom_unit").id, + "product_uom_qty": 5.0, + "fsm_order_id": FSO.id, + "company_id": self.env.user.company_id.id, + "warehouse_id": self.warehouse.id, + "location_id": self.warehouse.lot_stock_id.id, + "expected_date": expected_date, + "direction": "outbound", + "picking_policy": "direct", + "requested_by": self.env.uid, + }, + ) + order.with_user(self.stock_request_manager).write( + {"stock_request_ids": [(6, 0, FSO.stock_request_ids.ids)]} + ) + stock_request = order.stock_request_ids + order.procurement_group_id = procurement_group + self.env["stock.rule"].create( + { + "name": "Rule Supplier", + "route_id": self.warehouse.reception_route_id.id, + "location_dest_id": self.warehouse.lot_stock_id.id, + "location_src_id": self.env.ref("stock.stock_location_suppliers").id, + "action": "pull", + "delay": 1.0, + "procure_method": "make_to_stock", + "picking_type_id": self.warehouse.in_type_id.id, + } + ) + self.env["procurement.group"].run( + [ + procurement_group.Procurement( + self.product_1, + 2.0, + self.product_1.uom_id, + self.warehouse.lot_stock_id, + "wave_part_1", + "wave_part_1", + self.warehouse.company_id, + {"warehouse_id": self.warehouse, "group_id": procurement_group}, + ) + ] + ) + order.write({"fsm_order_id": FSO.id}) + order.action_confirm() + stock_request._action_confirm() + + order_without_fsm = order.copy({"fsm_order_id": False}) + order_without_fsm.action_confirm() + + def test_stock_request_confirm_with_FSM(self): + expected_date = fields.Datetime.now() + FSO = self.FSMOrder.create({"location_id": self.test_location.id}) + self.StockPickingType.create( + { + "name": "Stock Request wh", + "sequence_id": self.env.ref("stock_request.seq_stock_request_order").id, + "code": "stock_request_order", + "sequence_code": "SRO", + "warehouse_id": FSO.warehouse_id.id, + } + ) + self.env["stock.rule"].create( + { + "name": "Rule Supplier", + "route_id": self.warehouse.reception_route_id.id, + "location_dest_id": self.warehouse.lot_stock_id.id, + "location_src_id": self.env.ref("stock.stock_location_suppliers").id, + "action": "pull", + "delay": 1.0, + "procure_method": "make_to_stock", + "picking_type_id": self.warehouse.in_type_id.id, + } + ) + procurement_group = self.env["procurement.group"].create({"name": "TEST"}) + self.env["procurement.group"].run( + [ + procurement_group.Procurement( + self.product_1, + 2.0, + self.product_1.uom_id, + self.warehouse.lot_stock_id, + "wave_part_1", + "wave_part_1", + self.warehouse.company_id, + {"warehouse_id": self.warehouse, "group_id": procurement_group}, + ) + ] + ) + stock_request = self.StockRequest.create( + { + "product_id": self.product_1.id, + "product_uom_id": self.env.ref("uom.product_uom_unit").id, + "product_uom_qty": 5.0, + "fsm_order_id": FSO.id, + "company_id": self.env.user.company_id.id, + "warehouse_id": self.warehouse.id, + "location_id": self.warehouse.lot_stock_id.id, + "expected_date": expected_date, + "direction": "inbound", + "picking_policy": "direct", + "requested_by": self.env.uid, + }, + ) + stock_request.order_id.action_confirm() diff --git a/fieldservice_stock_request/views/fsm_order.xml b/fieldservice_stock_request/views/fsm_order.xml new file mode 100644 index 0000000000..78bd215e5d --- /dev/null +++ b/fieldservice_stock_request/views/fsm_order.xml @@ -0,0 +1,71 @@ + + + fsm.order.form.stock.request + fsm.order + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
diff --git a/fieldservice_stock_request/views/stock.xml b/fieldservice_stock_request/views/stock.xml new file mode 100644 index 0000000000..ba7f7ec169 --- /dev/null +++ b/fieldservice_stock_request/views/stock.xml @@ -0,0 +1,10 @@ + + + + diff --git a/fieldservice_stock_request/views/stock_request.xml b/fieldservice_stock_request/views/stock_request.xml new file mode 100644 index 0000000000..cafda5f190 --- /dev/null +++ b/fieldservice_stock_request/views/stock_request.xml @@ -0,0 +1,20 @@ + + + stock.request + + + + + + + + + stock.request + + + + + + + + diff --git a/fieldservice_stock_request/views/stock_request_order.xml b/fieldservice_stock_request/views/stock_request_order.xml new file mode 100644 index 0000000000..ad10c18e9c --- /dev/null +++ b/fieldservice_stock_request/views/stock_request_order.xml @@ -0,0 +1,58 @@ + + + stock.request.order + + + + + + + { + 'default_fsm_order_id': fsm_order_id, + 'default_expected_date': expected_date, + 'default_picking_policy': picking_policy, + 'default_warehouse_id': warehouse_id, + 'default_direction': direction, + 'default_location_id': location_id, + 'default_procurement_group_id': procurement_group_id, + 'default_company_id': company_id, + 'default_state': state} + + + + + + + + stock.request.order + + + + + + + + + stock.request.order + + + + + + + + + + + diff --git a/setup/fieldservice_stock_request/odoo/addons/fieldservice_stock_request b/setup/fieldservice_stock_request/odoo/addons/fieldservice_stock_request new file mode 120000 index 0000000000..4a6c9663f4 --- /dev/null +++ b/setup/fieldservice_stock_request/odoo/addons/fieldservice_stock_request @@ -0,0 +1 @@ +../../../../fieldservice_stock_request \ No newline at end of file diff --git a/setup/fieldservice_stock_request/setup.py b/setup/fieldservice_stock_request/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/fieldservice_stock_request/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)