diff --git a/fieldservice_stage_server_action/README.rst b/fieldservice_stage_server_action/README.rst new file mode 100644 index 0000000000..85e0fd9e9c --- /dev/null +++ b/fieldservice_stage_server_action/README.rst @@ -0,0 +1,114 @@ +=================================== +Field Service - Stage Server Action +=================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:ec4a7a5f4f4bbb8ef03a79a79ae12627b8b8d66cb0bdf908d71ae346a324e82d + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/18.0/fieldservice_stage_server_action + :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-18-0/field-service-18-0-fieldservice_stage_server_action + :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=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows you to execute server actions when a FSM orders +enters a specific stage. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +- Go to Field Service > Configuration > Stages +- Create or select a stage +- Select or create a server action + +Usage +===== + +- Go to Field Service +- Select or create a FSM orders +- Move it to the stage configured before to trigger the execution of + the server action + +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 + +Contributors +------------ + +- Open Source Integrators + + - Wolfgang Hall + - Maxime Chambreuil + - Steve Campbell + - Mohammad Khalid + +- Brian McMaster +- Italo Lopes + +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-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-osi-scampbell| image:: https://github.com/osi-scampbell.png?size=40px + :target: https://github.com/osi-scampbell + :alt: osi-scampbell + +Current `maintainers `__: + +|maintainer-wolfhall| |maintainer-max3903| |maintainer-osi-scampbell| + +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_stage_server_action/__init__.py b/fieldservice_stage_server_action/__init__.py new file mode 100644 index 0000000000..a0d2c6cd29 --- /dev/null +++ b/fieldservice_stage_server_action/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2019, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/fieldservice_stage_server_action/__manifest__.py b/fieldservice_stage_server_action/__manifest__.py new file mode 100644 index 0000000000..da2a1a4860 --- /dev/null +++ b/fieldservice_stage_server_action/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2019, Open Source Integrators +# # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). +{ + "name": "Field Service - Stage Server Action", + "summary": "Execute server actions when reaching a Field Service stage", + "version": "18.0.1.1.0", + "category": "Field Service", + "author": "Open Source Integrators, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/field-service", + "depends": ["fieldservice", "base_automation"], + "data": [ + "data/ir_server_action.xml", + "data/fsm_stage.xml", + "data/base_automation.xml", + "views/fsm_stage.xml", + ], + "installable": True, + "license": "AGPL-3", + "development_status": "Beta", + "maintainers": ["wolfhall", "max3903", "osi-scampbell"], +} diff --git a/fieldservice_stage_server_action/data/base_automation.xml b/fieldservice_stage_server_action/data/base_automation.xml new file mode 100644 index 0000000000..5f724bde2b --- /dev/null +++ b/fieldservice_stage_server_action/data/base_automation.xml @@ -0,0 +1,15 @@ + + + FSM Order Email Sender + + on_create_or_write + + + + diff --git a/fieldservice_stage_server_action/data/fsm_stage.xml b/fieldservice_stage_server_action/data/fsm_stage.xml new file mode 100644 index 0000000000..8805f3519b --- /dev/null +++ b/fieldservice_stage_server_action/data/fsm_stage.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/fieldservice_stage_server_action/data/ir_server_action.xml b/fieldservice_stage_server_action/data/ir_server_action.xml new file mode 100644 index 0000000000..5deff9eedb --- /dev/null +++ b/fieldservice_stage_server_action/data/ir_server_action.xml @@ -0,0 +1,12 @@ + + + FSM Order Completed Parent + + multi + + + FSM Order Canceled Parent + + multi + + diff --git a/fieldservice_stage_server_action/i18n/de.po b/fieldservice_stage_server_action/i18n/de.po new file mode 100644 index 0000000000..042527a001 --- /dev/null +++ b/fieldservice_stage_server_action/i18n/de.po @@ -0,0 +1,50 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_stage_server_action +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-12-03 15:45+0000\n" +"Last-Translator: Nils Coenen | NICO SOLUTIONS - ENGINEERING & IT \n" +"Language-Team: none\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.14.1\n" + +#. module: fieldservice_stage_server_action +#: model:ir.actions.server,name:fieldservice_stage_server_action.fsm_order_parent_canceled +#: model:ir.actions.server,name:fieldservice_stage_server_action.fsm_order_parent_completed +msgid "Execute Existing Actions" +msgstr "" + +#. module: fieldservice_stage_server_action +#: model:base.automation,name:fieldservice_stage_server_action.fsm_order_email_sender +msgid "FSM Order Email Sender" +msgstr "Absender der FSM Auftrags-Email" + +#. module: fieldservice_stage_server_action +#: model:ir.model,name:fieldservice_stage_server_action.model_fsm_order +msgid "Field Service Order" +msgstr "" + +#. module: fieldservice_stage_server_action +#: model:ir.model,name:fieldservice_stage_server_action.model_fsm_stage +msgid "Field Service Stage" +msgstr "Field Service Stufe" + +#. module: fieldservice_stage_server_action +#: model:ir.model.fields,field_description:fieldservice_stage_server_action.field_fsm_stage__action_id +msgid "Server Action" +msgstr "Serveraktion" + +#~ msgid "FSM Order Canceled Parent" +#~ msgstr "Übergeordnetes hat FSM-Auftrag storniert" + +#~ msgid "FSM Order Completed Parent" +#~ msgstr "Übergeordnetes schliesst FSM-Auftrag ab" diff --git a/fieldservice_stage_server_action/i18n/es.po b/fieldservice_stage_server_action/i18n/es.po new file mode 100644 index 0000000000..10ab4dfd83 --- /dev/null +++ b/fieldservice_stage_server_action/i18n/es.po @@ -0,0 +1,49 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_stage_server_action +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-03-02 20:22+0000\n" +"Last-Translator: Leonardo J. Caballero G. \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.14.1\n" + +#. module: fieldservice_stage_server_action +#: model:ir.actions.server,name:fieldservice_stage_server_action.fsm_order_parent_canceled +#: model:ir.actions.server,name:fieldservice_stage_server_action.fsm_order_parent_completed +msgid "Execute Existing Actions" +msgstr "" + +#. module: fieldservice_stage_server_action +#: model:base.automation,name:fieldservice_stage_server_action.fsm_order_email_sender +msgid "FSM Order Email Sender" +msgstr "Remitente de Correo de Pedido FSM" + +#. module: fieldservice_stage_server_action +#: model:ir.model,name:fieldservice_stage_server_action.model_fsm_order +msgid "Field Service Order" +msgstr "" + +#. module: fieldservice_stage_server_action +#: model:ir.model,name:fieldservice_stage_server_action.model_fsm_stage +msgid "Field Service Stage" +msgstr "Etapa de Servicio de Campo" + +#. module: fieldservice_stage_server_action +#: model:ir.model.fields,field_description:fieldservice_stage_server_action.field_fsm_stage__action_id +msgid "Server Action" +msgstr "Acción de Servidor" + +#~ msgid "FSM Order Canceled Parent" +#~ msgstr "Pedido FSM cancelado padre" + +#~ msgid "FSM Order Completed Parent" +#~ msgstr "Pedido FSM Padre Completado" diff --git a/fieldservice_stage_server_action/i18n/es_AR.po b/fieldservice_stage_server_action/i18n/es_AR.po new file mode 100644 index 0000000000..188f18abf5 --- /dev/null +++ b/fieldservice_stage_server_action/i18n/es_AR.po @@ -0,0 +1,58 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_stage_server_action +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-10-05 18:06+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 5.6.2\n" + +#. module: fieldservice_stage_server_action +#: model:ir.actions.server,name:fieldservice_stage_server_action.fsm_order_parent_canceled +#: model:ir.actions.server,name:fieldservice_stage_server_action.fsm_order_parent_completed +msgid "Execute Existing Actions" +msgstr "Ejecutar Acciones Existentes" + +#. module: fieldservice_stage_server_action +#: model:base.automation,name:fieldservice_stage_server_action.fsm_order_email_sender +msgid "FSM Order Email Sender" +msgstr "Correo Electrónico del Remitente del Pedido FSM" + +#. module: fieldservice_stage_server_action +#: model:ir.model,name:fieldservice_stage_server_action.model_fsm_order +msgid "Field Service Order" +msgstr "Pedido de Servicio de Campo" + +#. module: fieldservice_stage_server_action +#: model:ir.model,name:fieldservice_stage_server_action.model_fsm_stage +msgid "Field Service Stage" +msgstr "Etapa de Servicio de Campo" + +#. module: fieldservice_stage_server_action +#: model:ir.model.fields,field_description:fieldservice_stage_server_action.field_fsm_stage__action_id +msgid "Server Action" +msgstr "Acción del Servidor" + +#~ msgid "FSM Order Canceled Parent" +#~ msgstr "Padre del Pedido FSM Cancelado" + +#~ msgid "FSM Order Completed Parent" +#~ msgstr "Padre del Pedido FSM Completado" + +#~ msgid "Display Name" +#~ msgstr "Mostrar Nombre" + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Última Modificación el" diff --git a/fieldservice_stage_server_action/i18n/es_CL.po b/fieldservice_stage_server_action/i18n/es_CL.po new file mode 100644 index 0000000000..e29ca2c76c --- /dev/null +++ b/fieldservice_stage_server_action/i18n/es_CL.po @@ -0,0 +1,49 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_stage_server_action +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-03-02 20:22+0000\n" +"Last-Translator: Leonardo J. Caballero G. \n" +"Language-Team: none\n" +"Language: es_CL\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_stage_server_action +#: model:ir.actions.server,name:fieldservice_stage_server_action.fsm_order_parent_canceled +#: model:ir.actions.server,name:fieldservice_stage_server_action.fsm_order_parent_completed +msgid "Execute Existing Actions" +msgstr "" + +#. module: fieldservice_stage_server_action +#: model:base.automation,name:fieldservice_stage_server_action.fsm_order_email_sender +msgid "FSM Order Email Sender" +msgstr "Remitente de Correo de Pedido FSM" + +#. module: fieldservice_stage_server_action +#: model:ir.model,name:fieldservice_stage_server_action.model_fsm_order +msgid "Field Service Order" +msgstr "" + +#. module: fieldservice_stage_server_action +#: model:ir.model,name:fieldservice_stage_server_action.model_fsm_stage +msgid "Field Service Stage" +msgstr "Etapa de Servicio de Campo" + +#. module: fieldservice_stage_server_action +#: model:ir.model.fields,field_description:fieldservice_stage_server_action.field_fsm_stage__action_id +msgid "Server Action" +msgstr "Acción de Servidor" + +#~ msgid "FSM Order Canceled Parent" +#~ msgstr "Pedido FSM cancelado padre" + +#~ msgid "FSM Order Completed Parent" +#~ msgstr "Pedido FSM Padre Completado" diff --git a/fieldservice_stage_server_action/i18n/fieldservice_stage_server_action.pot b/fieldservice_stage_server_action/i18n/fieldservice_stage_server_action.pot new file mode 100644 index 0000000000..efa726aa64 --- /dev/null +++ b/fieldservice_stage_server_action/i18n/fieldservice_stage_server_action.pot @@ -0,0 +1,40 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_stage_server_action +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.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_stage_server_action +#: model:ir.actions.server,name:fieldservice_stage_server_action.fsm_order_parent_canceled +#: model:ir.actions.server,name:fieldservice_stage_server_action.fsm_order_parent_completed +msgid "Execute Existing Actions" +msgstr "" + +#. module: fieldservice_stage_server_action +#: model:base.automation,name:fieldservice_stage_server_action.fsm_order_email_sender +msgid "FSM Order Email Sender" +msgstr "" + +#. module: fieldservice_stage_server_action +#: model:ir.model,name:fieldservice_stage_server_action.model_fsm_order +msgid "Field Service Order" +msgstr "" + +#. module: fieldservice_stage_server_action +#: model:ir.model,name:fieldservice_stage_server_action.model_fsm_stage +msgid "Field Service Stage" +msgstr "" + +#. module: fieldservice_stage_server_action +#: model:ir.model.fields,field_description:fieldservice_stage_server_action.field_fsm_stage__action_id +msgid "Server Action" +msgstr "" diff --git a/fieldservice_stage_server_action/i18n/it.po b/fieldservice_stage_server_action/i18n/it.po new file mode 100644 index 0000000000..30df7a7879 --- /dev/null +++ b/fieldservice_stage_server_action/i18n/it.po @@ -0,0 +1,49 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_stage_server_action +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-09-23 09:06+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.6.2\n" + +#. module: fieldservice_stage_server_action +#: model:ir.actions.server,name:fieldservice_stage_server_action.fsm_order_parent_canceled +#: model:ir.actions.server,name:fieldservice_stage_server_action.fsm_order_parent_completed +msgid "Execute Existing Actions" +msgstr "Eseguire azioni esistenti" + +#. module: fieldservice_stage_server_action +#: model:base.automation,name:fieldservice_stage_server_action.fsm_order_email_sender +msgid "FSM Order Email Sender" +msgstr "Mittente email ordine FSM" + +#. module: fieldservice_stage_server_action +#: model:ir.model,name:fieldservice_stage_server_action.model_fsm_order +msgid "Field Service Order" +msgstr "Ordine assistenza sul campo" + +#. module: fieldservice_stage_server_action +#: model:ir.model,name:fieldservice_stage_server_action.model_fsm_stage +msgid "Field Service Stage" +msgstr "Fase assistenza sul campo" + +#. module: fieldservice_stage_server_action +#: model:ir.model.fields,field_description:fieldservice_stage_server_action.field_fsm_stage__action_id +msgid "Server Action" +msgstr "Azione server" + +#~ msgid "FSM Order Canceled Parent" +#~ msgstr "Padre ordine FSM annullato" + +#~ msgid "FSM Order Completed Parent" +#~ msgstr "Padre ordine FSM completato" diff --git a/fieldservice_stage_server_action/i18n/pt_BR.po b/fieldservice_stage_server_action/i18n/pt_BR.po new file mode 100644 index 0000000000..6a791e2a0a --- /dev/null +++ b/fieldservice_stage_server_action/i18n/pt_BR.po @@ -0,0 +1,49 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_stage_server_action +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-06-17 16:19+0000\n" +"Last-Translator: Fernando Colus \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 3.10\n" + +#. module: fieldservice_stage_server_action +#: model:ir.actions.server,name:fieldservice_stage_server_action.fsm_order_parent_canceled +#: model:ir.actions.server,name:fieldservice_stage_server_action.fsm_order_parent_completed +msgid "Execute Existing Actions" +msgstr "" + +#. module: fieldservice_stage_server_action +#: model:base.automation,name:fieldservice_stage_server_action.fsm_order_email_sender +msgid "FSM Order Email Sender" +msgstr "Remetente do email do pedido" + +#. module: fieldservice_stage_server_action +#: model:ir.model,name:fieldservice_stage_server_action.model_fsm_order +msgid "Field Service Order" +msgstr "" + +#. module: fieldservice_stage_server_action +#: model:ir.model,name:fieldservice_stage_server_action.model_fsm_stage +msgid "Field Service Stage" +msgstr "Est??gio de Servi??o de Campo" + +#. module: fieldservice_stage_server_action +#: model:ir.model.fields,field_description:fieldservice_stage_server_action.field_fsm_stage__action_id +msgid "Server Action" +msgstr "A????o do Servidor" + +#~ msgid "FSM Order Canceled Parent" +#~ msgstr "Pai do pedido cancelado" + +#~ msgid "FSM Order Completed Parent" +#~ msgstr "Pai do pedido completado" diff --git a/fieldservice_stage_server_action/models/__init__.py b/fieldservice_stage_server_action/models/__init__.py new file mode 100644 index 0000000000..c33786a577 --- /dev/null +++ b/fieldservice_stage_server_action/models/__init__.py @@ -0,0 +1,5 @@ +# Copyright (C) 2019, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import fsm_stage +from . import fsm_order diff --git a/fieldservice_stage_server_action/models/fsm_order.py b/fieldservice_stage_server_action/models/fsm_order.py new file mode 100644 index 0000000000..684a8dcdcb --- /dev/null +++ b/fieldservice_stage_server_action/models/fsm_order.py @@ -0,0 +1,31 @@ +# Copyright 2024 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import api, models + + +class FSMOrder(models.Model): + _inherit = "fsm.order" + + @api.model_create_multi + def create(self, vals_list): + orders = super().create(vals_list) + orders._run_stage_server_action() + return orders + + def write(self, vals): + res = super().write(vals) + if "stage_id" in vals: + self._run_stage_server_action() + return res + + def _run_stage_server_action(self): + for order in self: + action_id = order.stage_id.action_id + if not action_id: + continue + ctx = { + "active_model": self._name, + "active_id": order.id, + } + action_id.with_context(**ctx).run() diff --git a/fieldservice_stage_server_action/models/fsm_stage.py b/fieldservice_stage_server_action/models/fsm_stage.py new file mode 100644 index 0000000000..6bc8f63fa0 --- /dev/null +++ b/fieldservice_stage_server_action/models/fsm_stage.py @@ -0,0 +1,10 @@ +# Copyright (C) 2019, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class FSMStage(models.Model): + _inherit = "fsm.stage" + + action_id = fields.Many2one("ir.actions.server", string="Server Action") diff --git a/fieldservice_stage_server_action/pyproject.toml b/fieldservice_stage_server_action/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/fieldservice_stage_server_action/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/fieldservice_stage_server_action/readme/CONFIGURE.md b/fieldservice_stage_server_action/readme/CONFIGURE.md new file mode 100644 index 0000000000..115e149869 --- /dev/null +++ b/fieldservice_stage_server_action/readme/CONFIGURE.md @@ -0,0 +1,3 @@ +- Go to Field Service \> Configuration \> Stages +- Create or select a stage +- Select or create a server action diff --git a/fieldservice_stage_server_action/readme/CONTRIBUTORS.md b/fieldservice_stage_server_action/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..9757b5ac4a --- /dev/null +++ b/fieldservice_stage_server_action/readme/CONTRIBUTORS.md @@ -0,0 +1,7 @@ +- Open Source Integrators \<\> + - Wolfgang Hall \<\> + - Maxime Chambreuil \<\> + - Steve Campbell \<\> + - Mohammad Khalid \<\> +- Brian McMaster \<\> +- Italo Lopes \<\> diff --git a/fieldservice_stage_server_action/readme/DESCRIPTION.md b/fieldservice_stage_server_action/readme/DESCRIPTION.md new file mode 100644 index 0000000000..b5fcad3b4e --- /dev/null +++ b/fieldservice_stage_server_action/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This module allows you to execute server actions when a FSM orders +enters a specific stage. diff --git a/fieldservice_stage_server_action/readme/USAGE.md b/fieldservice_stage_server_action/readme/USAGE.md new file mode 100644 index 0000000000..a771020b63 --- /dev/null +++ b/fieldservice_stage_server_action/readme/USAGE.md @@ -0,0 +1,4 @@ +- Go to Field Service +- Select or create a FSM orders +- Move it to the stage configured before to trigger the execution of the + server action diff --git a/fieldservice_stage_server_action/static/description/icon.png b/fieldservice_stage_server_action/static/description/icon.png new file mode 100644 index 0000000000..e3757caa15 Binary files /dev/null and b/fieldservice_stage_server_action/static/description/icon.png differ diff --git a/fieldservice_stage_server_action/static/description/icon.svg b/fieldservice_stage_server_action/static/description/icon.svg new file mode 100644 index 0000000000..c27c090fda --- /dev/null +++ b/fieldservice_stage_server_action/static/description/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/fieldservice_stage_server_action/static/description/index.html b/fieldservice_stage_server_action/static/description/index.html new file mode 100644 index 0000000000..8ff989c2d7 --- /dev/null +++ b/fieldservice_stage_server_action/static/description/index.html @@ -0,0 +1,453 @@ + + + + + +Field Service - Stage Server Action + + + +
+

Field Service - Stage Server Action

+ + +

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

+

This module allows you to execute server actions when a FSM orders +enters a specific stage.

+

Table of contents

+ +
+

Configuration

+
    +
  • Go to Field Service > Configuration > Stages
  • +
  • Create or select a stage
  • +
  • Select or create a server action
  • +
+
+
+

Usage

+
    +
  • Go to Field Service
  • +
  • Select or create a FSM orders
  • +
  • Move it to the stage configured before to trigger the execution of +the server action
  • +
+
+
+

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
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

Current maintainers:

+

wolfhall max3903 osi-scampbell

+

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_stage_server_action/tests/__init__.py b/fieldservice_stage_server_action/tests/__init__.py new file mode 100644 index 0000000000..05131bcca2 --- /dev/null +++ b/fieldservice_stage_server_action/tests/__init__.py @@ -0,0 +1 @@ +from . import test_fsm_order_run_action diff --git a/fieldservice_stage_server_action/tests/test_fsm_order_run_action.py b/fieldservice_stage_server_action/tests/test_fsm_order_run_action.py new file mode 100644 index 0000000000..5dfce0dc90 --- /dev/null +++ b/fieldservice_stage_server_action/tests/test_fsm_order_run_action.py @@ -0,0 +1,40 @@ +# Copyright 2024 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo.tests.common import RecordCapturer, TransactionCase + + +class TestFSMOrderRunAction(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.Order = cls.env["fsm.order"] + cls.Tag = cls.env["fsm.tag"] + cls.test_location = cls.env.ref("fieldservice.test_location") + cls.stage1 = cls.env.ref("fieldservice.fsm_stage_completed") + cls.stage2 = cls.env.ref("fieldservice.fsm_stage_cancelled") + cls.location_1 = cls.env.ref("fieldservice.location_1") + cls.create_action = cls.env["ir.actions.server"].create( + { + "model_id": cls.env["ir.model"]._get_id("fsm.tag"), + "crud_model_id": cls.env["ir.model"]._get_id("fsm.tag"), + "name": "Create new tag", + "value": "New test tag", + "state": "object_create", + } + ) + cls.stage2.action_id = cls.create_action + + def test_fsm_order_run_action(self): + order = self.Order.create( + { + "location_id": self.test_location.id, + "stage_id": self.stage1.id, + } + ) + self.assertFalse(self.Tag.search([("name", "=", "New test tag")]).exists()) + with RecordCapturer(self.Tag, []) as capture: + order.write({"stage_id": self.stage2.id}) + tag = capture.records + self.assertEqual(1, len(tag)) + self.assertEqual("New test tag", tag.name) diff --git a/fieldservice_stage_server_action/views/fsm_stage.xml b/fieldservice_stage_server_action/views/fsm_stage.xml new file mode 100644 index 0000000000..4e5b1e5574 --- /dev/null +++ b/fieldservice_stage_server_action/views/fsm_stage.xml @@ -0,0 +1,13 @@ + + + + fsm.server.action.stage.form + fsm.stage + + + + + + + +