From b1b0aad8fdbb16dcdd4f6facbd2b6da32508fe4d Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 6 Oct 2020 12:32:24 -0700 Subject: [PATCH] [MIG] fieldservice_stock: Migration to 13.0 --- fieldservice_stock/__manifest__.py | 8 ++++---- fieldservice_stock/i18n/de.po | 4 ++-- fieldservice_stock/i18n/es.po | 4 ++-- fieldservice_stock/i18n/es_CL.po | 4 ++-- fieldservice_stock/i18n/fieldservice_stock.pot | 4 ++-- fieldservice_stock/i18n/pt_BR.po | 4 ++-- .../migrations/12.0.2.0.0/post-migration.py | 15 --------------- fieldservice_stock/models/__init__.py | 14 +++++++------- fieldservice_stock/models/fsm_equipment.py | 2 -- fieldservice_stock/models/fsm_order.py | 5 ----- .../{fsm_territory.py => res_territory.py} | 4 ++-- fieldservice_stock/models/stock_move.py | 4 ++-- fieldservice_stock/models/stock_request.py | 5 +++-- fieldservice_stock/models/stock_request_order.py | 1 - fieldservice_stock/models/stock_rule.py | 4 ++-- fieldservice_stock/readme/CONTRIBUTORS.rst | 1 + fieldservice_stock/readme/INSTALL.rst | 2 +- .../{fsm_territory.xml => res_territory.xml} | 16 ++++++++-------- fieldservice_stock/views/stock.xml | 2 +- 19 files changed, 41 insertions(+), 62 deletions(-) delete mode 100644 fieldservice_stock/migrations/12.0.2.0.0/post-migration.py rename fieldservice_stock/models/{fsm_territory.py => res_territory.py} (77%) rename fieldservice_stock/views/{fsm_territory.xml => res_territory.xml} (56%) diff --git a/fieldservice_stock/__manifest__.py b/fieldservice_stock/__manifest__.py index df0a3a0527..f1559821ce 100644 --- a/fieldservice_stock/__manifest__.py +++ b/fieldservice_stock/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Field Service - Stock", "summary": "Integrate the logistics operations with Field Service", - "version": "12.0.2.2.0", + "version": "13.0.1.0.0", "category": "Field Service", "author": "Open Source Integrators, " "Brian McMaster, " @@ -18,12 +18,12 @@ "data": [ "security/ir.model.access.csv", "data/fsm_stock_data.xml", - "views/fsm_territory.xml", + "views/fsm_equipment.xml", "views/fsm_location.xml", "views/fsm_order.xml", - "views/stock.xml", - "views/fsm_equipment.xml", "views/product_template.xml", + "views/res_territory.xml", + "views/stock.xml", "views/stock_picking_type.xml", "views/stock_production_lot.xml", "views/stock_request.xml", diff --git a/fieldservice_stock/i18n/de.po b/fieldservice_stock/i18n/de.po index 488f9fa190..4f311a6c6b 100644 --- a/fieldservice_stock/i18n/de.po +++ b/fieldservice_stock/i18n/de.po @@ -267,7 +267,7 @@ msgid "Submitted" msgstr "" #. module: fieldservice_stock -#: model:ir.model,name:fieldservice_stock.model_fsm_territory +#: model:ir.model,name:fieldservice_stock.model_res_territory msgid "Territory" msgstr "" @@ -298,7 +298,7 @@ msgstr "" #. module: fieldservice_stock #: model:ir.model.fields,field_description:fieldservice_stock.field_fsm_order__warehouse_id -#: model:ir.model.fields,field_description:fieldservice_stock.field_fsm_territory__warehouse_id +#: model:ir.model.fields,field_description:fieldservice_stock.field_res_territory__warehouse_id msgid "Warehouse" msgstr "" diff --git a/fieldservice_stock/i18n/es.po b/fieldservice_stock/i18n/es.po index f6c4c41b72..fa4adc8460 100644 --- a/fieldservice_stock/i18n/es.po +++ b/fieldservice_stock/i18n/es.po @@ -269,7 +269,7 @@ msgid "Submitted" msgstr "Enviado" #. module: fieldservice_stock -#: model:ir.model,name:fieldservice_stock.model_fsm_territory +#: model:ir.model,name:fieldservice_stock.model_res_territory msgid "Territory" msgstr "Territorio" @@ -300,7 +300,7 @@ msgstr "Unidad de Medida" #. module: fieldservice_stock #: model:ir.model.fields,field_description:fieldservice_stock.field_fsm_order__warehouse_id -#: model:ir.model.fields,field_description:fieldservice_stock.field_fsm_territory__warehouse_id +#: model:ir.model.fields,field_description:fieldservice_stock.field_res_territory__warehouse_id msgid "Warehouse" msgstr "Almacén" diff --git a/fieldservice_stock/i18n/es_CL.po b/fieldservice_stock/i18n/es_CL.po index e257545b7e..c915f28374 100644 --- a/fieldservice_stock/i18n/es_CL.po +++ b/fieldservice_stock/i18n/es_CL.po @@ -269,7 +269,7 @@ msgid "Submitted" msgstr "Enviado" #. module: fieldservice_stock -#: model:ir.model,name:fieldservice_stock.model_fsm_territory +#: model:ir.model,name:fieldservice_stock.model_res_territory msgid "Territory" msgstr "Territorio" @@ -300,7 +300,7 @@ msgstr "Unidad de Medida" #. module: fieldservice_stock #: model:ir.model.fields,field_description:fieldservice_stock.field_fsm_order__warehouse_id -#: model:ir.model.fields,field_description:fieldservice_stock.field_fsm_territory__warehouse_id +#: model:ir.model.fields,field_description:fieldservice_stock.field_res_territory__warehouse_id msgid "Warehouse" msgstr "Almacén" diff --git a/fieldservice_stock/i18n/fieldservice_stock.pot b/fieldservice_stock/i18n/fieldservice_stock.pot index ec33be8660..d8d1479c10 100644 --- a/fieldservice_stock/i18n/fieldservice_stock.pot +++ b/fieldservice_stock/i18n/fieldservice_stock.pot @@ -262,7 +262,7 @@ msgid "Submitted" msgstr "" #. module: fieldservice_stock -#: model:ir.model,name:fieldservice_stock.model_fsm_territory +#: model:ir.model,name:fieldservice_stock.model_res_territory msgid "Territory" msgstr "" @@ -289,7 +289,7 @@ msgstr "" #. module: fieldservice_stock #: model:ir.model.fields,field_description:fieldservice_stock.field_fsm_order__warehouse_id -#: model:ir.model.fields,field_description:fieldservice_stock.field_fsm_territory__warehouse_id +#: model:ir.model.fields,field_description:fieldservice_stock.field_res_territory__warehouse_id msgid "Warehouse" msgstr "" diff --git a/fieldservice_stock/i18n/pt_BR.po b/fieldservice_stock/i18n/pt_BR.po index dab7400c54..f3e2d0b8ba 100644 --- a/fieldservice_stock/i18n/pt_BR.po +++ b/fieldservice_stock/i18n/pt_BR.po @@ -267,7 +267,7 @@ msgid "Submitted" msgstr "Submetido" #. module: fieldservice_stock -#: model:ir.model,name:fieldservice_stock.model_fsm_territory +#: model:ir.model,name:fieldservice_stock.model_res_territory msgid "Territory" msgstr "Território" @@ -297,7 +297,7 @@ msgstr "Unidade de Medida (UoM)" #. module: fieldservice_stock #: model:ir.model.fields,field_description:fieldservice_stock.field_fsm_order__warehouse_id -#: model:ir.model.fields,field_description:fieldservice_stock.field_fsm_territory__warehouse_id +#: model:ir.model.fields,field_description:fieldservice_stock.field_res_territory__warehouse_id msgid "Warehouse" msgstr "Armazém" diff --git a/fieldservice_stock/migrations/12.0.2.0.0/post-migration.py b/fieldservice_stock/migrations/12.0.2.0.0/post-migration.py deleted file mode 100644 index c3221ab722..0000000000 --- a/fieldservice_stock/migrations/12.0.2.0.0/post-migration.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (C) 2020, Open Source Integrators -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - - -def migrate(env, version): - if not version: - return - - env.execute( - """ - UPDATE stock_picking_type - SET create_fsm_equipment = 'true' - WHERE code = 'outgoing'; - """ - ) diff --git a/fieldservice_stock/models/__init__.py b/fieldservice_stock/models/__init__.py index 9eb61a602c..2e6d35cd10 100644 --- a/fieldservice_stock/models/__init__.py +++ b/fieldservice_stock/models/__init__.py @@ -2,19 +2,19 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import ( - fsm_territory, + fsm_equipment, fsm_location, fsm_order, - stock_move_line, - stock_move, + fsm_wizard, procurement_group, - stock_rule, + product_template, + res_territory, + stock_move, + stock_move_line, stock_picking, stock_picking_type, - fsm_equipment, - product_template, stock_production_lot, - fsm_wizard, stock_request, stock_request_order, + stock_rule, ) diff --git a/fieldservice_stock/models/fsm_equipment.py b/fieldservice_stock/models/fsm_equipment.py index d7b51014d2..a7ce456ce5 100644 --- a/fieldservice_stock/models/fsm_equipment.py +++ b/fieldservice_stock/models/fsm_equipment.py @@ -15,7 +15,6 @@ class FSMEquipment(models.Model): compute="_compute_current_stock_loc_id", ) - @api.multi def _compute_current_stock_loc_id(self): for equipment in self: quants = self.env["stock.quant"].search( @@ -33,7 +32,6 @@ def create(self, vals): res.lot_id.fsm_equipment_id = res.id return res - @api.multi def write(self, vals): for equipment in self: prev_lot = equipment.lot_id diff --git a/fieldservice_stock/models/fsm_order.py b/fieldservice_stock/models/fsm_order.py index f36401c8a1..2af3d497e7 100644 --- a/fieldservice_stock/models/fsm_order.py +++ b/fieldservice_stock/models/fsm_order.py @@ -63,7 +63,6 @@ def _get_move_domain(self): "stock.move", "fsm_order_id", string="Operations", domain=_get_move_domain ) - @api.multi def action_request_submit(self): for rec in self: if not rec.stock_request_ids: @@ -76,7 +75,6 @@ def action_request_submit(self): line.action_submit() rec.request_stage = "submitted" - @api.multi def action_request_cancel(self): for rec in self: if not rec.stock_request_ids: @@ -89,7 +87,6 @@ def action_request_cancel(self): line.action_cancel() rec.request_stage = "cancel" - @api.multi def action_request_draft(self): for rec in self: if not rec.stock_request_ids: @@ -120,7 +117,6 @@ def _compute_picking_ids(self): ] ) - @api.multi def action_view_delivery(self): """ This function returns an action that display existing delivery orders @@ -141,7 +137,6 @@ def action_view_delivery(self): action["res_id"] = delivery_ids[0] return action - @api.multi def action_view_returns(self): """ This function returns an action that display existing return orders diff --git a/fieldservice_stock/models/fsm_territory.py b/fieldservice_stock/models/res_territory.py similarity index 77% rename from fieldservice_stock/models/fsm_territory.py rename to fieldservice_stock/models/res_territory.py index bdff957024..e231fca4e9 100644 --- a/fieldservice_stock/models/fsm_territory.py +++ b/fieldservice_stock/models/res_territory.py @@ -3,7 +3,7 @@ from odoo import fields, models -class FSMTerritory(models.Model): - _inherit = "fsm.territory" +class ResTerritory(models.Model): + _inherit = "res.territory" warehouse_id = fields.Many2one("stock.warehouse", string="Warehouse") diff --git a/fieldservice_stock/models/stock_move.py b/fieldservice_stock/models/stock_move.py index 22fb6cecd1..9c6f639abb 100644 --- a/fieldservice_stock/models/stock_move.py +++ b/fieldservice_stock/models/stock_move.py @@ -18,8 +18,8 @@ def prepare_equipment_values(self, move_line): "current_stock_location_id": move_line.location_dest_id.id, } - def _action_done(self): - res = super()._action_done() + def _action_done(self, cancel_backorder=False): + res = super()._action_done(cancel_backorder) for rec in self: if ( rec.state == "done" diff --git a/fieldservice_stock/models/stock_request.py b/fieldservice_stock/models/stock_request.py index b62d9f63b1..ad556626a5 100644 --- a/fieldservice_stock/models/stock_request.py +++ b/fieldservice_stock/models/stock_request.py @@ -45,7 +45,9 @@ def create(self, vals): picking_type_id = self.env["stock.picking.type"].search( [ ("code", "=", "stock_request_order"), - ("warehouse_id", "=", vals["warehouse_id"]), + '|', + ("warehouse_id", "=", vals["warehouse_id"]), + ("warehouse_id" ,'=', False), ], limit=1, ) @@ -107,7 +109,6 @@ def _prepare_procurement_group_values(self): else: return {} - @api.multi def _action_confirm(self): for req in self: if (not req.procurement_group_id) and req.fsm_order_id: diff --git a/fieldservice_stock/models/stock_request_order.py b/fieldservice_stock/models/stock_request_order.py index 5d662d287a..53d26bcd75 100644 --- a/fieldservice_stock/models/stock_request_order.py +++ b/fieldservice_stock/models/stock_request_order.py @@ -38,7 +38,6 @@ def _prepare_procurement_group_values(self): else: return {} - @api.multi def action_confirm(self): if self.fsm_order_id: fsm_order = self.env["fsm.order"].browse(self.fsm_order_id.id) diff --git a/fieldservice_stock/models/stock_rule.py b/fieldservice_stock/models/stock_rule.py index 84dde2f114..3ae73200cf 100644 --- a/fieldservice_stock/models/stock_rule.py +++ b/fieldservice_stock/models/stock_rule.py @@ -14,8 +14,8 @@ def _get_stock_move_values( location_id, name, origin, + company_id, values, - group_id, ): vals = super()._get_stock_move_values( product_id, @@ -24,8 +24,8 @@ def _get_stock_move_values( location_id, name, origin, + company_id, values, - group_id, ) vals.update({"fsm_order_id": values.get("fsm_order_id")}) return vals diff --git a/fieldservice_stock/readme/CONTRIBUTORS.rst b/fieldservice_stock/readme/CONTRIBUTORS.rst index 61e9fc4dc3..96e7498372 100644 --- a/fieldservice_stock/readme/CONTRIBUTORS.rst +++ b/fieldservice_stock/readme/CONTRIBUTORS.rst @@ -1,3 +1,4 @@ * Brian McMaster * Sandip Mangukiya * Serpent Consulting Services Pvt. Ltd. +* Raphael Lee diff --git a/fieldservice_stock/readme/INSTALL.rst b/fieldservice_stock/readme/INSTALL.rst index c010f8f6a2..e5355c4b0f 100644 --- a/fieldservice_stock/readme/INSTALL.rst +++ b/fieldservice_stock/readme/INSTALL.rst @@ -1,4 +1,4 @@ To install Field Service and have the mapping features, you need to install GeoEngine. Please refer to the installation instructions available at: -https://github.com/OCA/geospatial/tree/11.0/base_geoengine +https://github.com/OCA/geospatial/tree/13.0/base_geoengine diff --git a/fieldservice_stock/views/fsm_territory.xml b/fieldservice_stock/views/res_territory.xml similarity index 56% rename from fieldservice_stock/views/fsm_territory.xml rename to fieldservice_stock/views/res_territory.xml index 810c48c970..62d19ef241 100644 --- a/fieldservice_stock/views/fsm_territory.xml +++ b/fieldservice_stock/views/res_territory.xml @@ -1,9 +1,9 @@ - - fsm.territory.warehouse.tree - fsm.territory - + + res.territory.warehouse.tree + res.territory + - - fsm.territory.warehouse.form - fsm.territory - + + res.territory.warehouse.form + res.territory +