From b5e38b25eff097ab68890711133bc4a2b31972df Mon Sep 17 00:00:00 2001 From: Sandip Mangukiya Date: Mon, 31 Dec 2018 05:34:35 -0800 Subject: [PATCH 01/50] [ADD] fieldservice_maintenance --- fieldservice_maintenance/README.rst | 132 +++++ fieldservice_maintenance/__init__.py | 4 + fieldservice_maintenance/__manifest__.py | 26 + fieldservice_maintenance/models/__init__.py | 6 + .../models/fsm_equipment.py | 13 + fieldservice_maintenance/models/fsm_order.py | 46 ++ .../models/maintenance.py | 32 ++ fieldservice_maintenance/readme/CONFIGURE.rst | 5 + .../readme/CONTRIBUTORS.rst | 1 + fieldservice_maintenance/readme/CREDITS.rst | 3 + .../readme/DESCRIPTION.rst | 7 + fieldservice_maintenance/readme/INSTALL.rst | 5 + fieldservice_maintenance/readme/ROADMAP.rst | 2 + fieldservice_maintenance/readme/USAGE.rst | 7 + .../static/description/icon.png | Bin 0 -> 17808 bytes .../static/description/index.html | 470 ++++++++++++++++++ .../views/fsm_equipment_view.xml | 15 + .../views/fsm_order_view.xml | 25 + .../views/maintenance_view.xml | 33 ++ 19 files changed, 832 insertions(+) create mode 100644 fieldservice_maintenance/README.rst create mode 100644 fieldservice_maintenance/__init__.py create mode 100644 fieldservice_maintenance/__manifest__.py create mode 100644 fieldservice_maintenance/models/__init__.py create mode 100644 fieldservice_maintenance/models/fsm_equipment.py create mode 100644 fieldservice_maintenance/models/fsm_order.py create mode 100644 fieldservice_maintenance/models/maintenance.py create mode 100644 fieldservice_maintenance/readme/CONFIGURE.rst create mode 100644 fieldservice_maintenance/readme/CONTRIBUTORS.rst create mode 100644 fieldservice_maintenance/readme/CREDITS.rst create mode 100644 fieldservice_maintenance/readme/DESCRIPTION.rst create mode 100644 fieldservice_maintenance/readme/INSTALL.rst create mode 100644 fieldservice_maintenance/readme/ROADMAP.rst create mode 100644 fieldservice_maintenance/readme/USAGE.rst create mode 100644 fieldservice_maintenance/static/description/icon.png create mode 100644 fieldservice_maintenance/static/description/index.html create mode 100644 fieldservice_maintenance/views/fsm_equipment_view.xml create mode 100644 fieldservice_maintenance/views/fsm_order_view.xml create mode 100644 fieldservice_maintenance/views/maintenance_view.xml diff --git a/fieldservice_maintenance/README.rst b/fieldservice_maintenance/README.rst new file mode 100644 index 0000000000..fa3e01ee7b --- /dev/null +++ b/fieldservice_maintenance/README.rst @@ -0,0 +1,132 @@ +=========================== +Field Service - Maintenance +=========================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/11.0/fieldservice_maintenance + :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-11-0/field-service-11-0-fieldservice_maintenance + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/264/11.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Odoo Maintenance App does not support Field Service operations for equipments +outside the company facilities. On the other hand, the Field Service App does +not support a maintenance schedule generating preventive maintenance request. + +This module allows you to merge equipments from Field Service and Maintenance +and have a maintenance schedule for FSM equipments as well as Field Service +capabilities for maintenance equipments. + +**Table of contents** + +.. contents:: + :local: + +Installation +============ + +To install Field Service and have the mapping features, +you need to install fieldservice_stock and maintenance + +Please refer to the installation instructions available at: +https://github.com/OCA/field-service/tree/11.0/fieldservice_maintenance + +Configuration +============= + +To use this module, you need to: + +* Go to Field Service > Master Data > Equipments or Maintenance > Equipments +* Create or select an equipment +* Specify the maintenance schedule + +Usage +===== + +To use this module, you need to: + +* Maintenance requests related to a FSM equipment will create a FSM order +* Go to Field Service +* Create or select a FSM order and select the type Maintenance. +* Select the maintenance team, the equipment and the location +* Upon saving, a maintenance request will be created with the information from the FSM order. + +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 smashing 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 +~~~~~~~~~~~~ + +* Sandip Mangukiya + +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-smangukiya| image:: https://github.com/smangukiya.png?size=40px + :target: https://github.com/smangukiya + :alt: smangukiya +.. |maintainer-max3903| image:: https://github.com/max3903.png?size=40px + :target: https://github.com/max3903 + :alt: max3903 + +Current `maintainers `__: + +|maintainer-smangukiya| |maintainer-max3903| + +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_maintenance/__init__.py b/fieldservice_maintenance/__init__.py new file mode 100644 index 0000000000..631bd4893a --- /dev/null +++ b/fieldservice_maintenance/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2018 - TODAY, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/fieldservice_maintenance/__manifest__.py b/fieldservice_maintenance/__manifest__.py new file mode 100644 index 0000000000..592d2d0a58 --- /dev/null +++ b/fieldservice_maintenance/__manifest__.py @@ -0,0 +1,26 @@ +# Copyright (C) 2018 - TODAY, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': 'Field Service - Maintenance', + 'summary': 'Maintenance', + 'version': '11.0.0.0.1', + 'category': 'Field Service', + 'author': 'Open Source Integrators, Odoo Community Association (OCA)', + 'website': 'https://github.com/OCA/field-service', + 'depends': [ + 'fieldservice_stock', + 'maintenance', + ], + 'data': [ + 'views/maintenance_view.xml', + 'views/fsm_equipment_view.xml', + 'views/fsm_order_view.xml', + ], + 'license': 'AGPL-3', + 'development_status': 'Beta', + 'maintainers': [ + 'smangukiya', + 'max3903', + ], +} diff --git a/fieldservice_maintenance/models/__init__.py b/fieldservice_maintenance/models/__init__.py new file mode 100644 index 0000000000..bac82e01f7 --- /dev/null +++ b/fieldservice_maintenance/models/__init__.py @@ -0,0 +1,6 @@ +# Copyright (C) 2018 - TODAY, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import fsm_order +from . import maintenance +from . import fsm_equipment diff --git a/fieldservice_maintenance/models/fsm_equipment.py b/fieldservice_maintenance/models/fsm_equipment.py new file mode 100644 index 0000000000..49abfc91a7 --- /dev/null +++ b/fieldservice_maintenance/models/fsm_equipment.py @@ -0,0 +1,13 @@ +# Copyright (C) 2018 - TODAY, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class FSMEquipment(models.Model): + _inherit = 'fsm.equipment' + _inherits = {'maintenance.equipment': 'maintenance_equipment_id'} + _description = 'FSM Maintenance equipment' + + maintenance_equipment_id = fields.Many2one( + 'maintenance.equipment', string='Maintenance Equipment') diff --git a/fieldservice_maintenance/models/fsm_order.py b/fieldservice_maintenance/models/fsm_order.py new file mode 100644 index 0000000000..4b668d0511 --- /dev/null +++ b/fieldservice_maintenance/models/fsm_order.py @@ -0,0 +1,46 @@ +# Copyright (C) 2018 - TODAY, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields +from odoo.addons.base_geoengine import geo_model + + +class FSMOrder(geo_model.GeoModel): + _inherit = 'fsm.order' + _description = 'Field Service Order Maintenance' + + type = fields.Selection(selection_add=[('maintenance', 'Maintenance')]) + request_id = fields.Many2one( + 'maintenance.request', 'Maintenance Request') + maintenance_team_id = fields.Many2one('maintenance.team', string='Team') + + @api.model + def create(self, vals): + # if FSM order with type maintenance is create then + # create maintenance request + order = super(FSMOrder, self).create(vals) + if order.type == 'maintenance': + employee_ids = self.env['hr.employee'].search( + [('user_id', '=', self.env.uid)]) + if employee_ids: + employee_id = employee_ids[0] + if order.equipment_id: + equipment = order.equipment_id + request_id = self.env['maintenance.request'].create({ + 'name': order.name or '', + 'employee_id': employee_id.id, + 'equipment_id': + equipment.maintenance_equipment_id + and equipment.maintenance_equipment_id.id or False, + 'category_id': + equipment.category_id and + equipment.category_id.id or False, + 'request_date': fields.Date.context_today(self), + 'maintenance_type': 'corrective', + 'maintenance_team_id': + order.maintenance_team_id.id or False, + 'schedule_date': order.request_early, + 'description': order.description + }) + order.request_id = request_id + return order diff --git a/fieldservice_maintenance/models/maintenance.py b/fieldservice_maintenance/models/maintenance.py new file mode 100644 index 0000000000..caa5df7841 --- /dev/null +++ b/fieldservice_maintenance/models/maintenance.py @@ -0,0 +1,32 @@ +# Copyright (C) 2018 - TODAY, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class MaintenanceEquipment(models.Model): + _inherit = 'maintenance.equipment' + + is_fsm_equipment = fields.Boolean(string='Is a FSM Equipment') + + +class MaintenanceRequest(models.Model): + _inherit = 'maintenance.request' + + fsm_order_id = fields.Many2one('fsm.order', 'Field Service Order') + + @api.model + def create(self, vals): + # create FSM order with type maintenance if selected equipment is + # enabled with boolean is_fsm_equipment + request = super(MaintenanceRequest, self).create(vals) + if request.equipment_id.is_fsm_equipment: + # Get the fsm equipment + fsm_equipment = self.env['fsm.equipment'].search( + 'maintenance_equipment_id', '=', request.equipment_id) + fsm_order_id = self.env['fsm.order'].create({ + 'type': 'maintenance', + 'equipment_id': fsm_equipment and fsm_equipment[0].id or False + }) + request.fsm_order_id = fsm_order_id + return request diff --git a/fieldservice_maintenance/readme/CONFIGURE.rst b/fieldservice_maintenance/readme/CONFIGURE.rst new file mode 100644 index 0000000000..94eb8eb084 --- /dev/null +++ b/fieldservice_maintenance/readme/CONFIGURE.rst @@ -0,0 +1,5 @@ +To use this module, you need to: + +* Go to Field Service > Master Data > Equipments or Maintenance > Equipments +* Create or select an equipment +* Specify the maintenance schedule diff --git a/fieldservice_maintenance/readme/CONTRIBUTORS.rst b/fieldservice_maintenance/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..a76235f8a2 --- /dev/null +++ b/fieldservice_maintenance/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Sandip Mangukiya diff --git a/fieldservice_maintenance/readme/CREDITS.rst b/fieldservice_maintenance/readme/CREDITS.rst new file mode 100644 index 0000000000..0eff0acf4e --- /dev/null +++ b/fieldservice_maintenance/readme/CREDITS.rst @@ -0,0 +1,3 @@ +The development of this module has been financially supported by: + +* Open Source Integrators diff --git a/fieldservice_maintenance/readme/DESCRIPTION.rst b/fieldservice_maintenance/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..a8a98ee699 --- /dev/null +++ b/fieldservice_maintenance/readme/DESCRIPTION.rst @@ -0,0 +1,7 @@ +Odoo Maintenance App does not support Field Service operations for equipments +outside the company facilities. On the other hand, the Field Service App does +not support a maintenance schedule generating preventive maintenance request. + +This module allows you to merge equipments from Field Service and Maintenance +and have a maintenance schedule for FSM equipments as well as Field Service +capabilities for maintenance equipments. \ No newline at end of file diff --git a/fieldservice_maintenance/readme/INSTALL.rst b/fieldservice_maintenance/readme/INSTALL.rst new file mode 100644 index 0000000000..43c27d0602 --- /dev/null +++ b/fieldservice_maintenance/readme/INSTALL.rst @@ -0,0 +1,5 @@ +To install Field Service and have the mapping features, +you need to install fieldservice_stock and maintenance + +Please refer to the installation instructions available at: +https://github.com/OCA/field-service/tree/11.0/fieldservice_maintenance diff --git a/fieldservice_maintenance/readme/ROADMAP.rst b/fieldservice_maintenance/readme/ROADMAP.rst new file mode 100644 index 0000000000..b0ff1e4854 --- /dev/null +++ b/fieldservice_maintenance/readme/ROADMAP.rst @@ -0,0 +1,2 @@ +The roadmap of the Field Service application is documented on +`Github `_. diff --git a/fieldservice_maintenance/readme/USAGE.rst b/fieldservice_maintenance/readme/USAGE.rst new file mode 100644 index 0000000000..e71b68687d --- /dev/null +++ b/fieldservice_maintenance/readme/USAGE.rst @@ -0,0 +1,7 @@ +To use this module, you need to: + +* Maintenance requests related to a FSM equipment will create a FSM order +* Go to Field Service +* Create or select a FSM order and select the type Maintenance. +* Select the maintenance team, the equipment and the location +* Upon saving, a maintenance request will be created with the information from the FSM order. diff --git a/fieldservice_maintenance/static/description/icon.png b/fieldservice_maintenance/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..955674d8f0b8c47de3ffa9db25cb109fbe4a1091 GIT binary patch literal 17808 zcmeHvc;{H3sucZElF-G)hC-+rdy@|cVP3o7ETY&& zJl-5>)T;P#Y>Z2k74p9gK&J2CJC5%@{WsV@`$(=#w|Cf>44L@opuIqTY_XMpYif9< zJEhZ)*(Ciawd2E4g!g{`tf-6DV*W@FZ!b&?uih_mMpBM%8|x61r3D=Pkjl)*LT52YNq;hIj5|udFA)RjvAIV zR;k3*$i5qSsi6bcd50k9_J$d6qZe5$CLIT#a*i*=wkVz%dgiqH(oe=68=3m>aXb03 zuyMGqBG(dcQxAcfP+K4yg1i{GtF9VUM32?R>d%HqF@xRPyIc?3mifg(5sPQ&5bDFm zimOQwOnX4K!Srd#7sF2xi^4^1yiGAIq~p7mmzr<~Lo z`^Zj#UvWcW93Rm$F}uR@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q7tknyZpxvuEohyH{$F=!8mZnEQAjI zQ46(s-Yaz;wNUgv&W5ThKB{W3(9dUm{iObJMRL?`A=vQt%jg)l{#&O4GI+#Kwjew0nySosF+@T>xBYngWHD;bxF;7b-%>cT74(~!j za)0gM!|>0eyS75X+B()YfAk)l$Phu_s10UQ8K<;`o;##M&SgtTuC$&4T{~TLYh~dK zLm$LxbZ^z;{Wl*6GW5?iFeeetYLG-nRdM6TR)K?1<#+hD&;m{|(ME|BrHBci#pV0oF(@prIFR=LEDdC|` z$6e@>ZBk~p1x{c}1ap=W1^2W?Z=AMy=;mO76+#5-nyl4XmK<5P7YCL|M_(NIF>`>^ z*RLK*lO8nwDMbFyjM$-Z6Jc-2q&bOb^^g1dhQG`X-*=g!K5kpSk08tH`uba$AEu(3 gUHh>HCdQ7*k1fAW1vhU(MTsEtw^U^Fq)ngxAO8EYHUIzs literal 0 HcmV?d00001 diff --git a/fieldservice_maintenance/static/description/index.html b/fieldservice_maintenance/static/description/index.html new file mode 100644 index 0000000000..f641896644 --- /dev/null +++ b/fieldservice_maintenance/static/description/index.html @@ -0,0 +1,470 @@ + + + + + + +Field Service - Maintenance + + + +
+

Field Service - Maintenance

+ + +

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

+

Odoo Maintenance App does not support Field Service operations for equipments +outside the company facilities. On the other hand, the Field Service App does +not support a maintenance schedule generating preventive maintenance request.

+

This module allows you to merge equipments from Field Service and Maintenance +and have a maintenance schedule for FSM equipments as well as Field Service +capabilities for maintenance equipments.

+

Table of contents

+ +
+

Installation

+

To install Field Service and have the mapping features, +you need to install fieldservice_stock and maintenance

+

Please refer to the installation instructions available at: +https://github.com/OCA/field-service/tree/11.0/fieldservice_maintenance

+
+
+

Configuration

+

To use this module, you need to:

+
    +
  • Go to Field Service > Master Data > Equipments or Maintenance > Equipments
  • +
  • Create or select an equipment
  • +
  • Specify the maintenance schedule
  • +
+
+
+

Usage

+

To use this module, you need to:

+
    +
  • Maintenance requests related to a FSM equipment will create a FSM order
  • +
  • Go to Field Service
  • +
  • Create or select a FSM order and select the type Maintenance.
  • +
  • Select the maintenance team, the equipment and the location
  • +
  • Upon saving, a maintenance request will be created with the information from the FSM order.
  • +
+
+
+

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

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:

+

smangukiya max3903

+

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_maintenance/views/fsm_equipment_view.xml b/fieldservice_maintenance/views/fsm_equipment_view.xml new file mode 100644 index 0000000000..85e2ab1598 --- /dev/null +++ b/fieldservice_maintenance/views/fsm_equipment_view.xml @@ -0,0 +1,15 @@ + + + + + + fsm.equipment.form.maintenance + fsm.equipment + + + + + + + + diff --git a/fieldservice_maintenance/views/fsm_order_view.xml b/fieldservice_maintenance/views/fsm_order_view.xml new file mode 100644 index 0000000000..bcab7bc294 --- /dev/null +++ b/fieldservice_maintenance/views/fsm_order_view.xml @@ -0,0 +1,25 @@ + + + + + + + fsm.order.maintenance.form + fsm.order + + + + + + + + {'required': [('type', '=', 'maintenance')]} + + + + + diff --git a/fieldservice_maintenance/views/maintenance_view.xml b/fieldservice_maintenance/views/maintenance_view.xml new file mode 100644 index 0000000000..d896c4216a --- /dev/null +++ b/fieldservice_maintenance/views/maintenance_view.xml @@ -0,0 +1,33 @@ + + + + + + equipment.form.fsm + maintenance.equipment + + + + + + + + + + + + + + + + + equipment.request.form.fsm + maintenance.request + + + + + + + + From 84fbfa5c2052cde54db7bfcee2866dcb0d26d655 Mon Sep 17 00:00:00 2001 From: Maxime Chambreuil Date: Thu, 3 Jan 2019 14:37:55 -0600 Subject: [PATCH 02/50] [IMP] UI --- fieldservice_maintenance/models/fsm_order.py | 7 +++++-- fieldservice_maintenance/models/maintenance.py | 5 ++++- .../views/fsm_equipment_view.xml | 14 +++++++++++--- fieldservice_maintenance/views/fsm_order_view.xml | 9 ++------- .../views/maintenance_view.xml | 3 +++ 5 files changed, 25 insertions(+), 13 deletions(-) diff --git a/fieldservice_maintenance/models/fsm_order.py b/fieldservice_maintenance/models/fsm_order.py index 4b668d0511..ddc2684a34 100644 --- a/fieldservice_maintenance/models/fsm_order.py +++ b/fieldservice_maintenance/models/fsm_order.py @@ -12,7 +12,6 @@ class FSMOrder(geo_model.GeoModel): type = fields.Selection(selection_add=[('maintenance', 'Maintenance')]) request_id = fields.Many2one( 'maintenance.request', 'Maintenance Request') - maintenance_team_id = fields.Many2one('maintenance.team', string='Team') @api.model def create(self, vals): @@ -38,7 +37,11 @@ def create(self, vals): 'request_date': fields.Date.context_today(self), 'maintenance_type': 'corrective', 'maintenance_team_id': - order.maintenance_team_id.id or False, + equipment.maintenance_equipment_id and + equipment.maintenance_equipment_id.maintenance_team_id + and + equipment.maintenance_equipment_id.maintenance_team_id.id + or False, 'schedule_date': order.request_early, 'description': order.description }) diff --git a/fieldservice_maintenance/models/maintenance.py b/fieldservice_maintenance/models/maintenance.py index caa5df7841..1b16edfb89 100644 --- a/fieldservice_maintenance/models/maintenance.py +++ b/fieldservice_maintenance/models/maintenance.py @@ -26,7 +26,10 @@ def create(self, vals): 'maintenance_equipment_id', '=', request.equipment_id) fsm_order_id = self.env['fsm.order'].create({ 'type': 'maintenance', - 'equipment_id': fsm_equipment and fsm_equipment[0].id or False + 'equipment_id': fsm_equipment and fsm_equipment[0].id or False, + 'location_id': + fsm_equipment and fsm_equipment[0].current_location_id.id + or False }) request.fsm_order_id = fsm_order_id return request diff --git a/fieldservice_maintenance/views/fsm_equipment_view.xml b/fieldservice_maintenance/views/fsm_equipment_view.xml index 85e2ab1598..2f0bebc623 100644 --- a/fieldservice_maintenance/views/fsm_equipment_view.xml +++ b/fieldservice_maintenance/views/fsm_equipment_view.xml @@ -7,9 +7,17 @@ fsm.equipment - - - + + + + + + + + + + + diff --git a/fieldservice_maintenance/views/fsm_order_view.xml b/fieldservice_maintenance/views/fsm_order_view.xml index bcab7bc294..a03c5c76b8 100644 --- a/fieldservice_maintenance/views/fsm_order_view.xml +++ b/fieldservice_maintenance/views/fsm_order_view.xml @@ -9,16 +9,11 @@ fsm.order - + - - - - {'required': [('type', '=', 'maintenance')]} - + diff --git a/fieldservice_maintenance/views/maintenance_view.xml b/fieldservice_maintenance/views/maintenance_view.xml index d896c4216a..e88eb67c05 100644 --- a/fieldservice_maintenance/views/maintenance_view.xml +++ b/fieldservice_maintenance/views/maintenance_view.xml @@ -7,6 +7,9 @@ maintenance.equipment + + True + From 7ecfbe2901c5e3ccbc20bd0d97aa0c06f7624c34 Mon Sep 17 00:00:00 2001 From: Maxime Chambreuil Date: Thu, 3 Jan 2019 14:55:19 -0600 Subject: [PATCH 03/50] [FIX] PEP8 error --- fieldservice_maintenance/models/fsm_order.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fieldservice_maintenance/models/fsm_order.py b/fieldservice_maintenance/models/fsm_order.py index ddc2684a34..8cfe9228b5 100644 --- a/fieldservice_maintenance/models/fsm_order.py +++ b/fieldservice_maintenance/models/fsm_order.py @@ -25,6 +25,11 @@ def create(self, vals): employee_id = employee_ids[0] if order.equipment_id: equipment = order.equipment_id + t = equipment.maintenance_equipment_id and\ + equipment.maintenance_equipment_id.maintenance_team_id \ + and\ + equipment.maintenance_equipment_id.maintenance_team_id.id\ + or False, request_id = self.env['maintenance.request'].create({ 'name': order.name or '', 'employee_id': employee_id.id, @@ -36,12 +41,7 @@ def create(self, vals): equipment.category_id.id or False, 'request_date': fields.Date.context_today(self), 'maintenance_type': 'corrective', - 'maintenance_team_id': - equipment.maintenance_equipment_id and - equipment.maintenance_equipment_id.maintenance_team_id - and - equipment.maintenance_equipment_id.maintenance_team_id.id - or False, + 'maintenance_team_id': t, 'schedule_date': order.request_early, 'description': order.description }) From 5e896bb1c4d026cb6d156f00b2186b1001ea4c22 Mon Sep 17 00:00:00 2001 From: Maxime Chambreuil Date: Fri, 4 Jan 2019 14:24:56 -0600 Subject: [PATCH 04/50] [FIX] Model --- fieldservice_maintenance/models/fsm_equipment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fieldservice_maintenance/models/fsm_equipment.py b/fieldservice_maintenance/models/fsm_equipment.py index 49abfc91a7..04aa42c605 100644 --- a/fieldservice_maintenance/models/fsm_equipment.py +++ b/fieldservice_maintenance/models/fsm_equipment.py @@ -10,4 +10,5 @@ class FSMEquipment(models.Model): _description = 'FSM Maintenance equipment' maintenance_equipment_id = fields.Many2one( - 'maintenance.equipment', string='Maintenance Equipment') + 'maintenance.equipment', string='Maintenance Equipment', required=True, + ondelete='restrict', delegate=True, auto_join=True) From e3eee1c008852319ddf190a8a902d98c7552f2e2 Mon Sep 17 00:00:00 2001 From: Maxime Chambreuil Date: Tue, 8 Jan 2019 10:24:34 -0600 Subject: [PATCH 05/50] [FIX] PEP8 error --- fieldservice_maintenance/readme/DESCRIPTION.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fieldservice_maintenance/readme/DESCRIPTION.rst b/fieldservice_maintenance/readme/DESCRIPTION.rst index a8a98ee699..fd73d84ed7 100644 --- a/fieldservice_maintenance/readme/DESCRIPTION.rst +++ b/fieldservice_maintenance/readme/DESCRIPTION.rst @@ -4,4 +4,4 @@ not support a maintenance schedule generating preventive maintenance request. This module allows you to merge equipments from Field Service and Maintenance and have a maintenance schedule for FSM equipments as well as Field Service -capabilities for maintenance equipments. \ No newline at end of file +capabilities for maintenance equipments. From c17de5201226686ab696e1f751e114e72c55f4a6 Mon Sep 17 00:00:00 2001 From: Maxime Chambreuil Date: Wed, 9 Jan 2019 20:49:21 -0600 Subject: [PATCH 06/50] [ADD] stock.py --- fieldservice_maintenance/models/__init__.py | 9 ++++++--- fieldservice_maintenance/models/stock.py | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 fieldservice_maintenance/models/stock.py diff --git a/fieldservice_maintenance/models/__init__.py b/fieldservice_maintenance/models/__init__.py index bac82e01f7..6f21213b3c 100644 --- a/fieldservice_maintenance/models/__init__.py +++ b/fieldservice_maintenance/models/__init__.py @@ -1,6 +1,9 @@ # Copyright (C) 2018 - TODAY, Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from . import fsm_order -from . import maintenance -from . import fsm_equipment +from . import ( + fsm_order, + maintenance, + fsm_equipment, + stock, +) diff --git a/fieldservice_maintenance/models/stock.py b/fieldservice_maintenance/models/stock.py new file mode 100644 index 0000000000..b9568497b9 --- /dev/null +++ b/fieldservice_maintenance/models/stock.py @@ -0,0 +1,18 @@ +# Copyright (C) 2018 - TODAY, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models + + +class StockMove(models.Model): + _inherit = "stock.move" + + def prepare_equipment_values(self, move_line): + res = super(StockMove, self).prepare_equipment_values(move_line) + vals = {'name': '%s (%s)' % (move_line.product_id.name, + move_line.lot_id.name), + 'serial_no': move_line.lot_id.name, + 'is_fsm_equipment': True} + equipment_id = self.env['maintenance.equipment'].create(vals) + res.update({'maintenance_equipment_id': equipment_id.id}) + return res From a9783428828bcd9d3ca0ef04a6b06865a0381bf4 Mon Sep 17 00:00:00 2001 From: Maxime Chambreuil Date: Thu, 31 Jan 2019 12:42:17 -0600 Subject: [PATCH 07/50] [FIX] fieldservice_maintenance --- fieldservice_maintenance/__manifest__.py | 2 +- .../models/fsm_equipment.py | 26 ++++++++++++++++--- .../views/fsm_equipment_view.xml | 2 +- .../views/fsm_order_view.xml | 4 +-- .../views/maintenance_view.xml | 2 +- 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/fieldservice_maintenance/__manifest__.py b/fieldservice_maintenance/__manifest__.py index 592d2d0a58..5cee0eaa39 100644 --- a/fieldservice_maintenance/__manifest__.py +++ b/fieldservice_maintenance/__manifest__.py @@ -4,7 +4,7 @@ { 'name': 'Field Service - Maintenance', 'summary': 'Maintenance', - 'version': '11.0.0.0.1', + 'version': '11.0.0.1.0', 'category': 'Field Service', 'author': 'Open Source Integrators, Odoo Community Association (OCA)', 'website': 'https://github.com/OCA/field-service', diff --git a/fieldservice_maintenance/models/fsm_equipment.py b/fieldservice_maintenance/models/fsm_equipment.py index 04aa42c605..bb757ed8af 100644 --- a/fieldservice_maintenance/models/fsm_equipment.py +++ b/fieldservice_maintenance/models/fsm_equipment.py @@ -1,14 +1,32 @@ # Copyright (C) 2018 - TODAY, Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import fields, models +from odoo import api, fields, models class FSMEquipment(models.Model): _inherit = 'fsm.equipment' _inherits = {'maintenance.equipment': 'maintenance_equipment_id'} - _description = 'FSM Maintenance equipment' maintenance_equipment_id = fields.Many2one( - 'maintenance.equipment', string='Maintenance Equipment', required=True, - ondelete='restrict', delegate=True, auto_join=True) + 'maintenance.equipment', string='Related Maintenance Equipment', + required=True, ondelete='restrict', delegate=True, auto_join=True, + index=True) + + @api.model + def create(self, vals): + maintenance_equipment_id = self.env['maintenance.equipment'].create({ + 'name': vals['name'], + 'equipment_assign_to': 'other', + 'maintenance_team_id': vals['maintenance_team_id'], + 'is_fsm_equipment': True, + 'note': vals['notes'] or False, + 'serial_no': + vals['lot_id'] and + self.env['stock.production.lot'].browse(vals['lot_id']).name + or False}) + if maintenance_equipment_id: + vals.update({ + 'maintenance_equipment_id': maintenance_equipment_id.id}) + res = super(FSMEquipment, self).create(vals) + return res diff --git a/fieldservice_maintenance/views/fsm_equipment_view.xml b/fieldservice_maintenance/views/fsm_equipment_view.xml index 2f0bebc623..b49347e8e8 100644 --- a/fieldservice_maintenance/views/fsm_equipment_view.xml +++ b/fieldservice_maintenance/views/fsm_equipment_view.xml @@ -11,7 +11,7 @@ - + diff --git a/fieldservice_maintenance/views/fsm_order_view.xml b/fieldservice_maintenance/views/fsm_order_view.xml index a03c5c76b8..4e256c9e42 100644 --- a/fieldservice_maintenance/views/fsm_order_view.xml +++ b/fieldservice_maintenance/views/fsm_order_view.xml @@ -9,11 +9,11 @@ fsm.order - + - + diff --git a/fieldservice_maintenance/views/maintenance_view.xml b/fieldservice_maintenance/views/maintenance_view.xml index e88eb67c05..f05f4c592e 100644 --- a/fieldservice_maintenance/views/maintenance_view.xml +++ b/fieldservice_maintenance/views/maintenance_view.xml @@ -14,7 +14,7 @@ - + From 2abf11a80b4a82c043f46e654f15ef45bf44309e Mon Sep 17 00:00:00 2001 From: Maxime Chambreuil Date: Fri, 1 Feb 2019 19:05:17 -0600 Subject: [PATCH 08/50] [FIX] fieldservice_maintenance --- fieldservice_maintenance/__manifest__.py | 2 +- fieldservice_maintenance/views/fsm_order_view.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fieldservice_maintenance/__manifest__.py b/fieldservice_maintenance/__manifest__.py index 5cee0eaa39..8f139c8d67 100644 --- a/fieldservice_maintenance/__manifest__.py +++ b/fieldservice_maintenance/__manifest__.py @@ -4,7 +4,7 @@ { 'name': 'Field Service - Maintenance', 'summary': 'Maintenance', - 'version': '11.0.0.1.0', + 'version': '11.0.0.2.0', 'category': 'Field Service', 'author': 'Open Source Integrators, Odoo Community Association (OCA)', 'website': 'https://github.com/OCA/field-service', diff --git a/fieldservice_maintenance/views/fsm_order_view.xml b/fieldservice_maintenance/views/fsm_order_view.xml index 4e256c9e42..94642d72d0 100644 --- a/fieldservice_maintenance/views/fsm_order_view.xml +++ b/fieldservice_maintenance/views/fsm_order_view.xml @@ -9,7 +9,7 @@ fsm.order - + From d6243e1cf483f3c09613cb95261d664ecf77221d Mon Sep 17 00:00:00 2001 From: Maxime Chambreuil Date: Fri, 8 Feb 2019 00:10:23 -0600 Subject: [PATCH 09/50] [IMP] UI stuff --- .../views/fsm_equipment_view.xml | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/fieldservice_maintenance/views/fsm_equipment_view.xml b/fieldservice_maintenance/views/fsm_equipment_view.xml index b49347e8e8..49fc1d2bb0 100644 --- a/fieldservice_maintenance/views/fsm_equipment_view.xml +++ b/fieldservice_maintenance/views/fsm_equipment_view.xml @@ -7,16 +7,24 @@ fsm.equipment - - - - - - - - - - + + + + + + + + + + + fsm.equipment.model + fsm.equipment + + + + + From 1725783acb805f880d9ea4bc3e7ad3cc77dbbc85 Mon Sep 17 00:00:00 2001 From: scampbell Date: Fri, 8 Mar 2019 13:19:47 -0800 Subject: [PATCH 10/50] [IMP] FSM Maintenance Bug Fix --- .../views/fsm_equipment_view.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fieldservice_maintenance/views/fsm_equipment_view.xml b/fieldservice_maintenance/views/fsm_equipment_view.xml index 49fc1d2bb0..5a8ec7ff4d 100644 --- a/fieldservice_maintenance/views/fsm_equipment_view.xml +++ b/fieldservice_maintenance/views/fsm_equipment_view.xml @@ -28,4 +28,16 @@ + + fsm.equipment.model + fsm.equipment + + + + + + + + From 5e4384099c702171f39e7c113324f454bd5d1de4 Mon Sep 17 00:00:00 2001 From: Murtuza Saleh Date: Fri, 5 Apr 2019 20:30:17 +0530 Subject: [PATCH 11/50] [MIG][WIP][12.0] fieldservice_maintenance --- fieldservice_maintenance/README.rst | 13 +++++++------ fieldservice_maintenance/__manifest__.py | 4 +++- fieldservice_maintenance/models/__init__.py | 1 - .../models/fsm_equipment.py | 9 +++------ fieldservice_maintenance/models/fsm_order.py | 7 +++---- fieldservice_maintenance/models/maintenance.py | 7 ++++--- fieldservice_maintenance/models/stock.py | 18 ------------------ .../readme/CONTRIBUTORS.rst | 1 + fieldservice_maintenance/readme/INSTALL.rst | 2 +- .../static/description/index.html | 9 +++++---- .../views/fsm_order_view.xml | 6 +++--- .../views/maintenance_view.xml | 8 +++++--- 12 files changed, 35 insertions(+), 50 deletions(-) delete mode 100644 fieldservice_maintenance/models/stock.py diff --git a/fieldservice_maintenance/README.rst b/fieldservice_maintenance/README.rst index fa3e01ee7b..6ad9101c07 100644 --- a/fieldservice_maintenance/README.rst +++ b/fieldservice_maintenance/README.rst @@ -14,13 +14,13 @@ Field Service - Maintenance :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/11.0/fieldservice_maintenance + :target: https://github.com/OCA/field-service/tree/12.0/fieldservice_maintenance :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-11-0/field-service-11-0-fieldservice_maintenance + :target: https://translation.odoo-community.org/projects/field-service-12-0/field-service-12-0-fieldservice_maintenance :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/264/11.0 + :target: https://runbot.odoo-community.org/runbot/264/12.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -45,7 +45,7 @@ To install Field Service and have the mapping features, you need to install fieldservice_stock and maintenance Please refer to the installation instructions available at: -https://github.com/OCA/field-service/tree/11.0/fieldservice_maintenance +https://github.com/OCA/field-service/tree/12.0/fieldservice_maintenance Configuration ============= @@ -79,7 +79,7 @@ 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 smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -95,6 +95,7 @@ Contributors ~~~~~~~~~~~~ * Sandip Mangukiya +* Serpent Consulting Services Pvt. Ltd. Other credits ~~~~~~~~~~~~~ @@ -127,6 +128,6 @@ Current `maintainers `__: |maintainer-smangukiya| |maintainer-max3903| -This module is part of the `OCA/field-service `_ project on GitHub. +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_maintenance/__manifest__.py b/fieldservice_maintenance/__manifest__.py index 8f139c8d67..b9a574cc3a 100644 --- a/fieldservice_maintenance/__manifest__.py +++ b/fieldservice_maintenance/__manifest__.py @@ -4,13 +4,14 @@ { 'name': 'Field Service - Maintenance', 'summary': 'Maintenance', - 'version': '11.0.0.2.0', + 'version': '12.0.1.0.0', 'category': 'Field Service', 'author': 'Open Source Integrators, Odoo Community Association (OCA)', 'website': 'https://github.com/OCA/field-service', 'depends': [ 'fieldservice_stock', 'maintenance', + 'hr', ], 'data': [ 'views/maintenance_view.xml', @@ -23,4 +24,5 @@ 'smangukiya', 'max3903', ], + 'installable': True, } diff --git a/fieldservice_maintenance/models/__init__.py b/fieldservice_maintenance/models/__init__.py index 6f21213b3c..0410718458 100644 --- a/fieldservice_maintenance/models/__init__.py +++ b/fieldservice_maintenance/models/__init__.py @@ -5,5 +5,4 @@ fsm_order, maintenance, fsm_equipment, - stock, ) diff --git a/fieldservice_maintenance/models/fsm_equipment.py b/fieldservice_maintenance/models/fsm_equipment.py index bb757ed8af..9913c57aaf 100644 --- a/fieldservice_maintenance/models/fsm_equipment.py +++ b/fieldservice_maintenance/models/fsm_equipment.py @@ -6,7 +6,6 @@ class FSMEquipment(models.Model): _inherit = 'fsm.equipment' - _inherits = {'maintenance.equipment': 'maintenance_equipment_id'} maintenance_equipment_id = fields.Many2one( 'maintenance.equipment', string='Related Maintenance Equipment', @@ -16,11 +15,10 @@ class FSMEquipment(models.Model): @api.model def create(self, vals): maintenance_equipment_id = self.env['maintenance.equipment'].create({ - 'name': vals['name'], + 'name': vals.get('name'), 'equipment_assign_to': 'other', - 'maintenance_team_id': vals['maintenance_team_id'], 'is_fsm_equipment': True, - 'note': vals['notes'] or False, + 'note': vals.get('notes', False), 'serial_no': vals['lot_id'] and self.env['stock.production.lot'].browse(vals['lot_id']).name @@ -28,5 +26,4 @@ def create(self, vals): if maintenance_equipment_id: vals.update({ 'maintenance_equipment_id': maintenance_equipment_id.id}) - res = super(FSMEquipment, self).create(vals) - return res + return super(FSMEquipment, self).create(vals) diff --git a/fieldservice_maintenance/models/fsm_order.py b/fieldservice_maintenance/models/fsm_order.py index 8cfe9228b5..8d0bb77118 100644 --- a/fieldservice_maintenance/models/fsm_order.py +++ b/fieldservice_maintenance/models/fsm_order.py @@ -1,11 +1,10 @@ # Copyright (C) 2018 - TODAY, Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import api, fields -from odoo.addons.base_geoengine import geo_model +from odoo import api, fields, models -class FSMOrder(geo_model.GeoModel): +class FSMOrder(models.Model): _inherit = 'fsm.order' _description = 'Field Service Order Maintenance' @@ -23,7 +22,7 @@ def create(self, vals): [('user_id', '=', self.env.uid)]) if employee_ids: employee_id = employee_ids[0] - if order.equipment_id: + if order.equipment_id and not order.equipment_id.is_fsm_equipment: equipment = order.equipment_id t = equipment.maintenance_equipment_id and\ equipment.maintenance_equipment_id.maintenance_team_id \ diff --git a/fieldservice_maintenance/models/maintenance.py b/fieldservice_maintenance/models/maintenance.py index 1b16edfb89..e356965fed 100644 --- a/fieldservice_maintenance/models/maintenance.py +++ b/fieldservice_maintenance/models/maintenance.py @@ -23,12 +23,13 @@ def create(self, vals): if request.equipment_id.is_fsm_equipment: # Get the fsm equipment fsm_equipment = self.env['fsm.equipment'].search( - 'maintenance_equipment_id', '=', request.equipment_id) + [('maintenance_equipment_id', '=', request.equipment_id.id)], + limit=1) fsm_order_id = self.env['fsm.order'].create({ 'type': 'maintenance', - 'equipment_id': fsm_equipment and fsm_equipment[0].id or False, + 'equipment_id': fsm_equipment and fsm_equipment.id or False, 'location_id': - fsm_equipment and fsm_equipment[0].current_location_id.id + fsm_equipment and fsm_equipment.current_location_id.id or False }) request.fsm_order_id = fsm_order_id diff --git a/fieldservice_maintenance/models/stock.py b/fieldservice_maintenance/models/stock.py deleted file mode 100644 index b9568497b9..0000000000 --- a/fieldservice_maintenance/models/stock.py +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (C) 2018 - TODAY, Open Source Integrators -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -from odoo import models - - -class StockMove(models.Model): - _inherit = "stock.move" - - def prepare_equipment_values(self, move_line): - res = super(StockMove, self).prepare_equipment_values(move_line) - vals = {'name': '%s (%s)' % (move_line.product_id.name, - move_line.lot_id.name), - 'serial_no': move_line.lot_id.name, - 'is_fsm_equipment': True} - equipment_id = self.env['maintenance.equipment'].create(vals) - res.update({'maintenance_equipment_id': equipment_id.id}) - return res diff --git a/fieldservice_maintenance/readme/CONTRIBUTORS.rst b/fieldservice_maintenance/readme/CONTRIBUTORS.rst index a76235f8a2..373b2a6a28 100644 --- a/fieldservice_maintenance/readme/CONTRIBUTORS.rst +++ b/fieldservice_maintenance/readme/CONTRIBUTORS.rst @@ -1 +1,2 @@ * Sandip Mangukiya +* Serpent Consulting Services Pvt. Ltd. diff --git a/fieldservice_maintenance/readme/INSTALL.rst b/fieldservice_maintenance/readme/INSTALL.rst index 43c27d0602..7fdfc47daf 100644 --- a/fieldservice_maintenance/readme/INSTALL.rst +++ b/fieldservice_maintenance/readme/INSTALL.rst @@ -2,4 +2,4 @@ To install Field Service and have the mapping features, you need to install fieldservice_stock and maintenance Please refer to the installation instructions available at: -https://github.com/OCA/field-service/tree/11.0/fieldservice_maintenance +https://github.com/OCA/field-service/tree/12.0/fieldservice_maintenance diff --git a/fieldservice_maintenance/static/description/index.html b/fieldservice_maintenance/static/description/index.html index f641896644..6cf73d7d6b 100644 --- a/fieldservice_maintenance/static/description/index.html +++ b/fieldservice_maintenance/static/description/index.html @@ -367,7 +367,7 @@

Field Service - Maintenance

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

Odoo Maintenance App does not support Field Service operations for equipments outside the company facilities. On the other hand, the Field Service App does not support a maintenance schedule generating preventive maintenance request.

@@ -396,7 +396,7 @@

Installation

To install Field Service and have the mapping features, you need to install fieldservice_stock and maintenance

Please refer to the installation instructions available at: -https://github.com/OCA/field-service/tree/11.0/fieldservice_maintenance

+https://github.com/OCA/field-service/tree/12.0/fieldservice_maintenance

Configuration

@@ -428,7 +428,7 @@

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 smashing it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -443,6 +443,7 @@

Authors

Contributors

@@ -461,7 +462,7 @@

Maintainers

promote its widespread use.

Current maintainers:

smangukiya max3903

-

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

+

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_maintenance/views/fsm_order_view.xml b/fieldservice_maintenance/views/fsm_order_view.xml index 94642d72d0..2f60c96393 100644 --- a/fieldservice_maintenance/views/fsm_order_view.xml +++ b/fieldservice_maintenance/views/fsm_order_view.xml @@ -1,4 +1,4 @@ - + @@ -11,8 +11,8 @@ + readonly="1" + attrs="{'invisible': [('type', '!=', 'maintenance')]}"/> diff --git a/fieldservice_maintenance/views/maintenance_view.xml b/fieldservice_maintenance/views/maintenance_view.xml index f05f4c592e..fd201f36ca 100644 --- a/fieldservice_maintenance/views/maintenance_view.xml +++ b/fieldservice_maintenance/views/maintenance_view.xml @@ -21,15 +21,17 @@
- + equipment.request.form.fsm maintenance.request - + - + From 772b87ca422a92c841f71019cc49f0d256cf4b8b Mon Sep 17 00:00:00 2001 From: Murtuza Saleh Date: Tue, 30 Apr 2019 16:41:58 +0530 Subject: [PATCH 12/50] [FIX][12.0] Improved code. --- fieldservice_maintenance/models/fsm_order.py | 42 ++++++++----------- .../models/maintenance.py | 17 ++++---- 2 files changed, 26 insertions(+), 33 deletions(-) diff --git a/fieldservice_maintenance/models/fsm_order.py b/fieldservice_maintenance/models/fsm_order.py index 8d0bb77118..b2d8df3c78 100644 --- a/fieldservice_maintenance/models/fsm_order.py +++ b/fieldservice_maintenance/models/fsm_order.py @@ -18,31 +18,23 @@ def create(self, vals): # create maintenance request order = super(FSMOrder, self).create(vals) if order.type == 'maintenance': - employee_ids = self.env['hr.employee'].search( - [('user_id', '=', self.env.uid)]) - if employee_ids: - employee_id = employee_ids[0] - if order.equipment_id and not order.equipment_id.is_fsm_equipment: + employee_rec = self.env['hr.employee'].search( + [('user_id', '=', self.env.uid)], limit=1) + if order.equipment_id and not order.request_id: equipment = order.equipment_id - t = equipment.maintenance_equipment_id and\ - equipment.maintenance_equipment_id.maintenance_team_id \ - and\ - equipment.maintenance_equipment_id.maintenance_team_id.id\ - or False, - request_id = self.env['maintenance.request'].create({ - 'name': order.name or '', - 'employee_id': employee_id.id, - 'equipment_id': - equipment.maintenance_equipment_id - and equipment.maintenance_equipment_id.id or False, - 'category_id': - equipment.category_id and - equipment.category_id.id or False, - 'request_date': fields.Date.context_today(self), - 'maintenance_type': 'corrective', - 'maintenance_team_id': t, - 'schedule_date': order.request_early, - 'description': order.description - }) + team_id = equipment.maintenance_equipment_id and\ + equipment.maintenance_equipment_id.maintenance_team_id.id + request_id = self.env['maintenance.request'].with_context( + fsm_order=True).create({ + 'name': order.name or '', + 'employee_id': employee_rec.id, + 'equipment_id': equipment.maintenance_equipment_id.id, + 'category_id': equipment.category_id.id, + 'request_date': fields.Date.context_today(self), + 'maintenance_type': 'corrective', + 'maintenance_team_id': team_id, + 'schedule_date': order.request_early, + 'description': order.description + }) order.request_id = request_id return order diff --git a/fieldservice_maintenance/models/maintenance.py b/fieldservice_maintenance/models/maintenance.py index e356965fed..2b0c1753ce 100644 --- a/fieldservice_maintenance/models/maintenance.py +++ b/fieldservice_maintenance/models/maintenance.py @@ -20,17 +20,18 @@ def create(self, vals): # create FSM order with type maintenance if selected equipment is # enabled with boolean is_fsm_equipment request = super(MaintenanceRequest, self).create(vals) - if request.equipment_id.is_fsm_equipment: + ctx = dict(self._context) + if request.equipment_id.is_fsm_equipment and "fsm_order" not in ctx: # Get the fsm equipment fsm_equipment = self.env['fsm.equipment'].search( [('maintenance_equipment_id', '=', request.equipment_id.id)], limit=1) - fsm_order_id = self.env['fsm.order'].create({ - 'type': 'maintenance', - 'equipment_id': fsm_equipment and fsm_equipment.id or False, - 'location_id': - fsm_equipment and fsm_equipment.current_location_id.id - or False - }) + fsm_order_id = self.env['fsm.order'].create( + {'type': 'maintenance', + 'equipment_id': fsm_equipment.id, + 'location_id': fsm_equipment and + fsm_equipment.current_location_id.id, + 'request_id': request.id + }) request.fsm_order_id = fsm_order_id return request From 8b35a5ed5711acb980e7a4d3a56446d97b190c7e Mon Sep 17 00:00:00 2001 From: scampbell Date: Thu, 27 Jun 2019 10:33:13 -0700 Subject: [PATCH 13/50] [IMP] Remove Create() Repair/Maintenance --- fieldservice_maintenance/models/fsm_order.py | 27 -------------------- 1 file changed, 27 deletions(-) diff --git a/fieldservice_maintenance/models/fsm_order.py b/fieldservice_maintenance/models/fsm_order.py index b2d8df3c78..e78951e38f 100644 --- a/fieldservice_maintenance/models/fsm_order.py +++ b/fieldservice_maintenance/models/fsm_order.py @@ -11,30 +11,3 @@ class FSMOrder(models.Model): type = fields.Selection(selection_add=[('maintenance', 'Maintenance')]) request_id = fields.Many2one( 'maintenance.request', 'Maintenance Request') - - @api.model - def create(self, vals): - # if FSM order with type maintenance is create then - # create maintenance request - order = super(FSMOrder, self).create(vals) - if order.type == 'maintenance': - employee_rec = self.env['hr.employee'].search( - [('user_id', '=', self.env.uid)], limit=1) - if order.equipment_id and not order.request_id: - equipment = order.equipment_id - team_id = equipment.maintenance_equipment_id and\ - equipment.maintenance_equipment_id.maintenance_team_id.id - request_id = self.env['maintenance.request'].with_context( - fsm_order=True).create({ - 'name': order.name or '', - 'employee_id': employee_rec.id, - 'equipment_id': equipment.maintenance_equipment_id.id, - 'category_id': equipment.category_id.id, - 'request_date': fields.Date.context_today(self), - 'maintenance_type': 'corrective', - 'maintenance_team_id': team_id, - 'schedule_date': order.request_early, - 'description': order.description - }) - order.request_id = request_id - return order From 94f9609b6b2595fdbb4eccef8d1ef477c2fa1bba Mon Sep 17 00:00:00 2001 From: scampbell Date: Thu, 27 Jun 2019 10:40:06 -0700 Subject: [PATCH 14/50] [IMP] Create() Unused --- fieldservice_maintenance/models/fsm_order.py | 27 ++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/fieldservice_maintenance/models/fsm_order.py b/fieldservice_maintenance/models/fsm_order.py index e78951e38f..5eb0ae2c0d 100644 --- a/fieldservice_maintenance/models/fsm_order.py +++ b/fieldservice_maintenance/models/fsm_order.py @@ -11,3 +11,30 @@ class FSMOrder(models.Model): type = fields.Selection(selection_add=[('maintenance', 'Maintenance')]) request_id = fields.Many2one( 'maintenance.request', 'Maintenance Request') + + # @api.model + # def create(self, vals): + # # if FSM order with type maintenance is create then + # # create maintenance request + # order = super(FSMOrder, self).create(vals) + # if order.type == 'maintenance': + # employee_rec = self.env['hr.employee'].search( + # [('user_id', '=', self.env.uid)], limit=1) + # if order.equipment_id and not order.request_id: + # equipment = order.equipment_id + # team_id = equipment.maintenance_equipment_id and\ + # equipment.maintenance_equipment_id.maintenance_team_id.id + # request_id = self.env['maintenance.request'].with_context( + # fsm_order=True).create({ + # 'name': order.name or '', + # 'employee_id': employee_rec.id, + # 'equipment_id': equipment.maintenance_equipment_id.id, + # 'category_id': equipment.category_id.id, + # 'request_date': fields.Date.context_today(self), + # 'maintenance_type': 'corrective', + # 'maintenance_team_id': team_id, + # 'schedule_date': order.request_early, + # 'description': order.description + # }) + # order.request_id = request_id + # return order From 0d869c9146003b32b229f0e573343847b57260f4 Mon Sep 17 00:00:00 2001 From: Maxime Chambreuil Date: Fri, 5 Jul 2019 14:16:06 -0500 Subject: [PATCH 15/50] [FIX] fieldservice_maintenance: formatting --- fieldservice_maintenance/models/fsm_order.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/fieldservice_maintenance/models/fsm_order.py b/fieldservice_maintenance/models/fsm_order.py index 5eb0ae2c0d..e9ff4f4742 100644 --- a/fieldservice_maintenance/models/fsm_order.py +++ b/fieldservice_maintenance/models/fsm_order.py @@ -1,7 +1,8 @@ # Copyright (C) 2018 - TODAY, Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import api, fields, models +from odoo import fields, models +# from odoo import api, fields, models class FSMOrder(models.Model): @@ -9,9 +10,9 @@ class FSMOrder(models.Model): _description = 'Field Service Order Maintenance' type = fields.Selection(selection_add=[('maintenance', 'Maintenance')]) - request_id = fields.Many2one( - 'maintenance.request', 'Maintenance Request') - + request_id = fields.Many2one('maintenance.request', + string='Maintenance Request') + # @api.model # def create(self, vals): # # if FSM order with type maintenance is create then @@ -28,7 +29,8 @@ class FSMOrder(models.Model): # fsm_order=True).create({ # 'name': order.name or '', # 'employee_id': employee_rec.id, - # 'equipment_id': equipment.maintenance_equipment_id.id, + # 'equipment_id': + # equipment.maintenance_equipment_id.id, # 'category_id': equipment.category_id.id, # 'request_date': fields.Date.context_today(self), # 'maintenance_type': 'corrective', From d6b300aaf7255f680ab0908563159f8643e62e06 Mon Sep 17 00:00:00 2001 From: Maxime Chambreuil Date: Wed, 17 Jul 2019 14:07:15 -0500 Subject: [PATCH 16/50] [IMP] fieldservice_maintenance: Remove description --- fieldservice_maintenance/models/fsm_order.py | 1 - fieldservice_maintenance/static/description/index.html | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/fieldservice_maintenance/models/fsm_order.py b/fieldservice_maintenance/models/fsm_order.py index e9ff4f4742..213efa886c 100644 --- a/fieldservice_maintenance/models/fsm_order.py +++ b/fieldservice_maintenance/models/fsm_order.py @@ -7,7 +7,6 @@ class FSMOrder(models.Model): _inherit = 'fsm.order' - _description = 'Field Service Order Maintenance' type = fields.Selection(selection_add=[('maintenance', 'Maintenance')]) request_id = fields.Many2one('maintenance.request', diff --git a/fieldservice_maintenance/static/description/index.html b/fieldservice_maintenance/static/description/index.html index 6cf73d7d6b..83c622b811 100644 --- a/fieldservice_maintenance/static/description/index.html +++ b/fieldservice_maintenance/static/description/index.html @@ -3,7 +3,7 @@ - + Field Service - Maintenance -
-

Field Service - Maintenance

+
+ + +Odoo Community Association + +
+

Field Service - Maintenance

-

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

+

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

Odoo Maintenance App does not support Field Service operations for equipments outside the company facilities. On the other hand, the Field Service App does not support a maintenance schedule generating @@ -395,14 +400,14 @@

Field Service - Maintenance

-

Installation

+

Installation

To install Field Service and have the mapping features, you need to install fieldservice_stock and maintenance

Please refer to the installation instructions available at: https://github.com/OCA/field-service/tree/14.0/fieldservice_maintenance

-

Configuration

+

Configuration

To use this module, you need to:

  • Go to Field Service > Master Data > Equipments or Maintenance > @@ -412,7 +417,7 @@

    Configuration

-

Usage

+

Usage

To use this module, you need to:

  • Maintenance requests related to a FSM equipment will create a FSM @@ -425,12 +430,12 @@

    Usage

-

Known issues / Roadmap

+

Known issues / Roadmap

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

-

Bug Tracker

+

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 @@ -438,15 +443,15 @@

Bug Tracker

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • Open Source Integrators
-

Contributors

+

Contributors

-

Other credits

+

Other credits

The development of this module has been financially supported by:

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association @@ -479,5 +484,6 @@

Maintainers

+
From b87384bfa6833503082f3094e7825eb479464bc6 Mon Sep 17 00:00:00 2001 From: Julio Santa Cruz Date: Tue, 21 Apr 2026 01:51:17 -0300 Subject: [PATCH 49/50] [IMP] fieldservice_maintenance: pre-commit auto fixes --- fieldservice_maintenance/README.rst | 16 +++----- fieldservice_maintenance/__manifest__.py | 2 +- .../data/fsm_order_type.xml | 2 - .../static/description/index.html | 38 ++++++++----------- .../views/fsm_equipment_view.xml | 2 - .../views/fsm_order_view.xml | 1 - .../views/maintenance_equipment_view.xml | 2 - .../views/maintenance_request_view.xml | 2 - 8 files changed, 23 insertions(+), 42 deletions(-) diff --git a/fieldservice_maintenance/README.rst b/fieldservice_maintenance/README.rst index aae6d44a8b..a2f4be10a5 100644 --- a/fieldservice_maintenance/README.rst +++ b/fieldservice_maintenance/README.rst @@ -1,7 +1,3 @@ -.. image:: https://odoo-community.org/readme-banner-image - :target: https://odoo-community.org/get-involved?utm_source=readme - :alt: Odoo Community Association - =========================== Field Service - Maintenance =========================== @@ -17,17 +13,17 @@ Field Service - Maintenance .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png +.. |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/17.0/fieldservice_maintenance + :target: https://github.com/OCA/field-service/tree/18.0/fieldservice_maintenance :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-17-0/field-service-17-0-fieldservice_maintenance + :target: https://translation.odoo-community.org/projects/field-service-18-0/field-service-18-0-fieldservice_maintenance :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=17.0 + :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| @@ -90,7 +86,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -146,6 +142,6 @@ Current `maintainers `__: |maintainer-smangukiya| |maintainer-max3903| |maintainer-bodedra| -This module is part of the `OCA/field-service `_ project on GitHub. +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_maintenance/__manifest__.py b/fieldservice_maintenance/__manifest__.py index e8b44b733a..0672cf88a8 100644 --- a/fieldservice_maintenance/__manifest__.py +++ b/fieldservice_maintenance/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Field Service - Maintenance", "summary": "Integrate Field Service orders with maintenance requests", - "version": "17.0.1.0.0", + "version": "18.0.1.0.0", "category": "Field Service", "author": "Open Source Integrators, Odoo Community Association (OCA)", "website": "https://github.com/OCA/field-service", diff --git a/fieldservice_maintenance/data/fsm_order_type.xml b/fieldservice_maintenance/data/fsm_order_type.xml index d93b5ee45f..9faa39564a 100644 --- a/fieldservice_maintenance/data/fsm_order_type.xml +++ b/fieldservice_maintenance/data/fsm_order_type.xml @@ -1,9 +1,7 @@ - Maintenance maintenance - diff --git a/fieldservice_maintenance/static/description/index.html b/fieldservice_maintenance/static/description/index.html index a25834a492..30d0364901 100644 --- a/fieldservice_maintenance/static/description/index.html +++ b/fieldservice_maintenance/static/description/index.html @@ -3,7 +3,7 @@ -README.rst +Field Service - Maintenance -
+
+

Field Service - Maintenance

- - -Odoo Community Association - -
-

Field Service - Maintenance

-

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

+

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

Odoo Maintenance App does not support Field Service operations for equipments outside the company facilities. On the other hand, the Field Service App does not support a maintenance schedule generating @@ -400,14 +395,14 @@

Field Service - Maintenance

-

Installation

+

Installation

To install Field Service and have the mapping features, you need to install fieldservice_stock and maintenance

Please refer to the installation instructions available at: https://github.com/OCA/field-service/tree/14.0/fieldservice_maintenance

-

Configuration

+

Configuration

To use this module, you need to:

  • Go to Field Service > Master Data > Equipments or Maintenance > @@ -417,7 +412,7 @@

    Configuration

-

Usage

+

Usage

To use this module, you need to:

  • Maintenance requests related to a FSM equipment will create a FSM @@ -430,28 +425,28 @@

    Usage

-

Known issues / Roadmap

+

Known issues / Roadmap

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

-

Bug Tracker

+

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.

+feedback.

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • Open Source Integrators
-

Contributors

+

Contributors

-

Other credits

+

Other credits

The development of this module has been financially supported by:

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association @@ -479,11 +474,10 @@

Maintainers

promote its widespread use.

Current maintainers:

smangukiya max3903 bodedra

-

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

+

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_maintenance/views/fsm_equipment_view.xml b/fieldservice_maintenance/views/fsm_equipment_view.xml index d81a752404..e5b85c70f1 100644 --- a/fieldservice_maintenance/views/fsm_equipment_view.xml +++ b/fieldservice_maintenance/views/fsm_equipment_view.xml @@ -1,6 +1,5 @@ - fsm.equipment.form.maintenance @@ -27,5 +26,4 @@
- diff --git a/fieldservice_maintenance/views/fsm_order_view.xml b/fieldservice_maintenance/views/fsm_order_view.xml index 45e81f7abd..d9b49bdf9b 100644 --- a/fieldservice_maintenance/views/fsm_order_view.xml +++ b/fieldservice_maintenance/views/fsm_order_view.xml @@ -19,5 +19,4 @@
- diff --git a/fieldservice_maintenance/views/maintenance_equipment_view.xml b/fieldservice_maintenance/views/maintenance_equipment_view.xml index 0c58c95de7..edb70a2c41 100644 --- a/fieldservice_maintenance/views/maintenance_equipment_view.xml +++ b/fieldservice_maintenance/views/maintenance_equipment_view.xml @@ -1,5 +1,4 @@ - equipment.form.fsm @@ -20,5 +19,4 @@ - diff --git a/fieldservice_maintenance/views/maintenance_request_view.xml b/fieldservice_maintenance/views/maintenance_request_view.xml index 0f2dfa1b74..947bb843a8 100644 --- a/fieldservice_maintenance/views/maintenance_request_view.xml +++ b/fieldservice_maintenance/views/maintenance_request_view.xml @@ -1,5 +1,4 @@ - equipment.request.form.fsm @@ -11,5 +10,4 @@ - From ecc99e8b8261ced497f22e501fd362093a811510 Mon Sep 17 00:00:00 2001 From: Julio Santa Cruz Date: Tue, 21 Apr 2026 02:08:34 -0300 Subject: [PATCH 50/50] [MIG] fieldservice_maintenance: Migration to 18.0 --- fieldservice_maintenance/models/fsm_order.py | 45 +++++------ .../models/maintenance_request.py | 81 ++++++++++--------- .../tests/test_fsm_maintenance.py | 25 +++--- .../views/fsm_equipment_view.xml | 4 +- .../views/fsm_order_view.xml | 4 +- .../views/maintenance_equipment_view.xml | 1 + .../views/maintenance_request_view.xml | 1 + 7 files changed, 87 insertions(+), 74 deletions(-) diff --git a/fieldservice_maintenance/models/fsm_order.py b/fieldservice_maintenance/models/fsm_order.py index d2de0d99e8..7367f091d7 100644 --- a/fieldservice_maintenance/models/fsm_order.py +++ b/fieldservice_maintenance/models/fsm_order.py @@ -7,28 +7,29 @@ class FSMOrder(models.Model): _inherit = "fsm.order" - request_id = fields.Many2one("maintenance.request", string="Maintenance Request") + request_ids = fields.One2many( + "maintenance.request", "fsm_order_id", string="Maintenance Request" + ) - @api.model - def create(self, vals): - # if FSM order with type maintenance is create then - # create maintenance request - order = super().create(vals) - if order.type.internal_type == "maintenance": - if order.equipment_id and not order.request_id: - equipment = order.equipment_id - maintenance_equipment_id = equipment.maintenance_equipment_id - if maintenance_equipment_id: - team_id = maintenance_equipment_id.maintenance_team_id.id - request_id = ( - self.env["maintenance.request"] - .with_context(fsm_order=True) - .create( + @api.model_create_multi + def create(self, vals_list): + orders = super().create(vals_list) + for order in orders: + # if FSM order with type maintenance is created then + # create maintenance requests for every equipment in the order + if order.type.internal_type == "maintenance": + for equipment in order.equipment_ids: + maint_equip = equipment.maintenance_equipment_id + if maint_equip: + team_id = maint_equip.maintenance_team_id.id + self.env["maintenance.request"].with_context( + fsm_order=True + ).create( { - "name": order.name or "", - "equipment_id": maintenance_equipment_id.id, - "category_id": equipment.category_id.id, - "request_date": fields.Date.context_today(self), + "name": f"{order.name} - {maint_equip.name}", + "equipment_id": maint_equip.id, + "category_id": maint_equip.category_id.id, + "request_date": fields.Date.context_today(order), "maintenance_type": "corrective", "maintenance_team_id": team_id, "schedule_date": order.request_early, @@ -36,6 +37,4 @@ def create(self, vals): "fsm_order_id": order.id, } ) - ) - order.request_id = request_id - return order + return orders diff --git a/fieldservice_maintenance/models/maintenance_request.py b/fieldservice_maintenance/models/maintenance_request.py index a18a0771f1..a23eeb40b5 100644 --- a/fieldservice_maintenance/models/maintenance_request.py +++ b/fieldservice_maintenance/models/maintenance_request.py @@ -1,7 +1,7 @@ # Copyright (C) 2018 Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import _, api, fields, models +from odoo import Command, _, api, fields, models class MaintenanceRequest(models.Model): @@ -9,43 +9,50 @@ class MaintenanceRequest(models.Model): fsm_order_id = fields.Many2one("fsm.order", "Field Service Order") - @api.model - def create(self, vals): + @api.model_create_multi + def create(self, vals_list): # create FSM order with type maintenance if selected equipment is # enabled with boolean is_fsm_equipment - request = super().create(vals) - ctx = dict(self._context) - if request.equipment_id.is_fsm_equipment and "fsm_order" not in ctx: - # Get the fsm equipment - fsm_equipment = self.env["fsm.equipment"].search( - [("maintenance_equipment_id", "=", request.equipment_id.id)], limit=1 - ) - fsm_order_type = self.env["fsm.order.type"].search( - [("internal_type", "=", "maintenance")], order="id desc", limit=1 - ) - if not fsm_equipment.current_location_id.id: - odoobot = self.env.ref("base.partner_root") - request._message_log( - subject="Missing location", - body=_( - "Order was not created because the " - "equipment's location is not set" - ), - message_type="notification", - author_id=odoobot.id, + requests = super().create(vals_list) + for request in requests: + if request.equipment_id.is_fsm_equipment and not self._context.get( + "fsm_order" + ): + # Get the fsm equipment + fsm_equipment = self.env["fsm.equipment"].search( + [("maintenance_equipment_id", "=", request.equipment_id.id)], + limit=1, ) - else: - fsm_order_id = self.env["fsm.order"].create( - { - "type": fsm_order_type.id, - "equipment_id": fsm_equipment.id, - "location_id": fsm_equipment.current_location_id.id, - "request_id": request.id, - "description": request.description, - "request_early": request.schedule_date, - "scheduled_date_start": request.schedule_date, - "priority": request.priority, - } + fsm_order_type = self.env["fsm.order.type"].search( + [("internal_type", "=", "maintenance")], order="id desc", limit=1 ) - request.fsm_order_id = fsm_order_id - return request + if not fsm_equipment.current_location_id.id: + odoobot = self.env.ref("base.partner_root") + request._message_log( + subject=_("Missing location"), + body=_( + "Order was not created because the " + "equipment's location is not set" + ), + message_type="notification", + author_id=odoobot.id, + ) + else: + fsm_order_id = ( + self.env["fsm.order"] + .with_context(fsm_order=True) + .create( + { + "type": fsm_order_type.id, + "equipment_ids": [Command.set([fsm_equipment.id])], + "location_id": fsm_equipment.current_location_id.id, + "request_ids": [Command.set([request.id])], + "description": request.description, + "request_early": request.schedule_date, + "scheduled_date_start": request.schedule_date, + "priority": request.priority, + } + ) + ) + request.fsm_order_id = fsm_order_id + return requests diff --git a/fieldservice_maintenance/tests/test_fsm_maintenance.py b/fieldservice_maintenance/tests/test_fsm_maintenance.py index dc4fa0da79..0f51310675 100644 --- a/fieldservice_maintenance/tests/test_fsm_maintenance.py +++ b/fieldservice_maintenance/tests/test_fsm_maintenance.py @@ -1,6 +1,7 @@ # Copyright (C) 2020, Brian McMaster # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import Command from odoo.tests.common import TransactionCase @@ -36,19 +37,21 @@ def test_fsm_maintenance(self): "type": self.env.ref( "fieldservice_maintenance.fsm_order_type_maintenance" ).id, - "equipment_id": fsm_equip_01.id, + "equipment_ids": [Command.set([fsm_equip_01.id])], } ) # Verify Maintenance order was created for that equipment maint_req_01 = self.env["maintenance.request"].search( [("fsm_order_id", "=", fsm_order_01.id)] ) - self.assertEqual(maint_req_01.name, fsm_order_01.name) + self.assertEqual( + maint_req_01.name, f"{fsm_order_01.name} - {fsm_equip_01.name}" + ) self.assertEqual( maint_req_01.equipment_id, - fsm_order_01.equipment_id.maintenance_equipment_id, + fsm_order_01.equipment_ids.maintenance_equipment_id, ) - self.assertEqual(fsm_order_01.request_id, maint_req_01) + self.assertEqual(fsm_order_01.request_ids, maint_req_01) # Create a maintenance request for an FSM equipment. This should # create FSM order for that equipment. @@ -60,11 +63,11 @@ def test_fsm_maintenance(self): ) # Test order was created for the request fsm_order_02 = self.env["fsm.order"].search( - [("request_id", "=", maint_req_02.id)] + [("request_ids", "in", maint_req_02.ids)] ) self.assertEqual(fsm_order_02.description, maint_req_02.description) self.assertEqual( - fsm_order_02.equipment_id.maintenance_equipment_id, + fsm_order_02.equipment_ids.maintenance_equipment_id, maint_req_02.equipment_id, ) self.assertEqual(maint_req_02.fsm_order_id, fsm_order_02) @@ -72,10 +75,12 @@ def test_fsm_maintenance(self): # Create a maintenance request when fsm_equipment's location is not set fsm_equip_01.current_location_id = False request = self.env["maintenance.request"].create( - { - "name": "Equip 01 Request", - "equipment_id": maint_equip_01.id, - } + [ + { + "name": "Equip 01 Request", + "equipment_id": maint_equip_01.id, + } + ] ) # and check that a notification regarding its missing value # is shown to the user diff --git a/fieldservice_maintenance/views/fsm_equipment_view.xml b/fieldservice_maintenance/views/fsm_equipment_view.xml index e5b85c70f1..2fab40ec17 100644 --- a/fieldservice_maintenance/views/fsm_equipment_view.xml +++ b/fieldservice_maintenance/views/fsm_equipment_view.xml @@ -16,10 +16,10 @@ - + fsm.equipment.model fsm.equipment - + diff --git a/fieldservice_maintenance/views/fsm_order_view.xml b/fieldservice_maintenance/views/fsm_order_view.xml index d9b49bdf9b..c216a7c4bc 100644 --- a/fieldservice_maintenance/views/fsm_order_view.xml +++ b/fieldservice_maintenance/views/fsm_order_view.xml @@ -10,11 +10,11 @@ - diff --git a/fieldservice_maintenance/views/maintenance_equipment_view.xml b/fieldservice_maintenance/views/maintenance_equipment_view.xml index edb70a2c41..820aaf2494 100644 --- a/fieldservice_maintenance/views/maintenance_equipment_view.xml +++ b/fieldservice_maintenance/views/maintenance_equipment_view.xml @@ -1,3 +1,4 @@ + diff --git a/fieldservice_maintenance/views/maintenance_request_view.xml b/fieldservice_maintenance/views/maintenance_request_view.xml index 947bb843a8..85a25e3fa8 100644 --- a/fieldservice_maintenance/views/maintenance_request_view.xml +++ b/fieldservice_maintenance/views/maintenance_request_view.xml @@ -1,3 +1,4 @@ +