From 4abaffc7b42d52ac7d33c47ae62bca288a356139 Mon Sep 17 00:00:00 2001 From: brian10048 Date: Sat, 21 Nov 2020 12:25:05 -0500 Subject: [PATCH 01/54] [IMP] fieldservice_stock: Split stock request --- fieldservice_stock_request/README.rst | 169 ++++++++++++++++++ fieldservice_stock_request/__init__.py | 4 + fieldservice_stock_request/__manifest__.py | 33 ++++ fieldservice_stock_request/models/__init__.py | 6 + .../models/fsm_order.py | 63 +++++++ .../models/stock_move_line.py | 24 +++ .../models/stock_request.py | 115 ++++++++++++ .../models/stock_request_order.py | 54 ++++++ .../readme/CONFIGURE.rst | 18 ++ .../readme/CONTRIBUTORS.rst | 3 + fieldservice_stock_request/readme/CREDITS.rst | 3 + .../readme/DESCRIPTION.rst | 2 + fieldservice_stock_request/readme/ROADMAP.rst | 2 + fieldservice_stock_request/readme/USAGE.rst | 7 + .../security/ir.model.access.csv | 7 + .../views/fsm_order.xml | 53 ++++++ fieldservice_stock_request/views/stock.xml | 10 ++ .../views/stock_request.xml | 23 +++ .../views/stock_request_order.xml | 53 ++++++ 19 files changed, 649 insertions(+) create mode 100644 fieldservice_stock_request/README.rst create mode 100644 fieldservice_stock_request/__init__.py create mode 100644 fieldservice_stock_request/__manifest__.py create mode 100644 fieldservice_stock_request/models/__init__.py create mode 100644 fieldservice_stock_request/models/fsm_order.py create mode 100644 fieldservice_stock_request/models/stock_move_line.py create mode 100644 fieldservice_stock_request/models/stock_request.py create mode 100644 fieldservice_stock_request/models/stock_request_order.py create mode 100644 fieldservice_stock_request/readme/CONFIGURE.rst create mode 100644 fieldservice_stock_request/readme/CONTRIBUTORS.rst create mode 100644 fieldservice_stock_request/readme/CREDITS.rst create mode 100644 fieldservice_stock_request/readme/DESCRIPTION.rst create mode 100644 fieldservice_stock_request/readme/ROADMAP.rst create mode 100644 fieldservice_stock_request/readme/USAGE.rst create mode 100644 fieldservice_stock_request/security/ir.model.access.csv create mode 100644 fieldservice_stock_request/views/fsm_order.xml create mode 100644 fieldservice_stock_request/views/stock.xml create mode 100644 fieldservice_stock_request/views/stock_request.xml create mode 100644 fieldservice_stock_request/views/stock_request_order.xml diff --git a/fieldservice_stock_request/README.rst b/fieldservice_stock_request/README.rst new file mode 100644 index 0000000000..ffcd027253 --- /dev/null +++ b/fieldservice_stock_request/README.rst @@ -0,0 +1,169 @@ +============================= +Field Service - Stock Request +============================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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/12.0/fieldservice_stock + :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-12-0/field-service-12-0-fieldservice_stock + :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/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module is an add-on for the Field Service application in Odoo. +It provides inventory and stock operations. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To configure this module, you need to: + +* Go to Field Service > Master Data > Locations +* Create or select a location and set the inventory location +* Go to Inventory > Configuration > Routes +* Select the routes that you want to use from a FSM order +* Check the box 'FSM Order Line' for outbound transfer +* Check the box 'FSM Return Line' for inbound transfer + +The route 'Receipt in 1 step' has no procurement rule so if you want items to be +returned from the service location to your warehouse, you need to create a new +procurement rule for that route: + +* Name: YourCompany: Return +* Action: Move From Another Location +* Procurement Location: WH/Stock +* Served Warehouse: YourCompany +* Source Location: Partner Locations/Customers +* Move Supply Method: Take From Stock +* Operation Type: YourCompany: Receipts + +If you are in a multi-warehouse situation: + +* Go to Field Service > Configuration > Territories +* Create or select a territory +* Set the warehouse that will serve this territory + +Products can be automatically converted into FSM Equipments. +This is only available only for products tracked by serial number. +This needs to be enabled both on Operation Types and Products. +For example, we may want to create the FSM Equipment on Delivery, +or on Receipts. + +To enable on Products: + +* Go to Inventory > Master Data > Products +* Open the Product form, Inventory tab +* On the "Traceability" section, make sure + "Tracking" is set to "By Unique Serial Number" +* Enable the "Creates FSM Equipment" checkbox + +To enable on Operation Types: + +* Go to Inventory > Configuration > Operation Types +* Select the intended Operation Type ("Receipts" for example) +* On the "Traceability" section, enable the + "Create FSM Equipment" checkbox + +Usage +===== + +To use this module, you need to: + +* Create a new service order +* Under the Inventory tab, select the warehouse and add products with quantity +* Confirm the order to create the delivery orders +* Validate the transfers in the Inventory app. Quantities delivered on FSM + Order Line will be updated. + +Known issues / Roadmap +====================== + +The roadmap of the Field Service application is documented on +`Github `_. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us 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 +* Brian McMaster + +Contributors +~~~~~~~~~~~~ + +* Brian McMaster +* Sandip Mangukiya +* Serpent Consulting Services Pvt. Ltd. + +Other credits +~~~~~~~~~~~~~ + +The development of this module has been financially supported by: + +* Open Source Integrators + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +.. |maintainer-brian10048| image:: https://github.com/brian10048.png?size=40px + :target: https://github.com/brian10048 + :alt: brian10048 +.. |maintainer-wolfhall| image:: https://github.com/wolfhall.png?size=40px + :target: https://github.com/wolfhall + :alt: wolfhall +.. |maintainer-max3903| image:: https://github.com/max3903.png?size=40px + :target: https://github.com/max3903 + :alt: max3903 +.. |maintainer-smangukiya| image:: https://github.com/smangukiya.png?size=40px + :target: https://github.com/smangukiya + :alt: smangukiya + +Current `maintainers `__: + +|maintainer-brian10048| |maintainer-wolfhall| |maintainer-max3903| |maintainer-smangukiya| + +This module is part of the `OCA/field-service `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/fieldservice_stock_request/__init__.py b/fieldservice_stock_request/__init__.py new file mode 100644 index 0000000000..da2feecfe9 --- /dev/null +++ b/fieldservice_stock_request/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2018 - TODAY, Brian McMaster +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/fieldservice_stock_request/__manifest__.py b/fieldservice_stock_request/__manifest__.py new file mode 100644 index 0000000000..55493642d5 --- /dev/null +++ b/fieldservice_stock_request/__manifest__.py @@ -0,0 +1,33 @@ +# Copyright (C) 2018 - TODAY, Brian McMaster +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': 'Field Service - Stock Request', + 'summary': 'Integrate Stock Requests with Field Service Orders', + 'version': '12.0.1.0.0', + 'category': 'Field Service', + 'author': "Open Source Integrators, " + "Brian McMaster, " + "Odoo Community Association (OCA)", + 'website': 'https://github.com/OCA/field-service', + 'depends': [ + 'fieldservice_stock', + 'stock_request_direction', + 'stock_request_picking_type', + ], + 'data': [ + 'security/ir.model.access.csv', + 'views/fsm_order.xml', + 'views/stock.xml', + 'views/stock_request.xml', + 'views/stock_request_order.xml', + ], + 'license': 'AGPL-3', + 'development_status': 'Beta', + 'maintainers': [ + 'brian10048', + 'wolfhall', + 'max3903', + 'smangukiya', + ], +} diff --git a/fieldservice_stock_request/models/__init__.py b/fieldservice_stock_request/models/__init__.py new file mode 100644 index 0000000000..c1024e45cc --- /dev/null +++ b/fieldservice_stock_request/models/__init__.py @@ -0,0 +1,6 @@ +from . import ( + fsm_order, + stock_move_line, + stock_request, + stock_request_order, +) diff --git a/fieldservice_stock_request/models/fsm_order.py b/fieldservice_stock_request/models/fsm_order.py new file mode 100644 index 0000000000..21fa33e80c --- /dev/null +++ b/fieldservice_stock_request/models/fsm_order.py @@ -0,0 +1,63 @@ +# Copyright (C) 2018 - TODAY, Brian McMaster +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import _, api, fields, models + +from odoo.exceptions import UserError + + +REQUEST_STATES = [ + ('draft', 'Draft'), + ('submitted', 'Submitted'), + ('open', 'In progress'), + ('done', 'Done'), + ('cancel', 'Cancelled')] + + +class FSMOrder(models.Model): + _inherit = 'fsm.order' + + stock_request_ids = fields.One2many('stock.request', 'fsm_order_id', + string="Order Lines") + request_stage = fields.Selection(REQUEST_STATES, string='Request State', + default='draft', readonly=True, + store=True) + + @api.multi + def action_request_submit(self): + for rec in self: + if not rec.stock_request_ids: + raise UserError(_('Please create a stock request.')) + for line in rec.stock_request_ids: + if line.state == 'draft': + if line.order_id: + line.order_id.action_submit() + else: + line.action_submit() + rec.request_stage = 'submitted' + + @api.multi + def action_request_cancel(self): + for rec in self: + if not rec.stock_request_ids: + raise UserError(_('Please create a stock request.')) + for line in rec.stock_request_ids: + if line.state in ('draft', 'submitted'): + if line.order_id: + line.order_id.action_cancel() + else: + line.action_cancel() + rec.request_stage = 'cancel' + + @api.multi + def action_request_draft(self): + for rec in self: + if not rec.stock_request_ids: + raise UserError(_('Please create a stock request.')) + for line in rec.stock_request_ids: + if line.state == 'cancel': + if line.order_id: + line.order_id.action_draft() + else: + line.action_draft() + rec.request_stage = 'draft' diff --git a/fieldservice_stock_request/models/stock_move_line.py b/fieldservice_stock_request/models/stock_move_line.py new file mode 100644 index 0000000000..1c1d787648 --- /dev/null +++ b/fieldservice_stock_request/models/stock_move_line.py @@ -0,0 +1,24 @@ +# Copyright (C) 2018 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import exceptions, models + + +class StockMoveLine(models.Model): + _inherit = "stock.move.line" + + def _action_done(self): + res = super(StockMoveLine, self)._action_done() + for rec in self: + # cases were found where self contained deleted records + # example is creating a backorder for Products with lot number + try: + move_id = rec.move_id + except exceptions.MissingError: + move_id = None + if move_id: + for request in rec.move_id.allocation_ids: + if (request.stock_request_id.state == 'done' + and request.stock_request_id.fsm_order_id): + request.stock_request_id.\ + fsm_order_id.request_stage = 'done' + return res diff --git a/fieldservice_stock_request/models/stock_request.py b/fieldservice_stock_request/models/stock_request.py new file mode 100644 index 0000000000..3acf4440e5 --- /dev/null +++ b/fieldservice_stock_request/models/stock_request.py @@ -0,0 +1,115 @@ +# Copyright (C) 2019 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import api, fields, models, _ +from odoo.exceptions import UserError + + +class StockRequest(models.Model): + _inherit = 'stock.request' + + fsm_order_id = fields.Many2one( + 'fsm.order', string="FSM Order", ondelete='cascade', + index=True, copy=False) + + @api.onchange('direction', 'fsm_order_id') + def _onchange_location_id(self): + super()._onchange_location_id() + if self.fsm_order_id: + if self.direction == 'outbound': + # Inventory location of the FSM location of the order + self.location_id = \ + self.fsm_order_id.location_id.inventory_location_id.id + else: + # Otherwise the stock location of the warehouse + self.location_id = \ + self.fsm_order_id.warehouse_id.lot_stock_id.id + + def prepare_order_values(self, vals): + res = { + 'expected_date': vals['expected_date'], + 'picking_policy': vals['picking_policy'], + 'warehouse_id': vals['warehouse_id'], + 'direction': vals['direction'], + 'location_id': vals['location_id'], + } + if 'fsm_order_id' in vals and vals['fsm_order_id']: + res.update({'fsm_order_id': vals['fsm_order_id']}) + return res + + @api.model + def create(self, vals): + if 'fsm_order_id' in vals and vals['fsm_order_id']: + fsm_order = self.env['fsm.order'].browse(vals['fsm_order_id']) + fsm_order.request_stage = 'draft' + vals['warehouse_id'] = fsm_order.warehouse_id.id + picking_type_id = self.env['stock.picking.type'].search( + [('code', '=', 'stock_request_order'), + ('warehouse_id', '=', vals['warehouse_id'])], + limit=1) + order = self.env['stock.request.order'].search([ + ('fsm_order_id', '=', vals['fsm_order_id']), + ('warehouse_id', '=', vals['warehouse_id']), + ('picking_type_id', '=', picking_type_id.id), + ('direction', '=', vals['direction']), + ('state', '=', 'draft')], order="id asc") + + # User created a new SRO Manually + if len(order) > 1: + raise UserError(_('There is already a Stock Request Order \ + with the same Field Service Order and \ + Warehouse that is in Draft state. Please \ + add this Stock Request there. \ + (%s)') % order[0].name) + # Made from an FSO for the first time, create the SRO here + elif not order and vals.get('fsm_order_id'): + values = self.prepare_order_values(vals) + values.update({ + 'picking_type_id': picking_type_id.id, + 'warehouse_id': vals['warehouse_id'], + }) + vals['order_id'] = self.env['stock.request.order'].\ + create(values).id + # There is an SRO made from FSO, assign here + elif len(order) == 1 and vals.get('fsm_order_id'): + vals['expected_date'] = order.expected_date + vals['order_id'] = order.id + return super().create(vals) + + def _prepare_procurement_values(self, group_id=False): + res = super()._prepare_procurement_values(group_id=group_id) + if self.fsm_order_id: + res.update({ + 'fsm_order_id': self.fsm_order_id.id, + 'partner_id': + self.fsm_order_id.location_id.shipping_address_id.id or + self.fsm_order_id.location_id.partner_id.id + }) + return res + + def _prepare_procurement_group_values(self): + if self.fsm_order_id: + order = self.env['fsm.order'].browse(self.fsm_order_id.id) + return {'name': order.name, + 'fsm_order_id': order.id, + 'move_type': 'direct'} + else: + return {} + + @api.multi + def _action_confirm(self): + for req in self: + if (not req.procurement_group_id) and req.fsm_order_id: + fsm_order = self.env['fsm.order'].browse(req.fsm_order_id.id) + group = self.env['procurement.group'].search([ + ('fsm_order_id', '=', fsm_order.id)]) + if not group: + values = req._prepare_procurement_group_values() + group = req.env['procurement.group'].create(values) + if req.order_id: + req.order_id.procurement_group_id = group.id + req.procurement_group_id = group.id + res = super(StockRequest, req)._action_confirm() + fsm_order.request_stage = 'open' + else: + res = super(StockRequest, req)._action_confirm() + return res diff --git a/fieldservice_stock_request/models/stock_request_order.py b/fieldservice_stock_request/models/stock_request_order.py new file mode 100644 index 0000000000..e96d3687c4 --- /dev/null +++ b/fieldservice_stock_request/models/stock_request_order.py @@ -0,0 +1,54 @@ +# Copyright (C) 2019 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class StockRequestOrder(models.Model): + _inherit = 'stock.request.order' + + fsm_order_id = fields.Many2one( + 'fsm.order', string="FSM Order", ondelete='cascade', + index=True, copy=False) + + @api.onchange('warehouse_id', 'direction', 'fsm_order_id') + def _onchange_location_id(self): + super()._onchange_location_id() + if self.fsm_order_id: + if self.direction == 'outbound': + # Inventory location of the FSM location of the order + self.location_id = \ + self.fsm_order_id.location_id.inventory_location_id.id + else: + # Otherwise the stock location of the warehouse + self.location_id = \ + self.fsm_order_id.warehouse_id.lot_stock_id.id + self.change_childs() + + def change_childs(self): + super().change_childs() + if not self._context.get('no_change_childs', False): + for line in self.stock_request_ids: + line.fsm_order_id = self.fsm_order_id.id + + def _prepare_procurement_group_values(self): + if self.fsm_order_id: + order = self.env['fsm.order'].browse(self.fsm_order_id.id) + return {'name': order.name, + 'fsm_order_id': order.id, + 'move_type': 'direct'} + 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) + group = self.env['procurement.group'].search([ + ('fsm_order_id', '=', fsm_order.id)]) + if not group: + values = self._prepare_procurement_group_values() + group = self.env['procurement.group'].create(values) + self.procurement_group_id = group[0].id + self.change_childs() + return super().action_confirm() diff --git a/fieldservice_stock_request/readme/CONFIGURE.rst b/fieldservice_stock_request/readme/CONFIGURE.rst new file mode 100644 index 0000000000..dac98e9fde --- /dev/null +++ b/fieldservice_stock_request/readme/CONFIGURE.rst @@ -0,0 +1,18 @@ +To configure this module, you need to: + +* Go to Inventory > Configuration > Routes +* Select the routes that you want to use from a FSM order +* Check the box 'FSM Order Line' for outbound transfer +* Check the box 'FSM Return Line' for inbound transfer + +The route 'Receipt in 1 step' has no procurement rule so if you want items to be +returned from the service location to your warehouse, you need to create a new +procurement rule for that route: + +* Name: YourCompany: Return +* Action: Move From Another Location +* Procurement Location: WH/Stock +* Served Warehouse: YourCompany +* Source Location: Partner Locations/Customers +* Move Supply Method: Take From Stock +* Operation Type: YourCompany: Receipts diff --git a/fieldservice_stock_request/readme/CONTRIBUTORS.rst b/fieldservice_stock_request/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..61e9fc4dc3 --- /dev/null +++ b/fieldservice_stock_request/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Brian McMaster +* Sandip Mangukiya +* Serpent Consulting Services Pvt. Ltd. diff --git a/fieldservice_stock_request/readme/CREDITS.rst b/fieldservice_stock_request/readme/CREDITS.rst new file mode 100644 index 0000000000..0eff0acf4e --- /dev/null +++ b/fieldservice_stock_request/readme/CREDITS.rst @@ -0,0 +1,3 @@ +The development of this module has been financially supported by: + +* Open Source Integrators diff --git a/fieldservice_stock_request/readme/DESCRIPTION.rst b/fieldservice_stock_request/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..77e98fffa9 --- /dev/null +++ b/fieldservice_stock_request/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module is an add-on for the Field Service application in Odoo. +It provides stock requests in field service orders. diff --git a/fieldservice_stock_request/readme/ROADMAP.rst b/fieldservice_stock_request/readme/ROADMAP.rst new file mode 100644 index 0000000000..f607015959 --- /dev/null +++ b/fieldservice_stock_request/readme/ROADMAP.rst @@ -0,0 +1,2 @@ +The roadmap of the Field Service application is documented on +`Github `_. diff --git a/fieldservice_stock_request/readme/USAGE.rst b/fieldservice_stock_request/readme/USAGE.rst new file mode 100644 index 0000000000..a9332d58c5 --- /dev/null +++ b/fieldservice_stock_request/readme/USAGE.rst @@ -0,0 +1,7 @@ +To use this module, you need to: + +* Create a new service order +* Under the Inventory tab, select the warehouse and add products with quantity +* Confirm the order to create the delivery orders +* Validate the transfers in the Inventory app. Quantities delivered on FSM + Order Line will be updated. diff --git a/fieldservice_stock_request/security/ir.model.access.csv b/fieldservice_stock_request/security/ir.model.access.csv new file mode 100644 index 0000000000..a7d2956a32 --- /dev/null +++ b/fieldservice_stock_request/security/ir.model.access.csv @@ -0,0 +1,7 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_stock_request_allocation_fsm_user,stock.request.allocation.user,stock_request.model_stock_request_allocation,base.group_user,1,0,0,0 +access_stock_request_allocation_portal,access.stock.request.allocation.portal,stock_request.model_stock_request_allocation,base.group_portal,1,0,0,0 +access_stock_request_fsm_user,stock.request.user,stock_request.model_stock_request,fieldservice.group_fsm_user,1,0,0,0 +access_stock_request_fsm_dispatcher,stock.request.dispatcher,stock_request.model_stock_request,fieldservice.group_fsm_dispatcher,1,1,1,1 +access_stock_request_portal,access.stock.request.portal,stock_request.model_stock_request,base.group_portal,1,0,0,0 +access_stock_move_line_portal,access.stock.move.line.portal,stock.model_stock_move_line,base.group_portal,1,0,0,0 diff --git a/fieldservice_stock_request/views/fsm_order.xml b/fieldservice_stock_request/views/fsm_order.xml new file mode 100644 index 0000000000..c20d81cb33 --- /dev/null +++ b/fieldservice_stock_request/views/fsm_order.xml @@ -0,0 +1,53 @@ + + + + fsm.order.form.stock.request + fsm.order + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
diff --git a/fieldservice_stock_request/views/stock.xml b/fieldservice_stock_request/views/stock.xml new file mode 100644 index 0000000000..02ed9524df --- /dev/null +++ b/fieldservice_stock_request/views/stock.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/fieldservice_stock_request/views/stock_request.xml b/fieldservice_stock_request/views/stock_request.xml new file mode 100644 index 0000000000..efb67a0ce0 --- /dev/null +++ b/fieldservice_stock_request/views/stock_request.xml @@ -0,0 +1,23 @@ + + + + stock.request + + + + + + + + + + stock.request + + + + + + + + + diff --git a/fieldservice_stock_request/views/stock_request_order.xml b/fieldservice_stock_request/views/stock_request_order.xml new file mode 100644 index 0000000000..b13d8b4b35 --- /dev/null +++ b/fieldservice_stock_request/views/stock_request_order.xml @@ -0,0 +1,53 @@ + + + + stock.request.order + + + + + + + { + 'default_fsm_order_id': fsm_order_id, + 'default_expected_date': expected_date, + 'default_picking_policy': picking_policy, + 'default_warehouse_id': warehouse_id, + 'default_direction': direction, + 'default_location_id': location_id, + 'default_procurement_group_id': procurement_group_id, + 'default_company_id': company_id, + 'default_state': state} + + + + + + + + + stock.request.order + + + + + + + + + + stock.request.order + + + + + + + + + + + + From 7bd8f56a6a6f1ac49dd48eba69e28a53bd9578cf Mon Sep 17 00:00:00 2001 From: Brian McMaster Date: Fri, 15 Jan 2021 15:32:31 -0500 Subject: [PATCH 02/54] [IMP] fieldservice_stock_request: Add tests --- fieldservice_stock_request/README.rst | 37 +- .../i18n/fieldservice_stock_request.pot | 111 ++++ .../static/description/index.html | 474 ++++++++++++++++++ fieldservice_stock_request/tests/__init__.py | 4 + .../tests/test_fsm_stock_request.py | 92 ++++ 5 files changed, 685 insertions(+), 33 deletions(-) create mode 100644 fieldservice_stock_request/i18n/fieldservice_stock_request.pot create mode 100644 fieldservice_stock_request/static/description/index.html create mode 100644 fieldservice_stock_request/tests/__init__.py create mode 100644 fieldservice_stock_request/tests/test_fsm_stock_request.py diff --git a/fieldservice_stock_request/README.rst b/fieldservice_stock_request/README.rst index ffcd027253..769b79fe5e 100644 --- a/fieldservice_stock_request/README.rst +++ b/fieldservice_stock_request/README.rst @@ -14,10 +14,10 @@ Field Service - Stock Request :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/12.0/fieldservice_stock + :target: https://github.com/OCA/field-service/tree/12.0/fieldservice_stock_request :alt: OCA/field-service .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/field-service-12-0/field-service-12-0-fieldservice_stock + :target: https://translation.odoo-community.org/projects/field-service-12-0/field-service-12-0-fieldservice_stock_request :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/12.0 @@ -26,7 +26,7 @@ Field Service - Stock Request |badge1| |badge2| |badge3| |badge4| |badge5| This module is an add-on for the Field Service application in Odoo. -It provides inventory and stock operations. +It provides stock requests in field service orders. **Table of contents** @@ -38,8 +38,6 @@ Configuration To configure this module, you need to: -* Go to Field Service > Master Data > Locations -* Create or select a location and set the inventory location * Go to Inventory > Configuration > Routes * Select the routes that you want to use from a FSM order * Check the box 'FSM Order Line' for outbound transfer @@ -57,33 +55,6 @@ procurement rule for that route: * Move Supply Method: Take From Stock * Operation Type: YourCompany: Receipts -If you are in a multi-warehouse situation: - -* Go to Field Service > Configuration > Territories -* Create or select a territory -* Set the warehouse that will serve this territory - -Products can be automatically converted into FSM Equipments. -This is only available only for products tracked by serial number. -This needs to be enabled both on Operation Types and Products. -For example, we may want to create the FSM Equipment on Delivery, -or on Receipts. - -To enable on Products: - -* Go to Inventory > Master Data > Products -* Open the Product form, Inventory tab -* On the "Traceability" section, make sure - "Tracking" is set to "By Unique Serial Number" -* Enable the "Creates FSM Equipment" checkbox - -To enable on Operation Types: - -* Go to Inventory > Configuration > Operation Types -* Select the intended Operation Type ("Receipts" for example) -* On the "Traceability" section, enable the - "Create FSM Equipment" checkbox - Usage ===== @@ -107,7 +78,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. diff --git a/fieldservice_stock_request/i18n/fieldservice_stock_request.pot b/fieldservice_stock_request/i18n/fieldservice_stock_request.pot new file mode 100644 index 0000000000..3d56b527f2 --- /dev/null +++ b/fieldservice_stock_request/i18n/fieldservice_stock_request.pot @@ -0,0 +1,111 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_stock_request +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Cancel" +msgstr "" + +#. module: fieldservice_stock_request +#: selection:fsm.order,request_stage:0 +msgid "Cancelled" +msgstr "" + +#. module: fieldservice_stock_request +#: selection:fsm.order,request_stage:0 +msgid "Done" +msgstr "" + +#. module: fieldservice_stock_request +#: selection:fsm.order,request_stage:0 +msgid "Draft" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__fsm_order_id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__fsm_order_id +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search +msgid "FSM Order" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_fsm_order +msgid "Field Service Order" +msgstr "" + +#. module: fieldservice_stock_request +#: selection:fsm.order,request_stage:0 +msgid "In progress" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__stock_request_ids +msgid "Order Lines" +msgstr "" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/fsm_order.py:30 +#: code:addons/fieldservice_stock_request/models/fsm_order.py:43 +#: code:addons/fieldservice_stock_request/models/fsm_order.py:56 +#, python-format +msgid "Please create a stock request." +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_move_line +msgid "Product Moves (Stock Move Line)" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__request_stage +msgid "Request State" +msgstr "" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Set to Draft" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_request +msgid "Stock Request" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_request_order +msgid "Stock Request Order" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.ui.menu,name:fieldservice_stock_request.menu_fsm_stock_request +msgid "Stock Requests" +msgstr "" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Submit" +msgstr "" + +#. module: fieldservice_stock_request +#: selection:fsm.order,request_stage:0 +msgid "Submitted" +msgstr "" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/stock_request.py:58 +#, python-format +msgid "There is already a Stock Request Order with the same Field Service Order and Warehouse that is in Draft state. Please add this Stock Request there. (%s)" +msgstr "" + diff --git a/fieldservice_stock_request/static/description/index.html b/fieldservice_stock_request/static/description/index.html new file mode 100644 index 0000000000..60bede5140 --- /dev/null +++ b/fieldservice_stock_request/static/description/index.html @@ -0,0 +1,474 @@ + + + + + + +Field Service - Stock Request + + + +
+

Field Service - Stock Request

+ + +

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

+

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

+

Table of contents

+ +
+

Configuration

+

To configure this module, you need to:

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

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

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

Usage

+

To use this module, you need to:

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

Known issues / Roadmap

+

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

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us 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
  • +
  • Brian McMaster
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The development of this module has been financially supported by:

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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

+

Current maintainers:

+

brian10048 wolfhall max3903 smangukiya

+

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

+

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

+
+
+
+ + diff --git a/fieldservice_stock_request/tests/__init__.py b/fieldservice_stock_request/tests/__init__.py new file mode 100644 index 0000000000..8e8d509d59 --- /dev/null +++ b/fieldservice_stock_request/tests/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2020, Brian McMaster +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) + +from . import test_fsm_stock_request diff --git a/fieldservice_stock_request/tests/test_fsm_stock_request.py b/fieldservice_stock_request/tests/test_fsm_stock_request.py new file mode 100644 index 0000000000..742dece75d --- /dev/null +++ b/fieldservice_stock_request/tests/test_fsm_stock_request.py @@ -0,0 +1,92 @@ +# Copyright (C) 2020, Brian McMaster +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) + +import datetime + +from odoo.addons.fieldservice_stock.tests.common import TestFSMStockCommon + + +class TestFSMStockRequest(TestFSMStockCommon): + + @classmethod + def setUpClass(cls): + super().setUpClass() + # disable tracking in test + cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) + + # Setup for Stock Request + cls.StockRequest = cls.env["stock.request"] + cls.StockRequestOrder = cls.env["stock.request.order"] + + cls.product_1 = cls.Product.create({ + "name": "Product 1", + "type": "product", + "categ_id": cls.env.ref("product.product_category_all").id, + }) + cls.product_2 = cls.Product.create({ + "name": "Product 2", + "type": "product", + "categ_id": cls.env.ref("product.product_category_all").id, + }) + + def test_fsm_order_stock_request(self): + # Create a new FS Order and add to it some SR + FSO = self.FSMOrder.create({ + "location_id": self.fsm_location_1.id, + }) + + SR_1 = self.StockRequest.create({ + "warehouse_id": FSO.warehouse_id.id, + "location_id": FSO.inventory_location_id.id, + "product_id": self.product_1.id, + "product_uom_qty": 1, + "product_uom_id": self.product_1.uom_id.id, + "fsm_order_id": FSO.id, + "direction": "outbound", + "expected_date": datetime.datetime.now(), + "picking_policy": "direct", + }) + # After create the SR linked to FSO, validate a SRO + # was created and linked to this FSO + SRO = self.StockRequestOrder.search([ + ("fsm_order_id", "=", FSO.id), + ("warehouse_id", "=", FSO.warehouse_id.id) + ]) + self.assertTrue(SRO) + + # Add a second SR to the FSO + SR_2 = self.StockRequest.create({ + "warehouse_id": FSO.warehouse_id.id, + "location_id": FSO.inventory_location_id.id, + "product_id": self.product_2.id, + "product_uom_qty": 4, + "product_uom_id": self.product_2.uom_id.id, + "fsm_order_id": FSO.id, + "direction": "outbound", + "expected_date": datetime.datetime.now(), + "picking_policy": "direct", + }) + # After create the 2nd SR linked to same FSO, validate + # this SR is assigned to the same SRO + self.assertEqual(SR_2.order_id, SRO) + + # Submit the SRs from FSO. Confirm FSO request, SR & SRO are submitted + FSO.action_request_submit() + self.assertEqual(FSO.request_stage, "submitted") + self.assertEqual(SR_1.state, "submitted") + self.assertEqual(SR_2.state, "submitted") + self.assertEqual(SRO.state, "submitted") + + # Cancel the SRs from FSO. Confirm SR are cancelled + FSO.action_request_cancel() + self.assertEqual(FSO.request_stage, "cancel") + self.assertEqual(SR_1.state, "cancel") + self.assertEqual(SR_2.state, "cancel") + self.assertEqual(SRO.state, "cancel") + + # Set the SR to draft. Confirm SR are draft + FSO.action_request_draft() + self.assertEqual(FSO.request_stage, "draft") + self.assertEqual(SR_1.state, "draft") + self.assertEqual(SR_2.state, "draft") + self.assertEqual(SRO.state, "draft") From f6d8ed0d99aac88370f03e5bd21eecec93a07b26 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 9 Mar 2021 22:53:52 +0000 Subject: [PATCH 03/54] [ADD] icon.png --- .../static/description/icon.png | Bin 0 -> 9455 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 fieldservice_stock_request/static/description/icon.png diff --git a/fieldservice_stock_request/static/description/icon.png b/fieldservice_stock_request/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__ zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_ zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY$A9)>P6o~I z%aQ?!(GqeQ-Y+b0I(m9pwgi(IIZZzsbMv+9w{PFtd_<_(LA~0H(xz{=FhLB@(1&qHA5EJw1>>=%q2f&^X>IQ{!GJ4e9U z&KlB)z(84HmNgm2hg2C0>WM{E(DdPr+EeU_N@57;PC2&DmGFW_9kP&%?X4}+xWi)( z;)z%wI5>D4a*5XwD)P--sPkoY(a~WBw;E~AW`Yue4kFa^LM3X`8x|}ZUeMnqr}>kH zG%WWW>3ml$Yez?i%)2pbKPI7?5o?hydokgQyZsNEr{a|mLdt;X2TX(#B1j35xPnPW z*bMSSOauW>o;*=kO8ojw91VX!qoOQb)zHJ!odWB}d+*K?#sY_jqPdg{Sm2HdYzdEx zOGVPhVRTGPtv0o}RfVP;Nd(|CB)I;*t&QO8h zFfekr30S!-LHmV_Su-W+rEwYXJ^;6&3|L$mMC8*bQptyOo9;>Qb9Q9`ySe3%V$A*9 zeKEe+b0{#KWGp$F+tga)0RtI)nhMa-K@JS}2krK~n8vJ=Ngm?R!9G<~RyuU0d?nz# z-5EK$o(!F?hmX*2Yt6+coY`6jGbb7tF#6nHA zuKk=GGJ;ZwON1iAfG$E#Y7MnZVmrY|j0eVI(DN_MNFJmyZ|;w4tf@=CCDZ#5N_0K= z$;R~bbk?}TpfDjfB&aiQ$VA}s?P}xPERJG{kxk5~R`iRS(SK5d+Xs9swCozZISbnS zk!)I0>t=A<-^z(cmSFz3=jZ23u13X><0b)P)^1T_))Kr`e!-pb#q&J*Q`p+B6la%C zuVl&0duN<;uOsB3%T9Fp8t{ED108<+W(nOZd?gDnfNBC3>M8WE61$So|P zVvqH0SNtDTcsUdzaMDpT=Ty0pDHHNL@Z0w$Y`XO z2M-_r1S+GaH%pz#Uy0*w$Vdl=X=rQXEzO}d6J^R6zjM1u&c9vYLvLp?W7w(?np9x1 zE_0JSAJCPB%i7p*Wvg)pn5T`8k3-uR?*NT|J`eS#_#54p>!p(mLDvmc-3o0mX*mp_ zN*AeS<>#^-{S%W<*mz^!X$w_2dHWpcJ6^j64qFBft-o}o_Vx80o0>}Du;>kLts;$8 zC`7q$QI(dKYG`Wa8#wl@V4jVWBRGQ@1dr-hstpQL)Tl+aqVpGpbSfN>5i&QMXfiZ> zaA?T1VGe?rpQ@;+pkrVdd{klI&jVS@I5_iz!=UMpTsa~mBga?1r}aRBm1WS;TT*s0f0lY=JBl66Upy)-k4J}lh=P^8(SXk~0xW=T9v*B|gzIhN z>qsO7dFd~mgxAy4V?&)=5ieYq?zi?ZEoj)&2o)RLy=@hbCRcfT5jigwtQGE{L*8<@Yd{zg;CsL5mvzfDY}P-wos_6PfprFVaeqNE%h zKZhLtcQld;ZD+>=nqN~>GvROfueSzJD&BE*}XfU|H&(FssBqY=hPCt`d zH?@s2>I(|;fcW&YM6#V#!kUIP8$Nkdh0A(bEVj``-AAyYgwY~jB zT|I7Bf@%;7aL7Wf4dZ%VqF$eiaC38OV6oy3Z#TER2G+fOCd9Iaoy6aLYbPTN{XRPz z;U!V|vBf%H!}52L2gH_+j;`bTcQRXB+y9onc^wLm5wi3-Be}U>k_u>2Eg$=k!(l@I zcCg+flakT2Nej3i0yn+g+}%NYb?ta;R?(g5SnwsQ49U8Wng8d|{B+lyRcEDvR3+`O{zfmrmvFrL6acVP%yG98X zo&+VBg@px@i)%o?dG(`T;n*$S5*rnyiR#=wW}}GsAcfyQpE|>a{=$Hjg=-*_K;UtD z#z-)AXwSRY?OPefw^iI+ z)AXz#PfEjlwTes|_{sB?4(O@fg0AJ^g8gP}ex9Ucf*@_^J(s_5jJV}c)s$`Myn|Kd z$6>}#q^n{4vN@+Os$m7KV+`}c%4)4pv@06af4-x5#wj!KKb%caK{A&Y#Rfs z-po?Dcb1({W=6FKIUirH&(yg=*6aLCekcKwyfK^JN5{wcA3nhO(o}SK#!CINhI`-I z1)6&n7O&ZmyFMuNwvEic#IiOAwNkR=u5it{B9n2sAJV5pNhar=j5`*N!Na;c7g!l$ z3aYBqUkqqTJ=Re-;)s!EOeij=7SQZ3Hq}ZRds%IM*PtM$wV z@;rlc*NRK7i3y5BETSKuumEN`Xu_8GP1Ri=OKQ$@I^ko8>H6)4rjiG5{VBM>B|%`&&s^)jS|-_95&yc=GqjNo{zFkw%%HHhS~e=s zD#sfS+-?*t|J!+ozP6KvtOl!R)@@-z24}`9{QaVLD^9VCSR2b`b!KC#o;Ki<+wXB6 zx3&O0LOWcg4&rv4QG0)4yb}7BFSEg~=IR5#ZRj8kg}dS7_V&^%#Do==#`u zpy6{ox?jWuR(;pg+f@mT>#HGWHAJRRDDDv~@(IDw&R>9643kK#HN`!1vBJHnC+RM&yIh8{gG2q zA%e*U3|N0XSRa~oX-3EAneep)@{h2vvd3Xvy$7og(sayr@95+e6~Xvi1tUqnIxoIH zVWo*OwYElb#uyW{Imam6f2rGbjR!Y3`#gPqkv57dB6K^wRGxc9B(t|aYDGS=m$&S!NmCtrMMaUg(c zc2qC=2Z`EEFMW-me5B)24AqF*bV5Dr-M5ig(l-WPS%CgaPzs6p_gnCIvTJ=Y<6!gT zVt@AfYCzjjsMEGi=rDQHo0yc;HqoRNnNFeWZgcm?f;cp(6CNylj36DoL(?TS7eU#+ z7&mfr#y))+CJOXQKUMZ7QIdS9@#-}7y2K1{8)cCt0~-X0O!O?Qx#E4Og+;A2SjalQ zs7r?qn0H044=sDN$SRG$arw~n=+T_DNdSrarmu)V6@|?1-ZB#hRn`uilTGPJ@fqEy zGt(f0B+^JDP&f=r{#Y_wi#AVDf-y!RIXU^0jXsFpf>=Ji*TeqSY!H~AMbJdCGLhC) zn7Rx+sXw6uYj;WRYrLd^5IZq@6JI1C^YkgnedZEYy<&4(z%Q$5yv#Boo{AH8n$a zhb4Y3PWdr269&?V%uI$xMcUrMzl=;w<_nm*qr=c3Rl@i5wWB;e-`t7D&c-mcQl7x! zZWB`UGcw=Y2=}~wzrfLx=uet<;m3~=8I~ZRuzvMQUQdr+yTV|ATf1Uuomr__nDf=X zZ3WYJtHp_ri(}SQAPjv+Y+0=fH4krOP@S&=zZ-t1jW1o@}z;xk8 z(Nz1co&El^HK^NrhVHa-_;&88vTU>_J33=%{if;BEY*J#1n59=07jrGQ#IP>@u#3A z;!q+E1Rj3ZJ+!4bq9F8PXJ@yMgZL;>&gYA0%_Kbi8?S=XGM~dnQZQ!yBSgcZhY96H zrWnU;k)qy`rX&&xlDyA%(a1Hhi5CWkmg(`Gb%m(HKi-7Z!LKGRP_B8@`7&hdDy5n= z`OIxqxiVfX@OX1p(mQu>0Ai*v_cTMiw4qRt3~NBvr9oBy0)r>w3p~V0SCm=An6@3n)>@z!|o-$HvDK z|3D2ZMJkLE5loMKl6R^ez@Zz%S$&mbeoqH5`Bb){Ei21q&VP)hWS2tjShfFtGE+$z zzCR$P#uktu+#!w)cX!lWN1XU%K-r=s{|j?)Akf@q#3b#{6cZCuJ~gCxuMXRmI$nGtnH+-h z+GEi!*X=AP<|fG`1>MBdTb?28JYc=fGvAi2I<$B(rs$;eoJCyR6_bc~p!XR@O-+sD z=eH`-ye})I5ic1eL~TDmtfJ|8`0VJ*Yr=hNCd)G1p2MMz4C3^Mj?7;!w|Ly%JqmuW zlIEW^Ft%z?*|fpXda>Jr^1noFZEwFgVV%|*XhH@acv8rdGxeEX{M$(vG{Zw+x(ei@ zmfXb22}8-?Fi`vo-YVrTH*C?a8%M=Hv9MqVH7H^J$KsD?>!SFZ;ZsvnHr_gn=7acz z#W?0eCdVhVMWN12VV^$>WlQ?f;P^{(&pYTops|btm6aj>_Uz+hqpGwB)vWp0Cf5y< zft8-je~nn?W11plq}N)4A{l8I7$!ks_x$PXW-2XaRFswX_BnF{R#6YIwMhAgd5F9X zGmwdadS6(a^fjHtXg8=l?Rc0Sm%hk6E9!5cLVloEy4eh(=FwgP`)~I^5~pBEWo+F6 zSf2ncyMurJN91#cJTy_u8Y}@%!bq1RkGC~-bV@SXRd4F{R-*V`bS+6;W5vZ(&+I<9$;-V|eNfLa5n-6% z2(}&uGRF;p92eS*sE*oR$@pexaqr*meB)VhmIg@h{uzkk$9~qh#cHhw#>O%)b@+(| z^IQgqzuj~Sk(J;swEM-3TrJAPCq9k^^^`q{IItKBRXYe}e0Tdr=Huf7da3$l4PdpwWDop%^}n;dD#K4s#DYA8SHZ z&1!riV4W4R7R#C))JH1~axJ)RYnM$$lIR%6fIVA@zV{XVyx}C+a-Dt8Y9M)^KU0+H zR4IUb2CJ{Hg>CuaXtD50jB(_Tcx=Z$^WYu2u5kubqmwp%drJ6 z?Fo40g!Qd<-l=TQxqHEOuPX0;^z7iX?Ke^a%XT<13TA^5`4Xcw6D@Ur&VT&CUe0d} z1GjOVF1^L@>O)l@?bD~$wzgf(nxX1OGD8fEV?TdJcZc2KoUe|oP1#=$$7ee|xbY)A zDZq+cuTpc(fFdj^=!;{k03C69lMQ(|>uhRfRu%+!k&YOi-3|1QKB z z?n?eq1XP>p-IM$Z^C;2L3itnbJZAip*Zo0aw2bs8@(s^~*8T9go!%dHcAz2lM;`yp zD=7&xjFV$S&5uDaiScyD?B-i1ze`+CoRtz`Wn+Zl&#s4&}MO{@N!ufrzjG$B79)Y2d3tBk&)TxUTw@QS0TEL_?njX|@vq?Uz(nBFK5Pq7*xj#u*R&i|?7+6# z+|r_n#SW&LXhtheZdah{ZVoqwyT{D>MC3nkFF#N)xLi{p7J1jXlmVeb;cP5?e(=f# zuT7fvjSbjS781v?7{)-X3*?>tq?)Yd)~|1{BDS(pqC zC}~H#WXlkUW*H5CDOo<)#x7%RY)A;ShGhI5s*#cRDA8YgqG(HeKDx+#(ZQ?386dv! zlXCO)w91~Vw4AmOcATuV653fa9R$fyK8ul%rG z-wfS zihugoZyr38Im?Zuh6@RcF~t1anQu7>#lPpb#}4cOA!EM11`%f*07RqOVkmX{p~KJ9 z^zP;K#|)$`^Rb{rnHGH{~>1(fawV0*Z#)}M`m8-?ZJV<+e}s9wE# z)l&az?w^5{)`S(%MRzxdNqrs1n*-=jS^_jqE*5XDrA0+VE`5^*p3CuM<&dZEeCjoz zR;uu_H9ZPZV|fQq`Cyw4nscrVwi!fE6ciMmX$!_hN7uF;jjKG)d2@aC4ropY)8etW=xJvni)8eHi`H$%#zn^WJ5NLc-rqk|u&&4Z6fD_m&JfSI1Bvb?b<*n&sfl0^t z=HnmRl`XrFvMKB%9}>PaA`m-fK6a0(8=qPkWS5bb4=v?XcWi&hRY?O5HdulRi4?fN zlsJ*N-0Qw+Yic@s0(2uy%F@ib;GjXt01Fmx5XbRo6+n|pP(&nodMoap^z{~q ziEeaUT@Mxe3vJSfI6?uLND(CNr=#^W<1b}jzW58bIfyWTDle$mmS(|x-0|2UlX+9k zQ^EX7Nw}?EzVoBfT(-LT|=9N@^hcn-_p&sqG z&*oVs2JSU+N4ZD`FhCAWaS;>|wH2G*Id|?pa#@>tyxX`+4HyIArWDvVrX)2WAOQff z0qyHu&-S@i^MS-+j--!pr4fPBj~_8({~e1bfcl0wI1kaoN>mJL6KUPQm5N7lB(ui1 zE-o%kq)&djzWJ}ob<-GfDlkB;F31j-VHKvQUGQ3sp`CwyGJk_i!y^sD0fqC@$9|jO zOqN!r!8-p==F@ZVP=U$qSpY(gQ0)59P1&t@y?5rvg<}E+GB}26NYPp4f2YFQrQtot5mn3wu_qprZ=>Ig-$ zbW26Ws~IgY>}^5w`vTB(G`PTZaDiGBo5o(tp)qli|NeV( z@H_=R8V39rt5J5YB2Ky?4eJJ#b`_iBe2ot~6%7mLt5t8Vwi^Jy7|jWXqa3amOIoRb zOr}WVFP--DsS`1WpN%~)t3R!arKF^Q$e12KEqU36AWwnCBICpH4XCsfnyrHr>$I$4 z!DpKX$OKLWarN7nv@!uIA+~RNO)l$$w}p(;b>mx8pwYvu;dD_unryX_NhT8*Tj>BTrTTL&!?O+%Rv;b?B??gSzdp?6Uug9{ zd@V08Z$BdI?fpoCS$)t4mg4rT8Q_I}h`0d-vYZ^|dOB*Q^S|xqTV*vIg?@fVFSmMpaw0qtTRbx} z({Pg?#{2`sc9)M5N$*N|4;^t$+QP?#mov zGVC@I*lBVrOU-%2y!7%)fAKjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22 zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 From 09362e9938b3a758b84276c98d64156ab26b3040 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 9 Mar 2021 22:53:57 +0000 Subject: [PATCH 04/54] fieldservice_stock_request 12.0.2.0.0 --- fieldservice_stock_request/__manifest__.py | 2 +- fieldservice_stock_request/i18n/pt_BR.po | 111 +++++++++++++++++++++ 2 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 fieldservice_stock_request/i18n/pt_BR.po diff --git a/fieldservice_stock_request/__manifest__.py b/fieldservice_stock_request/__manifest__.py index 55493642d5..cc40881269 100644 --- a/fieldservice_stock_request/__manifest__.py +++ b/fieldservice_stock_request/__manifest__.py @@ -4,7 +4,7 @@ { 'name': 'Field Service - Stock Request', 'summary': 'Integrate Stock Requests with Field Service Orders', - 'version': '12.0.1.0.0', + 'version': '12.0.2.0.0', 'category': 'Field Service', 'author': "Open Source Integrators, " "Brian McMaster, " diff --git a/fieldservice_stock_request/i18n/pt_BR.po b/fieldservice_stock_request/i18n/pt_BR.po new file mode 100644 index 0000000000..54103b6616 --- /dev/null +++ b/fieldservice_stock_request/i18n/pt_BR.po @@ -0,0 +1,111 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_stock_request +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\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" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Cancel" +msgstr "" + +#. module: fieldservice_stock_request +#: selection:fsm.order,request_stage:0 +msgid "Cancelled" +msgstr "" + +#. module: fieldservice_stock_request +#: selection:fsm.order,request_stage:0 +msgid "Done" +msgstr "" + +#. module: fieldservice_stock_request +#: selection:fsm.order,request_stage:0 +msgid "Draft" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__fsm_order_id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__fsm_order_id +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search +msgid "FSM Order" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_fsm_order +msgid "Field Service Order" +msgstr "" + +#. module: fieldservice_stock_request +#: selection:fsm.order,request_stage:0 +msgid "In progress" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__stock_request_ids +msgid "Order Lines" +msgstr "" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/fsm_order.py:30 +#: code:addons/fieldservice_stock_request/models/fsm_order.py:43 +#: code:addons/fieldservice_stock_request/models/fsm_order.py:56 +#, python-format +msgid "Please create a stock request." +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_move_line +msgid "Product Moves (Stock Move Line)" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__request_stage +msgid "Request State" +msgstr "" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Set to Draft" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_request +msgid "Stock Request" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_request_order +msgid "Stock Request Order" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.ui.menu,name:fieldservice_stock_request.menu_fsm_stock_request +msgid "Stock Requests" +msgstr "" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Submit" +msgstr "" + +#. module: fieldservice_stock_request +#: selection:fsm.order,request_stage:0 +msgid "Submitted" +msgstr "" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/stock_request.py:58 +#, python-format +msgid "There is already a Stock Request Order with the same Field Service Order and Warehouse that is in Draft state. Please add this Stock Request there. (%s)" +msgstr "" From 8c0aa7d621abf244050f82cf0576f75429fdc060 Mon Sep 17 00:00:00 2001 From: Marcel Savegnago Date: Mon, 15 Mar 2021 03:18:36 +0000 Subject: [PATCH 05/54] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (18 of 18 strings) Translation: field-service-12.0/field-service-12.0-fieldservice_stock_request Translate-URL: https://translation.odoo-community.org/projects/field-service-12-0/field-service-12-0-fieldservice_stock_request/pt_BR/ --- fieldservice_stock_request/i18n/pt_BR.po | 43 ++++++++++++++---------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/fieldservice_stock_request/i18n/pt_BR.po b/fieldservice_stock_request/i18n/pt_BR.po index 54103b6616..7d42e4a861 100644 --- a/fieldservice_stock_request/i18n/pt_BR.po +++ b/fieldservice_stock_request/i18n/pt_BR.po @@ -6,55 +6,57 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2021-03-15 05:45+0000\n" +"Last-Translator: Marcel Savegnago \n" "Language-Team: none\n" "Language: pt_BR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.3.2\n" #. module: fieldservice_stock_request #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request msgid "Cancel" -msgstr "" +msgstr "Cancelar" #. module: fieldservice_stock_request #: selection:fsm.order,request_stage:0 msgid "Cancelled" -msgstr "" +msgstr "Cancelado" #. module: fieldservice_stock_request #: selection:fsm.order,request_stage:0 msgid "Done" -msgstr "" +msgstr "Concluído" #. module: fieldservice_stock_request #: selection:fsm.order,request_stage:0 msgid "Draft" -msgstr "" +msgstr "Provisório" #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__fsm_order_id #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__fsm_order_id #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search msgid "FSM Order" -msgstr "" +msgstr "Ordem FSM" #. module: fieldservice_stock_request #: model:ir.model,name:fieldservice_stock_request.model_fsm_order msgid "Field Service Order" -msgstr "" +msgstr "Ordem de Serviço de Campo" #. module: fieldservice_stock_request #: selection:fsm.order,request_stage:0 msgid "In progress" -msgstr "" +msgstr "Em andamento" #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__stock_request_ids msgid "Order Lines" -msgstr "" +msgstr "Itens do Pedido" #. module: fieldservice_stock_request #: code:addons/fieldservice_stock_request/models/fsm_order.py:30 @@ -62,50 +64,55 @@ msgstr "" #: code:addons/fieldservice_stock_request/models/fsm_order.py:56 #, python-format msgid "Please create a stock request." -msgstr "" +msgstr "Por favor, crie uma requisição de estoque." #. module: fieldservice_stock_request #: model:ir.model,name:fieldservice_stock_request.model_stock_move_line msgid "Product Moves (Stock Move Line)" -msgstr "" +msgstr "Movimentos do Produto (Linha do Movimento do Estoque)" #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__request_stage msgid "Request State" -msgstr "" +msgstr "Estado de Requisição" #. module: fieldservice_stock_request #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request msgid "Set to Draft" -msgstr "" +msgstr "Definir como Provisório" #. module: fieldservice_stock_request #: model:ir.model,name:fieldservice_stock_request.model_stock_request msgid "Stock Request" -msgstr "" +msgstr "Requisição de Estoque" #. module: fieldservice_stock_request #: model:ir.model,name:fieldservice_stock_request.model_stock_request_order msgid "Stock Request Order" -msgstr "" +msgstr "Ordens de Requisição de Estoque" #. module: fieldservice_stock_request #: model:ir.ui.menu,name:fieldservice_stock_request.menu_fsm_stock_request msgid "Stock Requests" -msgstr "" +msgstr "Requisições de Estoque" #. module: fieldservice_stock_request #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request msgid "Submit" -msgstr "" +msgstr "Enviar" #. module: fieldservice_stock_request #: selection:fsm.order,request_stage:0 msgid "Submitted" -msgstr "" +msgstr "Enviado" #. module: fieldservice_stock_request #: code:addons/fieldservice_stock_request/models/stock_request.py:58 #, python-format msgid "There is already a Stock Request Order with the same Field Service Order and Warehouse that is in Draft state. Please add this Stock Request there. (%s)" msgstr "" +"Já existe uma Ordem de Requisição de " +"Estoque com a mesma Order de Serviço de " +"Campo e Estoque em estado de Rascunho. Por " +"favor e adicione esta Requisição de " +"Estoque lá. (%s)" From 94cf6a2e0f8645b3f386cad05c79bd42b6c7271b Mon Sep 17 00:00:00 2001 From: Reed Hayashikawa Date: Mon, 21 Jun 2021 10:59:26 -0700 Subject: [PATCH 06/54] [IMP] fieldservice_stock_request: black, isort, prettier --- fieldservice_stock_request/__manifest__.py | 47 +++---- .../models/fsm_order.py | 48 ++++--- .../models/stock_move_line.py | 9 +- .../models/stock_request.py | 127 ++++++++++-------- .../models/stock_request_order.py | 33 +++-- .../tests/test_fsm_stock_request.py | 84 ++++++------ .../views/fsm_order.xml | 86 +++++++----- fieldservice_stock_request/views/stock.xml | 14 +- .../views/stock_request.xml | 11 +- .../views/stock_request_order.xml | 37 ++--- 10 files changed, 265 insertions(+), 231 deletions(-) diff --git a/fieldservice_stock_request/__manifest__.py b/fieldservice_stock_request/__manifest__.py index cc40881269..384686191d 100644 --- a/fieldservice_stock_request/__manifest__.py +++ b/fieldservice_stock_request/__manifest__.py @@ -2,32 +2,27 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { - 'name': 'Field Service - Stock Request', - 'summary': 'Integrate Stock Requests with Field Service Orders', - 'version': '12.0.2.0.0', - 'category': 'Field Service', - 'author': "Open Source Integrators, " - "Brian McMaster, " - "Odoo Community Association (OCA)", - 'website': 'https://github.com/OCA/field-service', - 'depends': [ - 'fieldservice_stock', - 'stock_request_direction', - 'stock_request_picking_type', + "name": "Field Service - Stock Request", + "summary": "Integrate Stock Requests with Field Service Orders", + "version": "12.0.2.0.0", + "category": "Field Service", + "author": "Open Source Integrators, " + "Brian McMaster, " + "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/field-service", + "depends": [ + "fieldservice_stock", + "stock_request_direction", + "stock_request_picking_type", ], - 'data': [ - 'security/ir.model.access.csv', - 'views/fsm_order.xml', - 'views/stock.xml', - 'views/stock_request.xml', - 'views/stock_request_order.xml', - ], - 'license': 'AGPL-3', - 'development_status': 'Beta', - 'maintainers': [ - 'brian10048', - 'wolfhall', - 'max3903', - 'smangukiya', + "data": [ + "security/ir.model.access.csv", + "views/fsm_order.xml", + "views/stock.xml", + "views/stock_request.xml", + "views/stock_request_order.xml", ], + "license": "AGPL-3", + "development_status": "Beta", + "maintainers": ["brian10048", "wolfhall", "max3903", "smangukiya",], } diff --git a/fieldservice_stock_request/models/fsm_order.py b/fieldservice_stock_request/models/fsm_order.py index 21fa33e80c..4716653ea9 100644 --- a/fieldservice_stock_request/models/fsm_order.py +++ b/fieldservice_stock_request/models/fsm_order.py @@ -2,62 +2,66 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import _, api, fields, models - from odoo.exceptions import UserError - REQUEST_STATES = [ - ('draft', 'Draft'), - ('submitted', 'Submitted'), - ('open', 'In progress'), - ('done', 'Done'), - ('cancel', 'Cancelled')] + ("draft", "Draft"), + ("submitted", "Submitted"), + ("open", "In progress"), + ("done", "Done"), + ("cancel", "Cancelled"), +] class FSMOrder(models.Model): - _inherit = 'fsm.order' + _inherit = "fsm.order" - stock_request_ids = fields.One2many('stock.request', 'fsm_order_id', - string="Order Lines") - request_stage = fields.Selection(REQUEST_STATES, string='Request State', - default='draft', readonly=True, - store=True) + stock_request_ids = fields.One2many( + "stock.request", "fsm_order_id", string="Order Lines" + ) + request_stage = fields.Selection( + REQUEST_STATES, + string="Request State", + default="draft", + readonly=True, + store=True, + ) @api.multi def action_request_submit(self): for rec in self: if not rec.stock_request_ids: - raise UserError(_('Please create a stock request.')) + raise UserError(_("Please create a stock request.")) for line in rec.stock_request_ids: - if line.state == 'draft': + if line.state == "draft": if line.order_id: line.order_id.action_submit() else: line.action_submit() - rec.request_stage = 'submitted' + rec.request_stage = "submitted" @api.multi def action_request_cancel(self): for rec in self: if not rec.stock_request_ids: - raise UserError(_('Please create a stock request.')) + raise UserError(_("Please create a stock request.")) for line in rec.stock_request_ids: - if line.state in ('draft', 'submitted'): + if line.state in ("draft", "submitted"): if line.order_id: line.order_id.action_cancel() else: line.action_cancel() - rec.request_stage = 'cancel' + rec.request_stage = "cancel" @api.multi def action_request_draft(self): for rec in self: if not rec.stock_request_ids: - raise UserError(_('Please create a stock request.')) + raise UserError(_("Please create a stock request.")) for line in rec.stock_request_ids: - if line.state == 'cancel': + if line.state == "cancel": if line.order_id: line.order_id.action_draft() else: line.action_draft() - rec.request_stage = 'draft' + rec.request_stage = "draft" diff --git a/fieldservice_stock_request/models/stock_move_line.py b/fieldservice_stock_request/models/stock_move_line.py index 1c1d787648..9c281c28a1 100644 --- a/fieldservice_stock_request/models/stock_move_line.py +++ b/fieldservice_stock_request/models/stock_move_line.py @@ -17,8 +17,9 @@ def _action_done(self): move_id = None if move_id: for request in rec.move_id.allocation_ids: - if (request.stock_request_id.state == 'done' - and request.stock_request_id.fsm_order_id): - request.stock_request_id.\ - fsm_order_id.request_stage = 'done' + if ( + request.stock_request_id.state == "done" + and request.stock_request_id.fsm_order_id + ): + request.stock_request_id.fsm_order_id.request_stage = "done" return res diff --git a/fieldservice_stock_request/models/stock_request.py b/fieldservice_stock_request/models/stock_request.py index 3acf4440e5..b62d9f63b1 100644 --- a/fieldservice_stock_request/models/stock_request.py +++ b/fieldservice_stock_request/models/stock_request.py @@ -1,97 +1,109 @@ # Copyright (C) 2019 Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import api, fields, models, _ +from odoo import _, api, fields, models from odoo.exceptions import UserError class StockRequest(models.Model): - _inherit = 'stock.request' + _inherit = "stock.request" fsm_order_id = fields.Many2one( - 'fsm.order', string="FSM Order", ondelete='cascade', - index=True, copy=False) + "fsm.order", string="FSM Order", ondelete="cascade", index=True, copy=False + ) - @api.onchange('direction', 'fsm_order_id') + @api.onchange("direction", "fsm_order_id") def _onchange_location_id(self): super()._onchange_location_id() if self.fsm_order_id: - if self.direction == 'outbound': + if self.direction == "outbound": # Inventory location of the FSM location of the order - self.location_id = \ + self.location_id = ( self.fsm_order_id.location_id.inventory_location_id.id + ) else: # Otherwise the stock location of the warehouse - self.location_id = \ - self.fsm_order_id.warehouse_id.lot_stock_id.id + self.location_id = self.fsm_order_id.warehouse_id.lot_stock_id.id def prepare_order_values(self, vals): res = { - 'expected_date': vals['expected_date'], - 'picking_policy': vals['picking_policy'], - 'warehouse_id': vals['warehouse_id'], - 'direction': vals['direction'], - 'location_id': vals['location_id'], + "expected_date": vals["expected_date"], + "picking_policy": vals["picking_policy"], + "warehouse_id": vals["warehouse_id"], + "direction": vals["direction"], + "location_id": vals["location_id"], } - if 'fsm_order_id' in vals and vals['fsm_order_id']: - res.update({'fsm_order_id': vals['fsm_order_id']}) + if "fsm_order_id" in vals and vals["fsm_order_id"]: + res.update({"fsm_order_id": vals["fsm_order_id"]}) return res @api.model def create(self, vals): - if 'fsm_order_id' in vals and vals['fsm_order_id']: - fsm_order = self.env['fsm.order'].browse(vals['fsm_order_id']) - fsm_order.request_stage = 'draft' - vals['warehouse_id'] = fsm_order.warehouse_id.id - picking_type_id = self.env['stock.picking.type'].search( - [('code', '=', 'stock_request_order'), - ('warehouse_id', '=', vals['warehouse_id'])], - limit=1) - order = self.env['stock.request.order'].search([ - ('fsm_order_id', '=', vals['fsm_order_id']), - ('warehouse_id', '=', vals['warehouse_id']), - ('picking_type_id', '=', picking_type_id.id), - ('direction', '=', vals['direction']), - ('state', '=', 'draft')], order="id asc") + if "fsm_order_id" in vals and vals["fsm_order_id"]: + fsm_order = self.env["fsm.order"].browse(vals["fsm_order_id"]) + fsm_order.request_stage = "draft" + vals["warehouse_id"] = fsm_order.warehouse_id.id + picking_type_id = self.env["stock.picking.type"].search( + [ + ("code", "=", "stock_request_order"), + ("warehouse_id", "=", vals["warehouse_id"]), + ], + limit=1, + ) + order = self.env["stock.request.order"].search( + [ + ("fsm_order_id", "=", vals["fsm_order_id"]), + ("warehouse_id", "=", vals["warehouse_id"]), + ("picking_type_id", "=", picking_type_id.id), + ("direction", "=", vals["direction"]), + ("state", "=", "draft"), + ], + order="id asc", + ) # User created a new SRO Manually if len(order) > 1: - raise UserError(_('There is already a Stock Request Order \ + raise UserError( + _( + "There is already a Stock Request Order \ with the same Field Service Order and \ Warehouse that is in Draft state. Please \ add this Stock Request there. \ - (%s)') % order[0].name) + (%s)" + ) + % order[0].name + ) # Made from an FSO for the first time, create the SRO here - elif not order and vals.get('fsm_order_id'): + elif not order and vals.get("fsm_order_id"): values = self.prepare_order_values(vals) - values.update({ - 'picking_type_id': picking_type_id.id, - 'warehouse_id': vals['warehouse_id'], - }) - vals['order_id'] = self.env['stock.request.order'].\ - create(values).id + values.update( + { + "picking_type_id": picking_type_id.id, + "warehouse_id": vals["warehouse_id"], + } + ) + vals["order_id"] = self.env["stock.request.order"].create(values).id # There is an SRO made from FSO, assign here - elif len(order) == 1 and vals.get('fsm_order_id'): - vals['expected_date'] = order.expected_date - vals['order_id'] = order.id + elif len(order) == 1 and vals.get("fsm_order_id"): + vals["expected_date"] = order.expected_date + vals["order_id"] = order.id return super().create(vals) def _prepare_procurement_values(self, group_id=False): res = super()._prepare_procurement_values(group_id=group_id) if self.fsm_order_id: - res.update({ - 'fsm_order_id': self.fsm_order_id.id, - 'partner_id': - self.fsm_order_id.location_id.shipping_address_id.id or - self.fsm_order_id.location_id.partner_id.id - }) + res.update( + { + "fsm_order_id": self.fsm_order_id.id, + "partner_id": self.fsm_order_id.location_id.shipping_address_id.id + or self.fsm_order_id.location_id.partner_id.id, + } + ) return res def _prepare_procurement_group_values(self): if self.fsm_order_id: - order = self.env['fsm.order'].browse(self.fsm_order_id.id) - return {'name': order.name, - 'fsm_order_id': order.id, - 'move_type': 'direct'} + order = self.env["fsm.order"].browse(self.fsm_order_id.id) + return {"name": order.name, "fsm_order_id": order.id, "move_type": "direct"} else: return {} @@ -99,17 +111,18 @@ def _prepare_procurement_group_values(self): def _action_confirm(self): for req in self: if (not req.procurement_group_id) and req.fsm_order_id: - fsm_order = self.env['fsm.order'].browse(req.fsm_order_id.id) - group = self.env['procurement.group'].search([ - ('fsm_order_id', '=', fsm_order.id)]) + fsm_order = self.env["fsm.order"].browse(req.fsm_order_id.id) + group = self.env["procurement.group"].search( + [("fsm_order_id", "=", fsm_order.id)] + ) if not group: values = req._prepare_procurement_group_values() - group = req.env['procurement.group'].create(values) + group = req.env["procurement.group"].create(values) if req.order_id: req.order_id.procurement_group_id = group.id req.procurement_group_id = group.id res = super(StockRequest, req)._action_confirm() - fsm_order.request_stage = 'open' + fsm_order.request_stage = "open" else: res = super(StockRequest, req)._action_confirm() return res diff --git a/fieldservice_stock_request/models/stock_request_order.py b/fieldservice_stock_request/models/stock_request_order.py index e96d3687c4..5d662d287a 100644 --- a/fieldservice_stock_request/models/stock_request_order.py +++ b/fieldservice_stock_request/models/stock_request_order.py @@ -5,50 +5,49 @@ class StockRequestOrder(models.Model): - _inherit = 'stock.request.order' + _inherit = "stock.request.order" fsm_order_id = fields.Many2one( - 'fsm.order', string="FSM Order", ondelete='cascade', - index=True, copy=False) + "fsm.order", string="FSM Order", ondelete="cascade", index=True, copy=False + ) - @api.onchange('warehouse_id', 'direction', 'fsm_order_id') + @api.onchange("warehouse_id", "direction", "fsm_order_id") def _onchange_location_id(self): super()._onchange_location_id() if self.fsm_order_id: - if self.direction == 'outbound': + if self.direction == "outbound": # Inventory location of the FSM location of the order - self.location_id = \ + self.location_id = ( self.fsm_order_id.location_id.inventory_location_id.id + ) else: # Otherwise the stock location of the warehouse - self.location_id = \ - self.fsm_order_id.warehouse_id.lot_stock_id.id + self.location_id = self.fsm_order_id.warehouse_id.lot_stock_id.id self.change_childs() def change_childs(self): super().change_childs() - if not self._context.get('no_change_childs', False): + if not self._context.get("no_change_childs", False): for line in self.stock_request_ids: line.fsm_order_id = self.fsm_order_id.id def _prepare_procurement_group_values(self): if self.fsm_order_id: - order = self.env['fsm.order'].browse(self.fsm_order_id.id) - return {'name': order.name, - 'fsm_order_id': order.id, - 'move_type': 'direct'} + order = self.env["fsm.order"].browse(self.fsm_order_id.id) + return {"name": order.name, "fsm_order_id": order.id, "move_type": "direct"} 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) - group = self.env['procurement.group'].search([ - ('fsm_order_id', '=', fsm_order.id)]) + fsm_order = self.env["fsm.order"].browse(self.fsm_order_id.id) + group = self.env["procurement.group"].search( + [("fsm_order_id", "=", fsm_order.id)] + ) if not group: values = self._prepare_procurement_group_values() - group = self.env['procurement.group'].create(values) + group = self.env["procurement.group"].create(values) self.procurement_group_id = group[0].id self.change_childs() return super().action_confirm() diff --git a/fieldservice_stock_request/tests/test_fsm_stock_request.py b/fieldservice_stock_request/tests/test_fsm_stock_request.py index 742dece75d..399528986f 100644 --- a/fieldservice_stock_request/tests/test_fsm_stock_request.py +++ b/fieldservice_stock_request/tests/test_fsm_stock_request.py @@ -7,7 +7,6 @@ class TestFSMStockRequest(TestFSMStockCommon): - @classmethod def setUpClass(cls): super().setUpClass() @@ -18,54 +17,59 @@ def setUpClass(cls): cls.StockRequest = cls.env["stock.request"] cls.StockRequestOrder = cls.env["stock.request.order"] - cls.product_1 = cls.Product.create({ - "name": "Product 1", - "type": "product", - "categ_id": cls.env.ref("product.product_category_all").id, - }) - cls.product_2 = cls.Product.create({ - "name": "Product 2", - "type": "product", - "categ_id": cls.env.ref("product.product_category_all").id, - }) + cls.product_1 = cls.Product.create( + { + "name": "Product 1", + "type": "product", + "categ_id": cls.env.ref("product.product_category_all").id, + } + ) + cls.product_2 = cls.Product.create( + { + "name": "Product 2", + "type": "product", + "categ_id": cls.env.ref("product.product_category_all").id, + } + ) def test_fsm_order_stock_request(self): # Create a new FS Order and add to it some SR - FSO = self.FSMOrder.create({ - "location_id": self.fsm_location_1.id, - }) + FSO = self.FSMOrder.create({"location_id": self.fsm_location_1.id,}) - SR_1 = self.StockRequest.create({ - "warehouse_id": FSO.warehouse_id.id, - "location_id": FSO.inventory_location_id.id, - "product_id": self.product_1.id, - "product_uom_qty": 1, - "product_uom_id": self.product_1.uom_id.id, - "fsm_order_id": FSO.id, - "direction": "outbound", - "expected_date": datetime.datetime.now(), - "picking_policy": "direct", - }) + SR_1 = self.StockRequest.create( + { + "warehouse_id": FSO.warehouse_id.id, + "location_id": FSO.inventory_location_id.id, + "product_id": self.product_1.id, + "product_uom_qty": 1, + "product_uom_id": self.product_1.uom_id.id, + "fsm_order_id": FSO.id, + "direction": "outbound", + "expected_date": datetime.datetime.now(), + "picking_policy": "direct", + } + ) # After create the SR linked to FSO, validate a SRO # was created and linked to this FSO - SRO = self.StockRequestOrder.search([ - ("fsm_order_id", "=", FSO.id), - ("warehouse_id", "=", FSO.warehouse_id.id) - ]) + SRO = self.StockRequestOrder.search( + [("fsm_order_id", "=", FSO.id), ("warehouse_id", "=", FSO.warehouse_id.id)] + ) self.assertTrue(SRO) # Add a second SR to the FSO - SR_2 = self.StockRequest.create({ - "warehouse_id": FSO.warehouse_id.id, - "location_id": FSO.inventory_location_id.id, - "product_id": self.product_2.id, - "product_uom_qty": 4, - "product_uom_id": self.product_2.uom_id.id, - "fsm_order_id": FSO.id, - "direction": "outbound", - "expected_date": datetime.datetime.now(), - "picking_policy": "direct", - }) + SR_2 = self.StockRequest.create( + { + "warehouse_id": FSO.warehouse_id.id, + "location_id": FSO.inventory_location_id.id, + "product_id": self.product_2.id, + "product_uom_qty": 4, + "product_uom_id": self.product_2.uom_id.id, + "fsm_order_id": FSO.id, + "direction": "outbound", + "expected_date": datetime.datetime.now(), + "picking_policy": "direct", + } + ) # After create the 2nd SR linked to same FSO, validate # this SR is assigned to the same SRO self.assertEqual(SR_2.order_id, SRO) diff --git a/fieldservice_stock_request/views/fsm_order.xml b/fieldservice_stock_request/views/fsm_order.xml index c20d81cb33..d0db8d35b8 100644 --- a/fieldservice_stock_request/views/fsm_order.xml +++ b/fieldservice_stock_request/views/fsm_order.xml @@ -1,53 +1,69 @@ - fsm.order.form.stock.request fsm.order - +
-
- - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +
-
diff --git a/fieldservice_stock_request/views/stock.xml b/fieldservice_stock_request/views/stock.xml index 02ed9524df..ba7f7ec169 100644 --- a/fieldservice_stock_request/views/stock.xml +++ b/fieldservice_stock_request/views/stock.xml @@ -1,10 +1,10 @@ - - - + diff --git a/fieldservice_stock_request/views/stock_request.xml b/fieldservice_stock_request/views/stock_request.xml index efb67a0ce0..cafda5f190 100644 --- a/fieldservice_stock_request/views/stock_request.xml +++ b/fieldservice_stock_request/views/stock_request.xml @@ -1,23 +1,20 @@ - stock.request - + - + - stock.request - + - + - diff --git a/fieldservice_stock_request/views/stock_request_order.xml b/fieldservice_stock_request/views/stock_request_order.xml index b13d8b4b35..91a3bd1912 100644 --- a/fieldservice_stock_request/views/stock_request_order.xml +++ b/fieldservice_stock_request/views/stock_request_order.xml @@ -1,14 +1,13 @@ - stock.request.order - + - + - { + { 'default_fsm_order_id': fsm_order_id, 'default_expected_date': expected_date, 'default_picking_policy': picking_policy, @@ -19,35 +18,41 @@ 'default_company_id': company_id, 'default_state': state} - - + + - stock.request.order - + - + - stock.request.order - + - + - + - From 49629fa04d0839039d722f6b778b0b389307ca6f Mon Sep 17 00:00:00 2001 From: Reed Hayashikawa Date: Tue, 22 Jun 2021 11:41:58 -0700 Subject: [PATCH 07/54] [MIG] fieldservice_stock_request: Migration to 13.0 --- fieldservice_stock_request/README.rst | 8 ++++---- fieldservice_stock_request/__manifest__.py | 4 ++-- .../i18n/fieldservice_stock_request.pot | 2 +- fieldservice_stock_request/i18n/pt_BR.po | 2 +- fieldservice_stock_request/models/fsm_order.py | 5 +---- fieldservice_stock_request/models/stock_request.py | 1 - .../models/stock_request_order.py | 1 - .../static/description/index.html | 4 ++-- .../tests/test_fsm_stock_request.py | 13 ++++++++++++- .../views/stock_request_order.xml | 4 ++-- 10 files changed, 25 insertions(+), 19 deletions(-) diff --git a/fieldservice_stock_request/README.rst b/fieldservice_stock_request/README.rst index 769b79fe5e..c1c1a4dac6 100644 --- a/fieldservice_stock_request/README.rst +++ b/fieldservice_stock_request/README.rst @@ -14,13 +14,13 @@ Field Service - Stock Request :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/12.0/fieldservice_stock_request + :target: https://github.com/OCA/field-service/tree/13.0/fieldservice_stock_request :alt: OCA/field-service .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/field-service-12-0/field-service-12-0-fieldservice_stock_request + :target: https://translation.odoo-community.org/projects/field-service-13-0/field-service-13-0-fieldservice_stock_request :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/12.0 + :target: https://runbot.odoo-community.org/runbot/264/13.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -135,6 +135,6 @@ Current `maintainers `__: |maintainer-brian10048| |maintainer-wolfhall| |maintainer-max3903| |maintainer-smangukiya| -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_stock_request/__manifest__.py b/fieldservice_stock_request/__manifest__.py index 384686191d..fe4e91bcef 100644 --- a/fieldservice_stock_request/__manifest__.py +++ b/fieldservice_stock_request/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Field Service - Stock Request", "summary": "Integrate Stock Requests with Field Service Orders", - "version": "12.0.2.0.0", + "version": "13.0.1.0.0", "category": "Field Service", "author": "Open Source Integrators, " "Brian McMaster, " @@ -24,5 +24,5 @@ ], "license": "AGPL-3", "development_status": "Beta", - "maintainers": ["brian10048", "wolfhall", "max3903", "smangukiya",], + "maintainers": ["brian10048", "wolfhall", "max3903", "smangukiya"], } diff --git a/fieldservice_stock_request/i18n/fieldservice_stock_request.pot b/fieldservice_stock_request/i18n/fieldservice_stock_request.pot index 3d56b527f2..5442d033d8 100644 --- a/fieldservice_stock_request/i18n/fieldservice_stock_request.pot +++ b/fieldservice_stock_request/i18n/fieldservice_stock_request.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: <>\n" "Language-Team: \n" diff --git a/fieldservice_stock_request/i18n/pt_BR.po b/fieldservice_stock_request/i18n/pt_BR.po index 7d42e4a861..b34b83f5c9 100644 --- a/fieldservice_stock_request/i18n/pt_BR.po +++ b/fieldservice_stock_request/i18n/pt_BR.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" "PO-Revision-Date: 2021-03-15 05:45+0000\n" "Last-Translator: Marcel Savegnago \n" diff --git a/fieldservice_stock_request/models/fsm_order.py b/fieldservice_stock_request/models/fsm_order.py index 4716653ea9..4dda624f55 100644 --- a/fieldservice_stock_request/models/fsm_order.py +++ b/fieldservice_stock_request/models/fsm_order.py @@ -1,7 +1,7 @@ # Copyright (C) 2018 - TODAY, Brian McMaster # 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.exceptions import UserError REQUEST_STATES = [ @@ -27,7 +27,6 @@ class FSMOrder(models.Model): store=True, ) - @api.multi def action_request_submit(self): for rec in self: if not rec.stock_request_ids: @@ -40,7 +39,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: @@ -53,7 +51,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: diff --git a/fieldservice_stock_request/models/stock_request.py b/fieldservice_stock_request/models/stock_request.py index b62d9f63b1..43b102d40b 100644 --- a/fieldservice_stock_request/models/stock_request.py +++ b/fieldservice_stock_request/models/stock_request.py @@ -107,7 +107,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_request/models/stock_request_order.py b/fieldservice_stock_request/models/stock_request_order.py index 5d662d287a..53d26bcd75 100644 --- a/fieldservice_stock_request/models/stock_request_order.py +++ b/fieldservice_stock_request/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_request/static/description/index.html b/fieldservice_stock_request/static/description/index.html index 60bede5140..866955eb5d 100644 --- a/fieldservice_stock_request/static/description/index.html +++ b/fieldservice_stock_request/static/description/index.html @@ -367,7 +367,7 @@

Field Service - Stock Request

!! 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

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

Table of contents

@@ -465,7 +465,7 @@

Maintainers

promote its widespread use.

Current maintainers:

brian10048 wolfhall max3903 smangukiya

-

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_stock_request/tests/test_fsm_stock_request.py b/fieldservice_stock_request/tests/test_fsm_stock_request.py index 399528986f..f3e2452e00 100644 --- a/fieldservice_stock_request/tests/test_fsm_stock_request.py +++ b/fieldservice_stock_request/tests/test_fsm_stock_request.py @@ -16,6 +16,7 @@ def setUpClass(cls): # Setup for Stock Request cls.StockRequest = cls.env["stock.request"] cls.StockRequestOrder = cls.env["stock.request.order"] + cls.StockPickingType = cls.env["stock.picking.type"] cls.product_1 = cls.Product.create( { @@ -34,7 +35,17 @@ def setUpClass(cls): def test_fsm_order_stock_request(self): # Create a new FS Order and add to it some SR - FSO = self.FSMOrder.create({"location_id": self.fsm_location_1.id,}) + FSO = self.FSMOrder.create({"location_id": self.fsm_location_1.id}) + + self.StockPickingType.create( + { + "name": "Stock Request wh", + "sequence_id": self.env.ref("stock_request.seq_stock_request_order").id, + "code": "stock_request_order", + "sequence_code": "SRO", + "warehouse_id": FSO.warehouse_id.id, + } + ) SR_1 = self.StockRequest.create( { diff --git a/fieldservice_stock_request/views/stock_request_order.xml b/fieldservice_stock_request/views/stock_request_order.xml index 91a3bd1912..ad10c18e9c 100644 --- a/fieldservice_stock_request/views/stock_request_order.xml +++ b/fieldservice_stock_request/views/stock_request_order.xml @@ -39,13 +39,13 @@ stock.request.order - + Date: Mon, 28 Jun 2021 16:34:19 +0530 Subject: [PATCH 08/54] [MIG] fieldservice_stock_request: migrated the module into v14 --- fieldservice_stock_request/__init__.py | 2 +- fieldservice_stock_request/__manifest__.py | 4 +-- .../models/fsm_order.py | 36 ++++++++++--------- .../models/stock_move_line.py | 2 +- .../models/stock_request.py | 26 +++++++++----- .../models/stock_request_order.py | 15 ++++---- .../tests/test_fsm_stock_request.py | 8 ++--- 7 files changed, 54 insertions(+), 39 deletions(-) diff --git a/fieldservice_stock_request/__init__.py b/fieldservice_stock_request/__init__.py index da2feecfe9..e2a511ea6f 100644 --- a/fieldservice_stock_request/__init__.py +++ b/fieldservice_stock_request/__init__.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018 - TODAY, Brian McMaster +# Copyright (C) 2021 - TODAY, Brian McMaster # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import models diff --git a/fieldservice_stock_request/__manifest__.py b/fieldservice_stock_request/__manifest__.py index fe4e91bcef..34b54493d8 100644 --- a/fieldservice_stock_request/__manifest__.py +++ b/fieldservice_stock_request/__manifest__.py @@ -1,10 +1,10 @@ -# Copyright (C) 2018 - TODAY, Brian McMaster +# Copyright (C) 2021 - TODAY, Brian McMaster # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Field Service - Stock Request", "summary": "Integrate Stock Requests with Field Service Orders", - "version": "13.0.1.0.0", + "version": "14.0.1.0.0", "category": "Field Service", "author": "Open Source Integrators, " "Brian McMaster, " diff --git a/fieldservice_stock_request/models/fsm_order.py b/fieldservice_stock_request/models/fsm_order.py index 4dda624f55..4ac37bcd38 100644 --- a/fieldservice_stock_request/models/fsm_order.py +++ b/fieldservice_stock_request/models/fsm_order.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018 - TODAY, Brian McMaster +# Copyright (C) 2021 - TODAY, Brian McMaster # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import _, fields, models @@ -24,41 +24,45 @@ class FSMOrder(models.Model): string="Request State", default="draft", readonly=True, - store=True, ) def action_request_submit(self): for rec in self: if not rec.stock_request_ids: raise UserError(_("Please create a stock request.")) - for line in rec.stock_request_ids: - if line.state == "draft": + for line in rec.stock_request_ids.filtered(lambda l: l.state == "draft"): + if ("submitted", "Submitted") in line._get_request_states(): if line.order_id: line.order_id.action_submit() else: line.action_submit() + else: + if line.order_id: + line.order_id.action_confirm() + else: + line.action_confirm() rec.request_stage = "submitted" def action_request_cancel(self): for rec in self: if not rec.stock_request_ids: raise UserError(_("Please create a stock request.")) - for line in rec.stock_request_ids: - if line.state in ("draft", "submitted"): - if line.order_id: - line.order_id.action_cancel() - else: - line.action_cancel() + for line in rec.stock_request_ids.filtered( + lambda l: l.state in ("draft", "open") + ): + if line.order_id: + line.order_id.action_cancel() + else: + line.action_cancel() rec.request_stage = "cancel" def action_request_draft(self): for rec in self: if not rec.stock_request_ids: raise UserError(_("Please create a stock request.")) - for line in rec.stock_request_ids: - if line.state == "cancel": - if line.order_id: - line.order_id.action_draft() - else: - line.action_draft() + for line in rec.stock_request_ids.filtered(lambda l: l.state == "cancel"): + if line.order_id: + line.order_id.action_draft() + else: + line.action_draft() rec.request_stage = "draft" diff --git a/fieldservice_stock_request/models/stock_move_line.py b/fieldservice_stock_request/models/stock_move_line.py index 9c281c28a1..db5d950bdd 100644 --- a/fieldservice_stock_request/models/stock_move_line.py +++ b/fieldservice_stock_request/models/stock_move_line.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018 Open Source Integrators +# Copyright (C) 2021 Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import exceptions, models diff --git a/fieldservice_stock_request/models/stock_request.py b/fieldservice_stock_request/models/stock_request.py index 43b102d40b..84e5d32e27 100644 --- a/fieldservice_stock_request/models/stock_request.py +++ b/fieldservice_stock_request/models/stock_request.py @@ -1,5 +1,6 @@ -# Copyright (C) 2019 Open Source Integrators +# Copyright (C) 2021 Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + from odoo import _, api, fields, models from odoo.exceptions import UserError @@ -49,6 +50,14 @@ def create(self, vals): ], limit=1, ) + if not picking_type_id: + raise UserError( + _( + "There is no any inventory Operations Type:" + "stock_request_order record for %s Warehouse." + ) + % fsm_order.warehouse_id.display_name + ) order = self.env["stock.request.order"].search( [ ("fsm_order_id", "=", vals["fsm_order_id"]), @@ -102,17 +111,18 @@ def _prepare_procurement_values(self, group_id=False): def _prepare_procurement_group_values(self): if self.fsm_order_id: - order = self.env["fsm.order"].browse(self.fsm_order_id.id) - return {"name": order.name, "fsm_order_id": order.id, "move_type": "direct"} - else: - return {} + return { + "name": self.fsm_order_id.display_name, + "fsm_order_id": self.fsm_order_id.id, + "move_type": "direct", + } + return {} def _action_confirm(self): for req in self: if (not req.procurement_group_id) and req.fsm_order_id: - fsm_order = self.env["fsm.order"].browse(req.fsm_order_id.id) group = self.env["procurement.group"].search( - [("fsm_order_id", "=", fsm_order.id)] + [("fsm_order_id", "=", req.fsm_order_id.id)] ) if not group: values = req._prepare_procurement_group_values() @@ -121,7 +131,7 @@ def _action_confirm(self): req.order_id.procurement_group_id = group.id req.procurement_group_id = group.id res = super(StockRequest, req)._action_confirm() - fsm_order.request_stage = "open" + req.fsm_order_id.request_stage = "open" else: res = super(StockRequest, req)._action_confirm() return res diff --git a/fieldservice_stock_request/models/stock_request_order.py b/fieldservice_stock_request/models/stock_request_order.py index 53d26bcd75..782bab132a 100644 --- a/fieldservice_stock_request/models/stock_request_order.py +++ b/fieldservice_stock_request/models/stock_request_order.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Open Source Integrators +# Copyright (C) 2021 Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import api, fields, models @@ -33,16 +33,17 @@ def change_childs(self): def _prepare_procurement_group_values(self): if self.fsm_order_id: - order = self.env["fsm.order"].browse(self.fsm_order_id.id) - return {"name": order.name, "fsm_order_id": order.id, "move_type": "direct"} - else: - return {} + return { + "name": self.fsm_order_id.display_name, + "fsm_order_id": self.fsm_order_id.id, + "move_type": "direct", + } + return {} def action_confirm(self): if self.fsm_order_id: - fsm_order = self.env["fsm.order"].browse(self.fsm_order_id.id) group = self.env["procurement.group"].search( - [("fsm_order_id", "=", fsm_order.id)] + [("fsm_order_id", "=", self.fsm_order_id.id)] ) if not group: values = self._prepare_procurement_group_values() diff --git a/fieldservice_stock_request/tests/test_fsm_stock_request.py b/fieldservice_stock_request/tests/test_fsm_stock_request.py index f3e2452e00..3a8ed978ad 100644 --- a/fieldservice_stock_request/tests/test_fsm_stock_request.py +++ b/fieldservice_stock_request/tests/test_fsm_stock_request.py @@ -9,7 +9,7 @@ class TestFSMStockRequest(TestFSMStockCommon): @classmethod def setUpClass(cls): - super().setUpClass() + super(TestFSMStockRequest, cls).setUpClass() # disable tracking in test cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) @@ -88,9 +88,9 @@ def test_fsm_order_stock_request(self): # Submit the SRs from FSO. Confirm FSO request, SR & SRO are submitted FSO.action_request_submit() self.assertEqual(FSO.request_stage, "submitted") - self.assertEqual(SR_1.state, "submitted") - self.assertEqual(SR_2.state, "submitted") - self.assertEqual(SRO.state, "submitted") + self.assertEqual(SR_1.state, "open") + self.assertEqual(SR_2.state, "open") + self.assertEqual(SRO.state, "open") # Cancel the SRs from FSO. Confirm SR are cancelled FSO.action_request_cancel() From d6af05c17876ef860aaa5f173f135e53e3a9d177 Mon Sep 17 00:00:00 2001 From: Vimal Patel Date: Tue, 1 Mar 2022 18:51:59 +0530 Subject: [PATCH 09/54] [IMP]fieldservice_stock_request: once change direction on FSM order then change SRO data too --- fieldservice_stock_request/README.rst | 0 fieldservice_stock_request/__init__.py | 0 fieldservice_stock_request/__manifest__.py | 0 .../i18n/fieldservice_stock_request.pot | 0 fieldservice_stock_request/i18n/pt_BR.po | 0 fieldservice_stock_request/models/__init__.py | 0 .../models/fsm_order.py | 0 .../models/stock_move_line.py | 0 .../models/stock_request.py | 89 +++++++++++++++++- .../models/stock_request_order.py | 0 .../readme/CONFIGURE.rst | 0 .../readme/CONTRIBUTORS.rst | 0 fieldservice_stock_request/readme/CREDITS.rst | 0 .../readme/DESCRIPTION.rst | 0 fieldservice_stock_request/readme/ROADMAP.rst | 0 fieldservice_stock_request/readme/USAGE.rst | 0 .../security/ir.model.access.csv | 0 .../static/description/icon.png | Bin .../static/description/index.html | 0 fieldservice_stock_request/tests/__init__.py | 0 .../tests/test_fsm_stock_request.py | 0 .../views/fsm_order.xml | 2 +- fieldservice_stock_request/views/stock.xml | 0 .../views/stock_request.xml | 0 .../views/stock_request_order.xml | 0 25 files changed, 89 insertions(+), 2 deletions(-) mode change 100644 => 100755 fieldservice_stock_request/README.rst mode change 100644 => 100755 fieldservice_stock_request/__init__.py mode change 100644 => 100755 fieldservice_stock_request/__manifest__.py mode change 100644 => 100755 fieldservice_stock_request/i18n/fieldservice_stock_request.pot mode change 100644 => 100755 fieldservice_stock_request/i18n/pt_BR.po mode change 100644 => 100755 fieldservice_stock_request/models/__init__.py mode change 100644 => 100755 fieldservice_stock_request/models/fsm_order.py mode change 100644 => 100755 fieldservice_stock_request/models/stock_move_line.py mode change 100644 => 100755 fieldservice_stock_request/models/stock_request.py mode change 100644 => 100755 fieldservice_stock_request/models/stock_request_order.py mode change 100644 => 100755 fieldservice_stock_request/readme/CONFIGURE.rst mode change 100644 => 100755 fieldservice_stock_request/readme/CONTRIBUTORS.rst mode change 100644 => 100755 fieldservice_stock_request/readme/CREDITS.rst mode change 100644 => 100755 fieldservice_stock_request/readme/DESCRIPTION.rst mode change 100644 => 100755 fieldservice_stock_request/readme/ROADMAP.rst mode change 100644 => 100755 fieldservice_stock_request/readme/USAGE.rst mode change 100644 => 100755 fieldservice_stock_request/security/ir.model.access.csv mode change 100644 => 100755 fieldservice_stock_request/static/description/icon.png mode change 100644 => 100755 fieldservice_stock_request/static/description/index.html mode change 100644 => 100755 fieldservice_stock_request/tests/__init__.py mode change 100644 => 100755 fieldservice_stock_request/tests/test_fsm_stock_request.py mode change 100644 => 100755 fieldservice_stock_request/views/fsm_order.xml mode change 100644 => 100755 fieldservice_stock_request/views/stock.xml mode change 100644 => 100755 fieldservice_stock_request/views/stock_request.xml mode change 100644 => 100755 fieldservice_stock_request/views/stock_request_order.xml diff --git a/fieldservice_stock_request/README.rst b/fieldservice_stock_request/README.rst old mode 100644 new mode 100755 diff --git a/fieldservice_stock_request/__init__.py b/fieldservice_stock_request/__init__.py old mode 100644 new mode 100755 diff --git a/fieldservice_stock_request/__manifest__.py b/fieldservice_stock_request/__manifest__.py old mode 100644 new mode 100755 diff --git a/fieldservice_stock_request/i18n/fieldservice_stock_request.pot b/fieldservice_stock_request/i18n/fieldservice_stock_request.pot old mode 100644 new mode 100755 diff --git a/fieldservice_stock_request/i18n/pt_BR.po b/fieldservice_stock_request/i18n/pt_BR.po old mode 100644 new mode 100755 diff --git a/fieldservice_stock_request/models/__init__.py b/fieldservice_stock_request/models/__init__.py old mode 100644 new mode 100755 diff --git a/fieldservice_stock_request/models/fsm_order.py b/fieldservice_stock_request/models/fsm_order.py old mode 100644 new mode 100755 diff --git a/fieldservice_stock_request/models/stock_move_line.py b/fieldservice_stock_request/models/stock_move_line.py old mode 100644 new mode 100755 diff --git a/fieldservice_stock_request/models/stock_request.py b/fieldservice_stock_request/models/stock_request.py old mode 100644 new mode 100755 index 84e5d32e27..0e6fbf856a --- a/fieldservice_stock_request/models/stock_request.py +++ b/fieldservice_stock_request/models/stock_request.py @@ -12,6 +12,27 @@ class StockRequest(models.Model): "fsm.order", string="FSM Order", ondelete="cascade", index=True, copy=False ) + def _update_stock_request_order_data(self): + if self.order_id and self.direction and self.state == "draft": + picking_type_id = self.env["stock.picking.type"].search( + [ + ("code", "=", "stock_request_order"), + ("warehouse_id", "=", self.warehouse_id.id), + ], + limit=1, + ) + order = self.env["stock.request.order"].search( + [ + ("fsm_order_id", "=", self.fsm_order_id.id), + ("warehouse_id", "=", self.warehouse_id.id), + ("picking_type_id", "=", picking_type_id.id), + ("direction", "=", self.direction), + ("state", "=", "draft"), + ], + order="id asc", + ) + self.order_id = order.id + @api.onchange("direction", "fsm_order_id") def _onchange_location_id(self): super()._onchange_location_id() @@ -22,8 +43,18 @@ def _onchange_location_id(self): self.fsm_order_id.location_id.inventory_location_id.id ) else: - # Otherwise the stock location of the warehouse self.location_id = self.fsm_order_id.warehouse_id.lot_stock_id.id + self._update_stock_request_order_data() + + def prepare_stock_request_order_values(self): + res = { + "expected_date": self.expected_date, + "picking_policy": self.picking_policy, + "warehouse_id": self.warehouse_id.id, + "direction": self.direction, + "location_id": self.location_id.id, + } + return res def prepare_order_values(self, vals): res = { @@ -97,6 +128,62 @@ def create(self, vals): vals["order_id"] = order.id return super().create(vals) + def write(self, vals): + for stock_req in self: + if "direction" in vals: + picking_type_id = self.env["stock.picking.type"].search( + [ + ("code", "=", "stock_request_order"), + ("warehouse_id", "=", stock_req.warehouse_id.id), + ], + limit=1, + ) + order = self.env["stock.request.order"].search( + [ + ("fsm_order_id", "=", stock_req.fsm_order_id.id), + ("warehouse_id", "=", stock_req.warehouse_id.id), + ("picking_type_id", "=", picking_type_id.id), + ("direction", "=", vals["direction"]), + ("state", "=", "draft"), + ], + order="id asc", + ) + # User created a new SRO Manually + if len(order) > 1: + raise UserError( + _( + "There is already a Stock Request Order \ + with the same Field Service Order and \ + Warehouse that is in Draft state. Please \ + add this Stock Request there. \ + (%s)" + ) + % order[0].name + ) + # FSO: Update Values into it. + elif order: + values = stock_req.prepare_stock_request_order_values() + values.update( + { + "direction": vals["direction"], + "location_id": vals["location_id"], + } + ) + order.write(values) + vals["order_id"] = order.id + # Create SRO If not found then. + elif not order: + values = stock_req.prepare_stock_request_order_values() + values.update( + { + "direction": vals["direction"], + "location_id": vals["location_id"], + } + ) + vals["order_id"] = self.env["stock.request.order"].create(values).id + + return super().write(vals) + def _prepare_procurement_values(self, group_id=False): res = super()._prepare_procurement_values(group_id=group_id) if self.fsm_order_id: diff --git a/fieldservice_stock_request/models/stock_request_order.py b/fieldservice_stock_request/models/stock_request_order.py old mode 100644 new mode 100755 diff --git a/fieldservice_stock_request/readme/CONFIGURE.rst b/fieldservice_stock_request/readme/CONFIGURE.rst old mode 100644 new mode 100755 diff --git a/fieldservice_stock_request/readme/CONTRIBUTORS.rst b/fieldservice_stock_request/readme/CONTRIBUTORS.rst old mode 100644 new mode 100755 diff --git a/fieldservice_stock_request/readme/CREDITS.rst b/fieldservice_stock_request/readme/CREDITS.rst old mode 100644 new mode 100755 diff --git a/fieldservice_stock_request/readme/DESCRIPTION.rst b/fieldservice_stock_request/readme/DESCRIPTION.rst old mode 100644 new mode 100755 diff --git a/fieldservice_stock_request/readme/ROADMAP.rst b/fieldservice_stock_request/readme/ROADMAP.rst old mode 100644 new mode 100755 diff --git a/fieldservice_stock_request/readme/USAGE.rst b/fieldservice_stock_request/readme/USAGE.rst old mode 100644 new mode 100755 diff --git a/fieldservice_stock_request/security/ir.model.access.csv b/fieldservice_stock_request/security/ir.model.access.csv old mode 100644 new mode 100755 diff --git a/fieldservice_stock_request/static/description/icon.png b/fieldservice_stock_request/static/description/icon.png old mode 100644 new mode 100755 diff --git a/fieldservice_stock_request/static/description/index.html b/fieldservice_stock_request/static/description/index.html old mode 100644 new mode 100755 diff --git a/fieldservice_stock_request/tests/__init__.py b/fieldservice_stock_request/tests/__init__.py old mode 100644 new mode 100755 diff --git a/fieldservice_stock_request/tests/test_fsm_stock_request.py b/fieldservice_stock_request/tests/test_fsm_stock_request.py old mode 100644 new mode 100755 diff --git a/fieldservice_stock_request/views/fsm_order.xml b/fieldservice_stock_request/views/fsm_order.xml old mode 100644 new mode 100755 index d0db8d35b8..51382ace6d --- a/fieldservice_stock_request/views/fsm_order.xml +++ b/fieldservice_stock_request/views/fsm_order.xml @@ -37,7 +37,7 @@ - + Date: Tue, 1 Mar 2022 10:51:49 -0700 Subject: [PATCH 10/54] Update stock_request.py --- fieldservice_stock_request/models/stock_request.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fieldservice_stock_request/models/stock_request.py b/fieldservice_stock_request/models/stock_request.py index 0e6fbf856a..170b0ad1f9 100755 --- a/fieldservice_stock_request/models/stock_request.py +++ b/fieldservice_stock_request/models/stock_request.py @@ -121,6 +121,8 @@ def create(self, vals): "warehouse_id": vals["warehouse_id"], } ) + if values["direction"] == "inbound": + values.update({"location_id": self.env["stock.warehouse"].browse(vals["warehouse_id"]).lot_stock_id.id}) vals["order_id"] = self.env["stock.request.order"].create(values).id # There is an SRO made from FSO, assign here elif len(order) == 1 and vals.get("fsm_order_id"): From 472fcb18083f515d7f45929e8a77b28d963d51cc Mon Sep 17 00:00:00 2001 From: Steve Campbell Date: Tue, 1 Mar 2022 12:30:18 -0700 Subject: [PATCH 11/54] Update stock_request.py --- .../models/stock_request.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fieldservice_stock_request/models/stock_request.py b/fieldservice_stock_request/models/stock_request.py index 170b0ad1f9..4339539dcf 100755 --- a/fieldservice_stock_request/models/stock_request.py +++ b/fieldservice_stock_request/models/stock_request.py @@ -176,14 +176,14 @@ def write(self, vals): # Create SRO If not found then. elif not order: values = stock_req.prepare_stock_request_order_values() - values.update( - { - "direction": vals["direction"], - "location_id": vals["location_id"], - } - ) - vals["order_id"] = self.env["stock.request.order"].create(values).id - + if vals.get("direction", False) and vals.get("location_id", False): + values.update( + { + "direction": vals["direction"], + "location_id": vals["location_id"], + } + ) + vals["order_id"] = self.env["stock.request.order"].create(values).id return super().write(vals) def _prepare_procurement_values(self, group_id=False): From 494ca56a55c4e71fb6e7520c65a0fa7f4915ed84 Mon Sep 17 00:00:00 2001 From: Vimal Patel Date: Wed, 2 Mar 2022 18:27:52 +0530 Subject: [PATCH 12/54] [IMP]fieldservice_stock_request: Can't set Expected Date on Inventory line on FO --- .../models/stock_request.py | 55 ++++++++++++++++--- 1 file changed, 47 insertions(+), 8 deletions(-) diff --git a/fieldservice_stock_request/models/stock_request.py b/fieldservice_stock_request/models/stock_request.py index 4339539dcf..75547c3ac1 100755 --- a/fieldservice_stock_request/models/stock_request.py +++ b/fieldservice_stock_request/models/stock_request.py @@ -122,7 +122,13 @@ def create(self, vals): } ) if values["direction"] == "inbound": - values.update({"location_id": self.env["stock.warehouse"].browse(vals["warehouse_id"]).lot_stock_id.id}) + values.update( + { + "location_id": self.env["stock.warehouse"] + .browse(vals["warehouse_id"]) + .lot_stock_id.id + } + ) vals["order_id"] = self.env["stock.request.order"].create(values).id # There is an SRO made from FSO, assign here elif len(order) == 1 and vals.get("fsm_order_id"): @@ -132,7 +138,10 @@ def create(self, vals): def write(self, vals): for stock_req in self: - if "direction" in vals: + if "direction" in vals or "expected_date" in vals: + direction = vals.get("direction") + if "direction" not in vals: + direction = stock_req.direction picking_type_id = self.env["stock.picking.type"].search( [ ("code", "=", "stock_request_order"), @@ -140,12 +149,26 @@ def write(self, vals): ], limit=1, ) + if stock_req.fsm_order_id: + order = self.env["stock.request.order"].search( + [ + ("fsm_order_id", "=", stock_req.fsm_order_id.id), + ("warehouse_id", "=", stock_req.warehouse_id.id), + ("picking_type_id", "=", picking_type_id.id), + ("direction", "=", direction), + ("state", "=", "draft"), + ], + order="id asc", + ) + else: + order = stock_req.order_id + order = self.env["stock.request.order"].search( [ ("fsm_order_id", "=", stock_req.fsm_order_id.id), ("warehouse_id", "=", stock_req.warehouse_id.id), ("picking_type_id", "=", picking_type_id.id), - ("direction", "=", vals["direction"]), + ("direction", "=", direction), ("state", "=", "draft"), ], order="id asc", @@ -167,8 +190,11 @@ def write(self, vals): values = stock_req.prepare_stock_request_order_values() values.update( { - "direction": vals["direction"], - "location_id": vals["location_id"], + "direction": vals.get("direction") or stock_req.direction, + "location_id": vals.get("location_id") + or stock_req.location_id.id, + "expected_date": vals.get("expected_date") + or stock_req.expected_date, } ) order.write(values) @@ -179,11 +205,24 @@ def write(self, vals): if vals.get("direction", False) and vals.get("location_id", False): values.update( { - "direction": vals["direction"], - "location_id": vals["location_id"], + "direction": vals.get("direction") + or stock_req.direction, + "location_id": vals.get("location_id") + or stock_req.location_id.id, + "expected_date": vals.get("expected_date") + or stock_req.expected_date, } ) - vals["order_id"] = self.env["stock.request.order"].create(values).id + elif vals.get("expected_date", False): + values.update( + { + "expected_date": vals.get("expected_date") + or stock_req.expected_date, + } + ) + + vals["order_id"] = self.env["stock.request.order"].create(values).id + return super().write(vals) def _prepare_procurement_values(self, group_id=False): From 5abe2e41f999dda0dc5f2b20b9dd3b6373ca997d Mon Sep 17 00:00:00 2001 From: Steve Campbell Date: Wed, 9 Mar 2022 08:48:09 -0700 Subject: [PATCH 13/54] Update fsm_order.xml --- fieldservice_stock_request/views/fsm_order.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fieldservice_stock_request/views/fsm_order.xml b/fieldservice_stock_request/views/fsm_order.xml index 51382ace6d..9eeac3c10d 100755 --- a/fieldservice_stock_request/views/fsm_order.xml +++ b/fieldservice_stock_request/views/fsm_order.xml @@ -57,7 +57,7 @@ - + From 2a79b88503045e1c29cd981d722bef99f67d6295 Mon Sep 17 00:00:00 2001 From: Steve Campbell Date: Wed, 9 Mar 2022 08:49:36 -0700 Subject: [PATCH 14/54] Update stock_request.py --- .../models/stock_request.py | 170 +++++++++--------- 1 file changed, 85 insertions(+), 85 deletions(-) diff --git a/fieldservice_stock_request/models/stock_request.py b/fieldservice_stock_request/models/stock_request.py index 75547c3ac1..0e5326ae18 100755 --- a/fieldservice_stock_request/models/stock_request.py +++ b/fieldservice_stock_request/models/stock_request.py @@ -136,94 +136,94 @@ def create(self, vals): vals["order_id"] = order.id return super().create(vals) - def write(self, vals): - for stock_req in self: - if "direction" in vals or "expected_date" in vals: - direction = vals.get("direction") - if "direction" not in vals: - direction = stock_req.direction - picking_type_id = self.env["stock.picking.type"].search( - [ - ("code", "=", "stock_request_order"), - ("warehouse_id", "=", stock_req.warehouse_id.id), - ], - limit=1, - ) - if stock_req.fsm_order_id: - order = self.env["stock.request.order"].search( - [ - ("fsm_order_id", "=", stock_req.fsm_order_id.id), - ("warehouse_id", "=", stock_req.warehouse_id.id), - ("picking_type_id", "=", picking_type_id.id), - ("direction", "=", direction), - ("state", "=", "draft"), - ], - order="id asc", - ) - else: - order = stock_req.order_id +# def write(self, vals): +# for stock_req in self: +# if "direction" in vals or "expected_date" in vals: +# direction = vals.get("direction") +# if "direction" not in vals: +# direction = stock_req.direction +# picking_type_id = self.env["stock.picking.type"].search( +# [ +# ("code", "=", "stock_request_order"), +# ("warehouse_id", "=", stock_req.warehouse_id.id), +# ], +# limit=1, +# ) +# if stock_req.fsm_order_id: +# order = self.env["stock.request.order"].search( +# [ +# ("fsm_order_id", "=", stock_req.fsm_order_id.id), +# ("warehouse_id", "=", stock_req.warehouse_id.id), +# ("picking_type_id", "=", picking_type_id.id), +# ("direction", "=", direction), +# ("state", "=", "draft"), +# ], +# order="id asc", +# ) +# else: +# order = stock_req.order_id - order = self.env["stock.request.order"].search( - [ - ("fsm_order_id", "=", stock_req.fsm_order_id.id), - ("warehouse_id", "=", stock_req.warehouse_id.id), - ("picking_type_id", "=", picking_type_id.id), - ("direction", "=", direction), - ("state", "=", "draft"), - ], - order="id asc", - ) - # User created a new SRO Manually - if len(order) > 1: - raise UserError( - _( - "There is already a Stock Request Order \ - with the same Field Service Order and \ - Warehouse that is in Draft state. Please \ - add this Stock Request there. \ - (%s)" - ) - % order[0].name - ) - # FSO: Update Values into it. - elif order: - values = stock_req.prepare_stock_request_order_values() - values.update( - { - "direction": vals.get("direction") or stock_req.direction, - "location_id": vals.get("location_id") - or stock_req.location_id.id, - "expected_date": vals.get("expected_date") - or stock_req.expected_date, - } - ) - order.write(values) - vals["order_id"] = order.id - # Create SRO If not found then. - elif not order: - values = stock_req.prepare_stock_request_order_values() - if vals.get("direction", False) and vals.get("location_id", False): - values.update( - { - "direction": vals.get("direction") - or stock_req.direction, - "location_id": vals.get("location_id") - or stock_req.location_id.id, - "expected_date": vals.get("expected_date") - or stock_req.expected_date, - } - ) - elif vals.get("expected_date", False): - values.update( - { - "expected_date": vals.get("expected_date") - or stock_req.expected_date, - } - ) +# order = self.env["stock.request.order"].search( +# [ +# ("fsm_order_id", "=", stock_req.fsm_order_id.id), +# ("warehouse_id", "=", stock_req.warehouse_id.id), +# ("picking_type_id", "=", picking_type_id.id), +# ("direction", "=", direction), +# ("state", "=", "draft"), +# ], +# order="id asc", +# ) +# # User created a new SRO Manually +# if len(order) > 1: +# raise UserError( +# _( +# "There is already a Stock Request Order \ +# with the same Field Service Order and \ +# Warehouse that is in Draft state. Please \ +# add this Stock Request there. \ +# (%s)" +# ) +# % order[0].name +# ) +# # FSO: Update Values into it. +# elif order: +# values = stock_req.prepare_stock_request_order_values() +# values.update( +# { +# "direction": vals.get("direction") or stock_req.direction, +# "location_id": vals.get("location_id") +# or stock_req.location_id.id, +# "expected_date": vals.get("expected_date") +# or stock_req.expected_date, +# } +# ) +# order.write(values) +# vals["order_id"] = order.id +# # Create SRO If not found then. +# elif not order: +# values = stock_req.prepare_stock_request_order_values() +# if vals.get("direction", False) and vals.get("location_id", False): +# values.update( +# { +# "direction": vals.get("direction") +# or stock_req.direction, +# "location_id": vals.get("location_id") +# or stock_req.location_id.id, +# "expected_date": vals.get("expected_date") +# or stock_req.expected_date, +# } +# ) +# elif vals.get("expected_date", False): +# values.update( +# { +# "expected_date": vals.get("expected_date") +# or stock_req.expected_date, +# } +# ) - vals["order_id"] = self.env["stock.request.order"].create(values).id +# vals["order_id"] = self.env["stock.request.order"].create(values).id - return super().write(vals) +# return super().write(vals) def _prepare_procurement_values(self, group_id=False): res = super()._prepare_procurement_values(group_id=group_id) From 92e21b0bc23b6eee54c5db86f57daff3d5080063 Mon Sep 17 00:00:00 2001 From: Freni-OSI Date: Thu, 3 Nov 2022 14:51:54 +0530 Subject: [PATCH 15/54] [IMP] Tests --- fieldservice_stock_request/README.rst | 0 fieldservice_stock_request/__init__.py | 0 fieldservice_stock_request/__manifest__.py | 1 + .../i18n/fieldservice_stock_request.pot | 0 fieldservice_stock_request/i18n/pt_BR.po | 0 fieldservice_stock_request/models/__init__.py | 0 .../models/fsm_order.py | 9 +- .../models/stock_move_line.py | 0 .../models/stock_request.py | 91 +--- .../models/stock_request_order.py | 0 .../readme/CONFIGURE.rst | 0 .../readme/CONTRIBUTORS.rst | 0 fieldservice_stock_request/readme/CREDITS.rst | 0 .../readme/DESCRIPTION.rst | 0 fieldservice_stock_request/readme/ROADMAP.rst | 0 fieldservice_stock_request/readme/USAGE.rst | 0 .../security/ir.model.access.csv | 0 fieldservice_stock_request/tests/__init__.py | 0 .../tests/test_fsm_stock_request.py | 415 +++++++++++++++++- .../views/fsm_order.xml | 0 fieldservice_stock_request/views/stock.xml | 0 .../views/stock_request.xml | 0 .../views/stock_request_order.xml | 0 23 files changed, 397 insertions(+), 119 deletions(-) mode change 100755 => 100644 fieldservice_stock_request/README.rst mode change 100755 => 100644 fieldservice_stock_request/__init__.py mode change 100755 => 100644 fieldservice_stock_request/__manifest__.py mode change 100755 => 100644 fieldservice_stock_request/i18n/fieldservice_stock_request.pot mode change 100755 => 100644 fieldservice_stock_request/i18n/pt_BR.po mode change 100755 => 100644 fieldservice_stock_request/models/__init__.py mode change 100755 => 100644 fieldservice_stock_request/models/fsm_order.py mode change 100755 => 100644 fieldservice_stock_request/models/stock_move_line.py mode change 100755 => 100644 fieldservice_stock_request/models/stock_request.py mode change 100755 => 100644 fieldservice_stock_request/models/stock_request_order.py mode change 100755 => 100644 fieldservice_stock_request/readme/CONFIGURE.rst mode change 100755 => 100644 fieldservice_stock_request/readme/CONTRIBUTORS.rst mode change 100755 => 100644 fieldservice_stock_request/readme/CREDITS.rst mode change 100755 => 100644 fieldservice_stock_request/readme/DESCRIPTION.rst mode change 100755 => 100644 fieldservice_stock_request/readme/ROADMAP.rst mode change 100755 => 100644 fieldservice_stock_request/readme/USAGE.rst mode change 100755 => 100644 fieldservice_stock_request/security/ir.model.access.csv mode change 100755 => 100644 fieldservice_stock_request/tests/__init__.py mode change 100755 => 100644 fieldservice_stock_request/tests/test_fsm_stock_request.py mode change 100755 => 100644 fieldservice_stock_request/views/fsm_order.xml mode change 100755 => 100644 fieldservice_stock_request/views/stock.xml mode change 100755 => 100644 fieldservice_stock_request/views/stock_request.xml mode change 100755 => 100644 fieldservice_stock_request/views/stock_request_order.xml diff --git a/fieldservice_stock_request/README.rst b/fieldservice_stock_request/README.rst old mode 100755 new mode 100644 diff --git a/fieldservice_stock_request/__init__.py b/fieldservice_stock_request/__init__.py old mode 100755 new mode 100644 diff --git a/fieldservice_stock_request/__manifest__.py b/fieldservice_stock_request/__manifest__.py old mode 100755 new mode 100644 index 34b54493d8..0893b264b4 --- a/fieldservice_stock_request/__manifest__.py +++ b/fieldservice_stock_request/__manifest__.py @@ -14,6 +14,7 @@ "fieldservice_stock", "stock_request_direction", "stock_request_picking_type", + "stock_request_submit", ], "data": [ "security/ir.model.access.csv", diff --git a/fieldservice_stock_request/i18n/fieldservice_stock_request.pot b/fieldservice_stock_request/i18n/fieldservice_stock_request.pot old mode 100755 new mode 100644 diff --git a/fieldservice_stock_request/i18n/pt_BR.po b/fieldservice_stock_request/i18n/pt_BR.po old mode 100755 new mode 100644 diff --git a/fieldservice_stock_request/models/__init__.py b/fieldservice_stock_request/models/__init__.py old mode 100755 new mode 100644 diff --git a/fieldservice_stock_request/models/fsm_order.py b/fieldservice_stock_request/models/fsm_order.py old mode 100755 new mode 100644 index 4ac37bcd38..83fe763110 --- a/fieldservice_stock_request/models/fsm_order.py +++ b/fieldservice_stock_request/models/fsm_order.py @@ -30,17 +30,12 @@ def action_request_submit(self): for rec in self: if not rec.stock_request_ids: raise UserError(_("Please create a stock request.")) - for line in rec.stock_request_ids.filtered(lambda l: l.state == "draft"): - if ("submitted", "Submitted") in line._get_request_states(): + for line in rec.stock_request_ids: + if line.state == "draft": if line.order_id: line.order_id.action_submit() else: line.action_submit() - else: - if line.order_id: - line.order_id.action_confirm() - else: - line.action_confirm() rec.request_stage = "submitted" def action_request_cancel(self): diff --git a/fieldservice_stock_request/models/stock_move_line.py b/fieldservice_stock_request/models/stock_move_line.py old mode 100755 new mode 100644 diff --git a/fieldservice_stock_request/models/stock_request.py b/fieldservice_stock_request/models/stock_request.py old mode 100755 new mode 100644 index 0e5326ae18..0a0694ec38 --- a/fieldservice_stock_request/models/stock_request.py +++ b/fieldservice_stock_request/models/stock_request.py @@ -136,95 +136,6 @@ def create(self, vals): vals["order_id"] = order.id return super().create(vals) -# def write(self, vals): -# for stock_req in self: -# if "direction" in vals or "expected_date" in vals: -# direction = vals.get("direction") -# if "direction" not in vals: -# direction = stock_req.direction -# picking_type_id = self.env["stock.picking.type"].search( -# [ -# ("code", "=", "stock_request_order"), -# ("warehouse_id", "=", stock_req.warehouse_id.id), -# ], -# limit=1, -# ) -# if stock_req.fsm_order_id: -# order = self.env["stock.request.order"].search( -# [ -# ("fsm_order_id", "=", stock_req.fsm_order_id.id), -# ("warehouse_id", "=", stock_req.warehouse_id.id), -# ("picking_type_id", "=", picking_type_id.id), -# ("direction", "=", direction), -# ("state", "=", "draft"), -# ], -# order="id asc", -# ) -# else: -# order = stock_req.order_id - -# order = self.env["stock.request.order"].search( -# [ -# ("fsm_order_id", "=", stock_req.fsm_order_id.id), -# ("warehouse_id", "=", stock_req.warehouse_id.id), -# ("picking_type_id", "=", picking_type_id.id), -# ("direction", "=", direction), -# ("state", "=", "draft"), -# ], -# order="id asc", -# ) -# # User created a new SRO Manually -# if len(order) > 1: -# raise UserError( -# _( -# "There is already a Stock Request Order \ -# with the same Field Service Order and \ -# Warehouse that is in Draft state. Please \ -# add this Stock Request there. \ -# (%s)" -# ) -# % order[0].name -# ) -# # FSO: Update Values into it. -# elif order: -# values = stock_req.prepare_stock_request_order_values() -# values.update( -# { -# "direction": vals.get("direction") or stock_req.direction, -# "location_id": vals.get("location_id") -# or stock_req.location_id.id, -# "expected_date": vals.get("expected_date") -# or stock_req.expected_date, -# } -# ) -# order.write(values) -# vals["order_id"] = order.id -# # Create SRO If not found then. -# elif not order: -# values = stock_req.prepare_stock_request_order_values() -# if vals.get("direction", False) and vals.get("location_id", False): -# values.update( -# { -# "direction": vals.get("direction") -# or stock_req.direction, -# "location_id": vals.get("location_id") -# or stock_req.location_id.id, -# "expected_date": vals.get("expected_date") -# or stock_req.expected_date, -# } -# ) -# elif vals.get("expected_date", False): -# values.update( -# { -# "expected_date": vals.get("expected_date") -# or stock_req.expected_date, -# } -# ) - -# vals["order_id"] = self.env["stock.request.order"].create(values).id - -# return super().write(vals) - def _prepare_procurement_values(self, group_id=False): res = super()._prepare_procurement_values(group_id=group_id) if self.fsm_order_id: @@ -262,4 +173,4 @@ def _action_confirm(self): req.fsm_order_id.request_stage = "open" else: res = super(StockRequest, req)._action_confirm() - return res + return res diff --git a/fieldservice_stock_request/models/stock_request_order.py b/fieldservice_stock_request/models/stock_request_order.py old mode 100755 new mode 100644 diff --git a/fieldservice_stock_request/readme/CONFIGURE.rst b/fieldservice_stock_request/readme/CONFIGURE.rst old mode 100755 new mode 100644 diff --git a/fieldservice_stock_request/readme/CONTRIBUTORS.rst b/fieldservice_stock_request/readme/CONTRIBUTORS.rst old mode 100755 new mode 100644 diff --git a/fieldservice_stock_request/readme/CREDITS.rst b/fieldservice_stock_request/readme/CREDITS.rst old mode 100755 new mode 100644 diff --git a/fieldservice_stock_request/readme/DESCRIPTION.rst b/fieldservice_stock_request/readme/DESCRIPTION.rst old mode 100755 new mode 100644 diff --git a/fieldservice_stock_request/readme/ROADMAP.rst b/fieldservice_stock_request/readme/ROADMAP.rst old mode 100755 new mode 100644 diff --git a/fieldservice_stock_request/readme/USAGE.rst b/fieldservice_stock_request/readme/USAGE.rst old mode 100755 new mode 100644 diff --git a/fieldservice_stock_request/security/ir.model.access.csv b/fieldservice_stock_request/security/ir.model.access.csv old mode 100755 new mode 100644 diff --git a/fieldservice_stock_request/tests/__init__.py b/fieldservice_stock_request/tests/__init__.py old mode 100755 new mode 100644 diff --git a/fieldservice_stock_request/tests/test_fsm_stock_request.py b/fieldservice_stock_request/tests/test_fsm_stock_request.py old mode 100755 new mode 100644 index 3a8ed978ad..65a236db1d --- a/fieldservice_stock_request/tests/test_fsm_stock_request.py +++ b/fieldservice_stock_request/tests/test_fsm_stock_request.py @@ -3,39 +3,138 @@ import datetime -from odoo.addons.fieldservice_stock.tests.common import TestFSMStockCommon +from odoo import fields +from odoo.exceptions import UserError + +from odoo.addons.fieldservice_stock.tests.test_fsm_stock import TestFSMStockCommon class TestFSMStockRequest(TestFSMStockCommon): - @classmethod - def setUpClass(cls): - super(TestFSMStockRequest, cls).setUpClass() + def setUp(self): + super(TestFSMStockRequest, self).setUp() # disable tracking in test - cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) - + self.env = self.env(context=dict(self.env.context, tracking_disable=True)) # Setup for Stock Request - cls.StockRequest = cls.env["stock.request"] - cls.StockRequestOrder = cls.env["stock.request.order"] - cls.StockPickingType = cls.env["stock.picking.type"] + self.StockRequest = self.env["stock.request"] + self.StockRequestOrder = self.env["stock.request.order"] + self.StockPickingType = self.env["stock.picking.type"] - cls.product_1 = cls.Product.create( + self.product_1 = self.Product.create( { "name": "Product 1", "type": "product", - "categ_id": cls.env.ref("product.product_category_all").id, + "categ_id": self.env.ref("product.product_category_all").id, } ) - cls.product_2 = cls.Product.create( + self.product_2 = self.Product.create( { "name": "Product 2", "type": "product", - "categ_id": cls.env.ref("product.product_category_all").id, + "categ_id": self.env.ref("product.product_category_all").id, + } + ) + self.warehouse = self.env["stock.warehouse"].search( + [("company_id", "=", self.env.user.company_id.id)], limit=1 + ) + self.route = self.env["stock.location.route"].create( + { + "name": "Transfer", + "product_categ_selectable": False, + "product_selectable": True, + "company_id": self.env.user.company_id.id, + "sequence": 10, + "rule_ids": [ + ( + 0, + 0, + { + "name": "Stock -> output rule", + "action": "pull", + "picking_type_id": self.ref("stock.picking_type_out"), + "location_src_id": self.ref("stock.stock_location_stock"), + "location_id": self.ref("stock.stock_location_customers"), + }, + ), + ( + 0, + 0, + { + "name": "Stock -> output rule", + "action": "pull", + "picking_type_id": self.ref("stock.picking_type_out"), + "location_src_id": self.warehouse.lot_stock_id.id, + "location_id": self.ref("stock.stock_location_customers"), + }, + ), + ], } ) + self.ressuply_loc = self.env["stock.location"].create( + { + "name": "Ressuply", + "location_id": self.warehouse.view_location_id.id, + "usage": "internal", + "company_id": self.env.user.company_id.id, + } + ) + self.stock_request_user_group = self.env.ref( + "stock_request.group_stock_request_user" + ) + self.fsm_dispatcher_group = self.env.ref("fieldservice.group_fsm_dispatcher") + self.group_stock_request_manager = self.env.ref( + "stock_request.group_stock_request_manager" + ) + self.stock_request_user = ( + self.env["res.users"] + .with_context({"no_reset_password": True}) + .create( + { + "name": "stock_request_user1", + "password": "demo", + "login": "stock_request_user1", + "email": "@".join(["stock_request_user", "test.com"]), + "groups_id": [ + ( + 6, + 0, + [ + self.stock_request_user_group.id, + self.fsm_dispatcher_group.id, + ], + ) + ], + "company_ids": [(6, 0, [self.env.user.company_id.id])], + } + ) + ) + self.stock_request_manager = ( + self.env["res.users"] + .with_context({"no_reset_password": True}) + .create( + { + "name": "stock_request_manager1", + "password": "demo", + "login": "stock_request_manager1", + "email": "@".join(["stock_request_user", "test.com"]), + "groups_id": [ + ( + 6, + 0, + [ + self.fsm_dispatcher_group.id, + self.group_stock_request_manager.id, + ], + ) + ], + "company_ids": [(6, 0, [self.env.user.company_id.id])], + } + ) + ) def test_fsm_order_stock_request(self): # Create a new FS Order and add to it some SR - FSO = self.FSMOrder.create({"location_id": self.fsm_location_1.id}) + FSO = self.FSMOrder.create({"location_id": self.test_location.id}) + fsm_order = self.FSMOrder.create({"location_id": self.test_location.id}) self.StockPickingType.create( { @@ -46,7 +145,6 @@ def test_fsm_order_stock_request(self): "warehouse_id": FSO.warehouse_id.id, } ) - SR_1 = self.StockRequest.create( { "warehouse_id": FSO.warehouse_id.id, @@ -66,6 +164,7 @@ def test_fsm_order_stock_request(self): [("fsm_order_id", "=", FSO.id), ("warehouse_id", "=", FSO.warehouse_id.id)] ) self.assertTrue(SRO) + SRO._onchange_location_id() # Add a second SR to the FSO SR_2 = self.StockRequest.create( @@ -84,13 +183,8 @@ def test_fsm_order_stock_request(self): # After create the 2nd SR linked to same FSO, validate # this SR is assigned to the same SRO self.assertEqual(SR_2.order_id, SRO) - - # Submit the SRs from FSO. Confirm FSO request, SR & SRO are submitted - FSO.action_request_submit() - self.assertEqual(FSO.request_stage, "submitted") - self.assertEqual(SR_1.state, "open") - self.assertEqual(SR_2.state, "open") - self.assertEqual(SRO.state, "open") + with self.assertRaises(UserError): + fsm_order.action_request_cancel() # Cancel the SRs from FSO. Confirm SR are cancelled FSO.action_request_cancel() @@ -99,9 +193,286 @@ def test_fsm_order_stock_request(self): self.assertEqual(SR_2.state, "cancel") self.assertEqual(SRO.state, "cancel") + with self.assertRaises(UserError): + fsm_order.action_request_draft() + # Set the SR to draft. Confirm SR are draft FSO.action_request_draft() self.assertEqual(FSO.request_stage, "draft") self.assertEqual(SR_1.state, "draft") self.assertEqual(SR_2.state, "draft") self.assertEqual(SRO.state, "draft") + + # Submit the SRs from FSO. Confirm FSO request, SR & SRO are submitted + FSO.action_request_submit() + self.assertEqual(FSO.request_stage, "submitted") + self.assertEqual(SR_1.state, "submitted") + self.assertEqual(SR_2.state, "submitted") + self.assertEqual(SRO.state, "submitted") + + with self.assertRaises(UserError): + fsm_order.action_request_submit() + self.StockRequest.create( + { + "warehouse_id": fsm_order.warehouse_id.id, + "location_id": fsm_order.inventory_location_id.id, + "product_id": self.product_2.id, + "product_uom_qty": 4, + "product_uom_id": self.product_2.uom_id.id, + "fsm_order_id": fsm_order.id, + "direction": "outbound", + "expected_date": datetime.datetime.now(), + "picking_policy": "direct", + } + ) + fsm_order.stock_request_ids.order_id = False + fsm_order.action_request_cancel() + fsm_order.action_request_draft() + fsm_order.action_request_submit() + + def test_stock_move_line(self): + expected_date = fields.Datetime.now() + FSO = self.FSMOrder.create({"location_id": self.test_location.id}) + procurement_group = self.env["procurement.group"].create({"name": "TEST"}) + self.StockPickingType.create( + { + "name": "Stock Request wh", + "sequence_id": self.env.ref("stock_request.seq_stock_request_order").id, + "code": "stock_request_order", + "sequence_code": "SRO", + "warehouse_id": FSO.warehouse_id.id, + } + ) + vals = { + "company_id": self.env.user.company_id.id, + "warehouse_id": self.warehouse.id, + "location_id": self.warehouse.lot_stock_id.id, + "expected_date": expected_date, + "requested_by": self.env.uid, + } + order = self.env["stock.request.order"].with_user(self.env.user).create(vals) + self.StockRequest.create( + { + "product_id": self.product_1.id, + "product_uom_id": self.env.ref("uom.product_uom_unit").id, + "product_uom_qty": 5.0, + "fsm_order_id": FSO.id, + "company_id": self.env.user.company_id.id, + "warehouse_id": self.warehouse.id, + "location_id": self.warehouse.lot_stock_id.id, + "expected_date": expected_date, + "direction": "outbound", + "picking_policy": "direct", + "requested_by": self.env.uid, + }, + ) + order.with_user(self.stock_request_manager).write( + {"stock_request_ids": [(6, 0, FSO.stock_request_ids.ids)]} + ) + stock_request = order.stock_request_ids + order.procurement_group_id = procurement_group + self.product_1.route_ids = [(6, 0, self.route.ids)] + self.env["stock.rule"].create( + { + "name": "Rule Supplier", + "route_id": self.warehouse.reception_route_id.id, + "location_id": self.warehouse.lot_stock_id.id, + "location_src_id": self.env.ref("stock.stock_location_suppliers").id, + "action": "pull", + "delay": 1.0, + "procure_method": "make_to_stock", + "picking_type_id": self.warehouse.in_type_id.id, + } + ) + self.env["procurement.group"].run( + [ + procurement_group.Procurement( + self.product_1, + 2.0, + self.product_1.uom_id, + self.warehouse.lot_stock_id, + "wave_part_1", + "wave_part_1", + self.warehouse.company_id, + {"warehouse_id": self.warehouse, "group_id": procurement_group}, + ) + ] + ) + order.with_user(self.stock_request_manager).action_confirm() + + self.env["stock.quant"].create( + { + "product_id": self.product_1.id, + "location_id": self.ressuply_loc.id, + "quantity": 5.0, + } + ) + picking = stock_request.picking_ids[0] + picking.with_user(self.stock_request_manager).action_confirm() + picking.with_user(self.stock_request_manager).action_assign() + packout1 = picking.move_line_ids[0] + packout1.qty_done = 5 + picking.with_user(self.stock_request_manager)._action_done() + + def test_08_stock_request(self): + expected_date = fields.Datetime.now() + FSO = self.FSMOrder.create({"location_id": self.test_location.id}) + self.StockPickingType.create( + { + "name": "Stock Request wh", + "sequence_id": self.env.ref("stock_request.seq_stock_request_order").id, + "code": "stock_request_order", + "sequence_code": "SRO", + "warehouse_id": FSO.warehouse_id.id, + } + ) + stock_request = self.StockRequest.create( + { + "product_id": self.product_1.id, + "product_uom_id": self.env.ref("uom.product_uom_unit").id, + "product_uom_qty": 5.0, + "fsm_order_id": FSO.id, + "company_id": self.env.user.company_id.id, + "warehouse_id": self.warehouse.id, + "location_id": self.warehouse.lot_stock_id.id, + "expected_date": expected_date, + "direction": "inbound", + "picking_policy": "direct", + "requested_by": self.env.uid, + }, + ) + stock_request._onchange_location_id() + stock_request.prepare_stock_request_order_values() + + def test_stock_request_confirm(self): + expected_date = fields.Datetime.now() + FSO = self.FSMOrder.create({"location_id": self.test_location.id}) + procurement_group = self.env["procurement.group"].create({"name": "TEST"}) + self.StockPickingType.create( + { + "name": "Stock Request wh", + "sequence_id": self.env.ref("stock_request.seq_stock_request_order").id, + "code": "stock_request_order", + "sequence_code": "SRO", + "warehouse_id": FSO.warehouse_id.id, + } + ) + vals = { + "company_id": self.env.user.company_id.id, + "warehouse_id": self.warehouse.id, + "location_id": self.warehouse.lot_stock_id.id, + "expected_date": expected_date, + "requested_by": self.env.uid, + "fsm_order_id": FSO.id, + } + order = self.env["stock.request.order"].with_user(self.env.user).create(vals) + self.StockRequest.create( + { + "product_id": self.product_1.id, + "product_uom_id": self.env.ref("uom.product_uom_unit").id, + "product_uom_qty": 5.0, + "fsm_order_id": FSO.id, + "company_id": self.env.user.company_id.id, + "warehouse_id": self.warehouse.id, + "location_id": self.warehouse.lot_stock_id.id, + "expected_date": expected_date, + "direction": "outbound", + "picking_policy": "direct", + "requested_by": self.env.uid, + }, + ) + order.with_user(self.stock_request_manager).write( + {"stock_request_ids": [(6, 0, FSO.stock_request_ids.ids)]} + ) + stock_request = order.stock_request_ids + order.procurement_group_id = procurement_group + self.product_1.route_ids = [(6, 0, self.route.ids)] + self.env["stock.rule"].create( + { + "name": "Rule Supplier", + "route_id": self.warehouse.reception_route_id.id, + "location_id": self.warehouse.lot_stock_id.id, + "location_src_id": self.env.ref("stock.stock_location_suppliers").id, + "action": "pull", + "delay": 1.0, + "procure_method": "make_to_stock", + "picking_type_id": self.warehouse.in_type_id.id, + } + ) + self.env["procurement.group"].run( + [ + procurement_group.Procurement( + self.product_1, + 2.0, + self.product_1.uom_id, + self.warehouse.lot_stock_id, + "wave_part_1", + "wave_part_1", + self.warehouse.company_id, + {"warehouse_id": self.warehouse, "group_id": procurement_group}, + ) + ] + ) + order.write({"fsm_order_id": FSO.id}) + order.action_confirm() + stock_request._action_confirm() + + order_without_fsm = order.copy({"fsm_order_id": False}) + order_without_fsm.action_confirm() + + def test_stock_request_confirm_with_FSM(self): + expected_date = fields.Datetime.now() + FSO = self.FSMOrder.create({"location_id": self.test_location.id}) + self.StockPickingType.create( + { + "name": "Stock Request wh", + "sequence_id": self.env.ref("stock_request.seq_stock_request_order").id, + "code": "stock_request_order", + "sequence_code": "SRO", + "warehouse_id": FSO.warehouse_id.id, + } + ) + self.product_1.route_ids = [(6, 0, self.route.ids)] + self.env["stock.rule"].create( + { + "name": "Rule Supplier", + "route_id": self.warehouse.reception_route_id.id, + "location_id": self.warehouse.lot_stock_id.id, + "location_src_id": self.env.ref("stock.stock_location_suppliers").id, + "action": "pull", + "delay": 1.0, + "procure_method": "make_to_stock", + "picking_type_id": self.warehouse.in_type_id.id, + } + ) + procurement_group = self.env["procurement.group"].create({"name": "TEST"}) + self.env["procurement.group"].run( + [ + procurement_group.Procurement( + self.product_1, + 2.0, + self.product_1.uom_id, + self.warehouse.lot_stock_id, + "wave_part_1", + "wave_part_1", + self.warehouse.company_id, + {"warehouse_id": self.warehouse, "group_id": procurement_group}, + ) + ] + ) + stock_request = self.StockRequest.create( + { + "product_id": self.product_1.id, + "product_uom_id": self.env.ref("uom.product_uom_unit").id, + "product_uom_qty": 5.0, + "fsm_order_id": FSO.id, + "company_id": self.env.user.company_id.id, + "warehouse_id": self.warehouse.id, + "location_id": self.warehouse.lot_stock_id.id, + "expected_date": expected_date, + "direction": "inbound", + "picking_policy": "direct", + "requested_by": self.env.uid, + }, + ) + stock_request.order_id.action_confirm() diff --git a/fieldservice_stock_request/views/fsm_order.xml b/fieldservice_stock_request/views/fsm_order.xml old mode 100755 new mode 100644 diff --git a/fieldservice_stock_request/views/stock.xml b/fieldservice_stock_request/views/stock.xml old mode 100755 new mode 100644 diff --git a/fieldservice_stock_request/views/stock_request.xml b/fieldservice_stock_request/views/stock_request.xml old mode 100755 new mode 100644 diff --git a/fieldservice_stock_request/views/stock_request_order.xml b/fieldservice_stock_request/views/stock_request_order.xml old mode 100755 new mode 100644 From f7eeb9ad294c7252926e9cb667460f988a309a23 Mon Sep 17 00:00:00 2001 From: oca-ci Date: Thu, 10 Nov 2022 19:01:23 +0000 Subject: [PATCH 16/54] [UPD] Update fieldservice_stock_request.pot --- .../i18n/fieldservice_stock_request.pot | 65 +++++++++++++++---- 1 file changed, 52 insertions(+), 13 deletions(-) diff --git a/fieldservice_stock_request/i18n/fieldservice_stock_request.pot b/fieldservice_stock_request/i18n/fieldservice_stock_request.pot index 5442d033d8..2c03061be8 100644 --- a/fieldservice_stock_request/i18n/fieldservice_stock_request.pot +++ b/fieldservice_stock_request/i18n/fieldservice_stock_request.pot @@ -1,12 +1,12 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * fieldservice_stock_request +# * fieldservice_stock_request # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 13.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -19,17 +19,24 @@ msgid "Cancel" msgstr "" #. module: fieldservice_stock_request -#: selection:fsm.order,request_stage:0 +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__cancel msgid "Cancelled" msgstr "" #. module: fieldservice_stock_request -#: selection:fsm.order,request_stage:0 +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line__display_name +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__display_name +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__display_name +msgid "Display Name" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__done msgid "Done" msgstr "" #. module: fieldservice_stock_request -#: selection:fsm.order,request_stage:0 +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__draft msgid "Draft" msgstr "" @@ -46,19 +53,40 @@ msgid "Field Service Order" msgstr "" #. module: fieldservice_stock_request -#: selection:fsm.order,request_stage:0 +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__id +msgid "ID" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__open msgid "In progress" msgstr "" +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order____last_update +msgid "Last Modified on" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__display_name +msgid "Order" +msgstr "" + #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__stock_request_ids msgid "Order Lines" msgstr "" #. module: fieldservice_stock_request -#: code:addons/fieldservice_stock_request/models/fsm_order.py:30 -#: code:addons/fieldservice_stock_request/models/fsm_order.py:43 -#: code:addons/fieldservice_stock_request/models/fsm_order.py:56 +#: code:addons/fieldservice_stock_request/models/fsm_order.py:0 +#: code:addons/fieldservice_stock_request/models/fsm_order.py:0 +#: code:addons/fieldservice_stock_request/models/fsm_order.py:0 #, python-format msgid "Please create a stock request." msgstr "" @@ -99,13 +127,24 @@ msgid "Submit" msgstr "" #. module: fieldservice_stock_request -#: selection:fsm.order,request_stage:0 +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__submitted msgid "Submitted" msgstr "" #. module: fieldservice_stock_request -#: code:addons/fieldservice_stock_request/models/stock_request.py:58 +#: code:addons/fieldservice_stock_request/models/stock_request.py:0 #, python-format -msgid "There is already a Stock Request Order with the same Field Service Order and Warehouse that is in Draft state. Please add this Stock Request there. (%s)" +msgid "" +"There is already a Stock Request Order " +"with the same Field Service Order and " +"Warehouse that is in Draft state. Please " +"add this Stock Request there. (%s)" msgstr "" +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/stock_request.py:0 +#, python-format +msgid "" +"There is no any inventory Operations Type:stock_request_order record for %s " +"Warehouse." +msgstr "" From 33f406a89c8bab8c77e567b1959f535b254757d3 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Thu, 10 Nov 2022 19:07:30 +0000 Subject: [PATCH 17/54] [UPD] README.rst --- fieldservice_stock_request/README.rst | 10 +++++----- .../static/description/index.html | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fieldservice_stock_request/README.rst b/fieldservice_stock_request/README.rst index c1c1a4dac6..2f4cea7a64 100644 --- a/fieldservice_stock_request/README.rst +++ b/fieldservice_stock_request/README.rst @@ -14,13 +14,13 @@ Field Service - Stock Request :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/13.0/fieldservice_stock_request + :target: https://github.com/OCA/field-service/tree/14.0/fieldservice_stock_request :alt: OCA/field-service .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/field-service-13-0/field-service-13-0-fieldservice_stock_request + :target: https://translation.odoo-community.org/projects/field-service-14-0/field-service-14-0-fieldservice_stock_request :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/13.0 + :target: https://runbot.odoo-community.org/runbot/264/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -78,7 +78,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. @@ -135,6 +135,6 @@ Current `maintainers `__: |maintainer-brian10048| |maintainer-wolfhall| |maintainer-max3903| |maintainer-smangukiya| -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_stock_request/static/description/index.html b/fieldservice_stock_request/static/description/index.html index 866955eb5d..4426cb5bb6 100755 --- a/fieldservice_stock_request/static/description/index.html +++ b/fieldservice_stock_request/static/description/index.html @@ -367,7 +367,7 @@

Field Service - Stock Request

!! 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

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

Table of contents

@@ -429,7 +429,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.

@@ -465,7 +465,7 @@

Maintainers

promote its widespread use.

Current maintainers:

brian10048 wolfhall max3903 smangukiya

-

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.

From 3a482249b5b3beeeba6e4fb74758403e4b470d0a Mon Sep 17 00:00:00 2001 From: Weblate Date: Thu, 10 Nov 2022 20:13:20 +0000 Subject: [PATCH 18/54] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: field-service-14.0/field-service-14.0-fieldservice_stock_request Translate-URL: https://translation.odoo-community.org/projects/field-service-14-0/field-service-14-0-fieldservice_stock_request/ --- fieldservice_stock_request/i18n/pt_BR.po | 60 +++++++++++++++++++----- 1 file changed, 49 insertions(+), 11 deletions(-) diff --git a/fieldservice_stock_request/i18n/pt_BR.po b/fieldservice_stock_request/i18n/pt_BR.po index b34b83f5c9..90c1cbe662 100644 --- a/fieldservice_stock_request/i18n/pt_BR.po +++ b/fieldservice_stock_request/i18n/pt_BR.po @@ -1,6 +1,6 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * fieldservice_stock_request +# * fieldservice_stock_request # msgid "" msgstr "" @@ -22,17 +22,24 @@ msgid "Cancel" msgstr "Cancelar" #. module: fieldservice_stock_request -#: selection:fsm.order,request_stage:0 +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__cancel msgid "Cancelled" msgstr "Cancelado" #. module: fieldservice_stock_request -#: selection:fsm.order,request_stage:0 +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line__display_name +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__display_name +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__display_name +msgid "Display Name" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__done msgid "Done" msgstr "Concluído" #. module: fieldservice_stock_request -#: selection:fsm.order,request_stage:0 +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__draft msgid "Draft" msgstr "Provisório" @@ -49,19 +56,38 @@ msgid "Field Service Order" msgstr "Ordem de Serviço de Campo" #. module: fieldservice_stock_request -#: selection:fsm.order,request_stage:0 +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__id +msgid "ID" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__open msgid "In progress" msgstr "Em andamento" +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order____last_update +msgid "Last Modified on" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__display_name +msgid "Order" +msgstr "" + #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__stock_request_ids msgid "Order Lines" msgstr "Itens do Pedido" #. module: fieldservice_stock_request -#: code:addons/fieldservice_stock_request/models/fsm_order.py:30 -#: code:addons/fieldservice_stock_request/models/fsm_order.py:43 -#: code:addons/fieldservice_stock_request/models/fsm_order.py:56 +#: code:addons/fieldservice_stock_request/models/fsm_order.py:0 #, python-format msgid "Please create a stock request." msgstr "Por favor, crie uma requisição de estoque." @@ -102,17 +128,29 @@ msgid "Submit" msgstr "Enviar" #. module: fieldservice_stock_request -#: selection:fsm.order,request_stage:0 +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__submitted msgid "Submitted" msgstr "Enviado" #. module: fieldservice_stock_request -#: code:addons/fieldservice_stock_request/models/stock_request.py:58 +#: code:addons/fieldservice_stock_request/models/stock_request.py:0 #, python-format -msgid "There is already a Stock Request Order with the same Field Service Order and Warehouse that is in Draft state. Please add this Stock Request there. (%s)" +msgid "" +"There is already a Stock Request Order " +"with the same Field Service Order and " +"Warehouse that is in Draft state. Please " +"add this Stock Request there. (%s)" msgstr "" "Já existe uma Ordem de Requisição de " "Estoque com a mesma Order de Serviço de " "Campo e Estoque em estado de Rascunho. Por " "favor e adicione esta Requisição de " "Estoque lá. (%s)" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/stock_request.py:0 +#, python-format +msgid "" +"There is no any inventory Operations Type:stock_request_order record for %s " +"Warehouse." +msgstr "" From c497b062a5b9675f555dd74446e10183e135621d Mon Sep 17 00:00:00 2001 From: mymage Date: Wed, 16 Nov 2022 15:57:52 +0000 Subject: [PATCH 19/54] Added translation using Weblate (Italian) --- fieldservice_stock_request/i18n/it.po | 151 ++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 fieldservice_stock_request/i18n/it.po diff --git a/fieldservice_stock_request/i18n/it.po b/fieldservice_stock_request/i18n/it.po new file mode 100644 index 0000000000..5e0514f5d8 --- /dev/null +++ b/fieldservice_stock_request/i18n/it.po @@ -0,0 +1,151 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_stock_request +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\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" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Cancel" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__cancel +msgid "Cancelled" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line__display_name +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__display_name +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__display_name +msgid "Display Name" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__done +msgid "Done" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__draft +msgid "Draft" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__fsm_order_id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__fsm_order_id +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search +msgid "FSM Order" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_fsm_order +msgid "Field Service Order" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__id +msgid "ID" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__open +msgid "In progress" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order____last_update +msgid "Last Modified on" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__display_name +msgid "Order" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__stock_request_ids +msgid "Order Lines" +msgstr "" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/fsm_order.py:0 +#: code:addons/fieldservice_stock_request/models/fsm_order.py:0 +#: code:addons/fieldservice_stock_request/models/fsm_order.py:0 +#, python-format +msgid "Please create a stock request." +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_move_line +msgid "Product Moves (Stock Move Line)" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__request_stage +msgid "Request State" +msgstr "" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Set to Draft" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_request +msgid "Stock Request" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_request_order +msgid "Stock Request Order" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.ui.menu,name:fieldservice_stock_request.menu_fsm_stock_request +msgid "Stock Requests" +msgstr "" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Submit" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__submitted +msgid "Submitted" +msgstr "" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/stock_request.py:0 +#, python-format +msgid "" +"There is already a Stock Request Order " +"with the same Field Service Order and " +"Warehouse that is in Draft state. Please " +"add this Stock Request there. (%s)" +msgstr "" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/stock_request.py:0 +#, python-format +msgid "" +"There is no any inventory Operations Type:stock_request_order record for %s " +"Warehouse." +msgstr "" From 8e9e90b2f8c7132c046df09bd8d35e60db98018c Mon Sep 17 00:00:00 2001 From: mymage Date: Wed, 16 Nov 2022 15:58:06 +0000 Subject: [PATCH 20/54] Translated using Weblate (Italian) Currently translated at 100.0% (23 of 23 strings) Translation: field-service-14.0/field-service-14.0-fieldservice_stock_request Translate-URL: https://translation.odoo-community.org/projects/field-service-14-0/field-service-14-0-fieldservice_stock_request/it/ --- fieldservice_stock_request/i18n/it.po | 53 ++++++++++++++++----------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/fieldservice_stock_request/i18n/it.po b/fieldservice_stock_request/i18n/it.po index 5e0514f5d8..b3b5d554c4 100644 --- a/fieldservice_stock_request/i18n/it.po +++ b/fieldservice_stock_request/i18n/it.po @@ -6,52 +6,54 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2022-11-16 18:45+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 4.14.1\n" #. module: fieldservice_stock_request #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request msgid "Cancel" -msgstr "" +msgstr "Annulla" #. module: fieldservice_stock_request #: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__cancel msgid "Cancelled" -msgstr "" +msgstr "Annullata" #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line__display_name #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__display_name #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__display_name msgid "Display Name" -msgstr "" +msgstr "Nome visualizzato" #. module: fieldservice_stock_request #: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__done msgid "Done" -msgstr "" +msgstr "Evasa" #. module: fieldservice_stock_request #: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__draft msgid "Draft" -msgstr "" +msgstr "Bozza" #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__fsm_order_id #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__fsm_order_id #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search msgid "FSM Order" -msgstr "" +msgstr "Ordine FSM" #. module: fieldservice_stock_request #: model:ir.model,name:fieldservice_stock_request.model_fsm_order msgid "Field Service Order" -msgstr "" +msgstr "Ordine assistenza sul campo" #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__id @@ -59,12 +61,12 @@ msgstr "" #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__id #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__id msgid "ID" -msgstr "" +msgstr "ID" #. module: fieldservice_stock_request #: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__open msgid "In progress" -msgstr "" +msgstr "In lavoro" #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order____last_update @@ -72,17 +74,17 @@ msgstr "" #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request____last_update #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order____last_update msgid "Last Modified on" -msgstr "" +msgstr "Ultima modifica il" #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__display_name msgid "Order" -msgstr "" +msgstr "Ordine" #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__stock_request_ids msgid "Order Lines" -msgstr "" +msgstr "Righe ordine" #. module: fieldservice_stock_request #: code:addons/fieldservice_stock_request/models/fsm_order.py:0 @@ -90,47 +92,47 @@ msgstr "" #: code:addons/fieldservice_stock_request/models/fsm_order.py:0 #, python-format msgid "Please create a stock request." -msgstr "" +msgstr "Creare una richiesta di magazzino." #. module: fieldservice_stock_request #: model:ir.model,name:fieldservice_stock_request.model_stock_move_line msgid "Product Moves (Stock Move Line)" -msgstr "" +msgstr "Movimenti prodotto (riga movimento magazzino)" #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__request_stage msgid "Request State" -msgstr "" +msgstr "Stato richiesta" #. module: fieldservice_stock_request #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request msgid "Set to Draft" -msgstr "" +msgstr "Imposta a bozza" #. module: fieldservice_stock_request #: model:ir.model,name:fieldservice_stock_request.model_stock_request msgid "Stock Request" -msgstr "" +msgstr "Richiesta di magazzino" #. module: fieldservice_stock_request #: model:ir.model,name:fieldservice_stock_request.model_stock_request_order msgid "Stock Request Order" -msgstr "" +msgstr "Ordine richiesta di magazzino" #. module: fieldservice_stock_request #: model:ir.ui.menu,name:fieldservice_stock_request.menu_fsm_stock_request msgid "Stock Requests" -msgstr "" +msgstr "Richieste di magazzino" #. module: fieldservice_stock_request #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request msgid "Submit" -msgstr "" +msgstr "Invia" #. module: fieldservice_stock_request #: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__submitted msgid "Submitted" -msgstr "" +msgstr "Inviata" #. module: fieldservice_stock_request #: code:addons/fieldservice_stock_request/models/stock_request.py:0 @@ -141,6 +143,11 @@ msgid "" "Warehouse that is in Draft state. Please " "add this Stock Request there. (%s)" msgstr "" +"Esiste già un ordine di richiesta di " +"magazzino con lo stesso ordine di " +"assistenza sul campo e magazzino che è in " +"stato bozza. Aggiungere a questa la " +"richiesta di magazzino. (%s)" #. module: fieldservice_stock_request #: code:addons/fieldservice_stock_request/models/stock_request.py:0 @@ -149,3 +156,5 @@ msgid "" "There is no any inventory Operations Type:stock_request_order record for %s " "Warehouse." msgstr "" +"Non è presente un record tipo operazione di magazzino:stock_request_order " +"per il magazzino %s." From 18220923acef2332deeb12778ff9aa97cafb7721 Mon Sep 17 00:00:00 2001 From: Maxime Chambreuil Date: Mon, 16 Jan 2023 09:34:27 -0600 Subject: [PATCH 21/54] [FIX] fieldservice_stock_request: Field must be present in view but is missing. --- fieldservice_stock_request/views/fsm_order.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/fieldservice_stock_request/views/fsm_order.xml b/fieldservice_stock_request/views/fsm_order.xml index 9eeac3c10d..2674ce5ab3 100644 --- a/fieldservice_stock_request/views/fsm_order.xml +++ b/fieldservice_stock_request/views/fsm_order.xml @@ -38,6 +38,7 @@ + Date: Mon, 16 Jan 2023 14:37:37 -0600 Subject: [PATCH 22/54] fix --- fieldservice_stock_request/views/fsm_order.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/fieldservice_stock_request/views/fsm_order.xml b/fieldservice_stock_request/views/fsm_order.xml index 2674ce5ab3..78bd215e5d 100644 --- a/fieldservice_stock_request/views/fsm_order.xml +++ b/fieldservice_stock_request/views/fsm_order.xml @@ -39,6 +39,7 @@ + Date: Tue, 17 Jan 2023 03:01:18 +0000 Subject: [PATCH 23/54] Added translation using Weblate (Spanish (Argentina)) --- fieldservice_stock_request/i18n/es_AR.po | 151 +++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 fieldservice_stock_request/i18n/es_AR.po diff --git a/fieldservice_stock_request/i18n/es_AR.po b/fieldservice_stock_request/i18n/es_AR.po new file mode 100644 index 0000000000..633e1087c0 --- /dev/null +++ b/fieldservice_stock_request/i18n/es_AR.po @@ -0,0 +1,151 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_stock_request +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\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" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Cancel" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__cancel +msgid "Cancelled" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line__display_name +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__display_name +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__display_name +msgid "Display Name" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__done +msgid "Done" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__draft +msgid "Draft" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__fsm_order_id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__fsm_order_id +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search +msgid "FSM Order" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_fsm_order +msgid "Field Service Order" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__id +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__id +msgid "ID" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__open +msgid "In progress" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request____last_update +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order____last_update +msgid "Last Modified on" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__display_name +msgid "Order" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__stock_request_ids +msgid "Order Lines" +msgstr "" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/fsm_order.py:0 +#: code:addons/fieldservice_stock_request/models/fsm_order.py:0 +#: code:addons/fieldservice_stock_request/models/fsm_order.py:0 +#, python-format +msgid "Please create a stock request." +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_move_line +msgid "Product Moves (Stock Move Line)" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__request_stage +msgid "Request State" +msgstr "" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Set to Draft" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_request +msgid "Stock Request" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model,name:fieldservice_stock_request.model_stock_request_order +msgid "Stock Request Order" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.ui.menu,name:fieldservice_stock_request.menu_fsm_stock_request +msgid "Stock Requests" +msgstr "" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request +msgid "Submit" +msgstr "" + +#. module: fieldservice_stock_request +#: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__submitted +msgid "Submitted" +msgstr "" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/stock_request.py:0 +#, python-format +msgid "" +"There is already a Stock Request Order " +"with the same Field Service Order and " +"Warehouse that is in Draft state. Please " +"add this Stock Request there. (%s)" +msgstr "" + +#. module: fieldservice_stock_request +#: code:addons/fieldservice_stock_request/models/stock_request.py:0 +#, python-format +msgid "" +"There is no any inventory Operations Type:stock_request_order record for %s " +"Warehouse." +msgstr "" From 96710602c304cb3542591a313315b74c84e47045 Mon Sep 17 00:00:00 2001 From: Ignacio Buioli Date: Tue, 17 Jan 2023 03:32:57 +0000 Subject: [PATCH 24/54] Translated using Weblate (Spanish (Argentina)) Currently translated at 100.0% (23 of 23 strings) Translation: field-service-14.0/field-service-14.0-fieldservice_stock_request Translate-URL: https://translation.odoo-community.org/projects/field-service-14-0/field-service-14-0-fieldservice_stock_request/es_AR/ --- fieldservice_stock_request/i18n/es_AR.po | 52 ++++++++++++++---------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/fieldservice_stock_request/i18n/es_AR.po b/fieldservice_stock_request/i18n/es_AR.po index 633e1087c0..5ec4e4e0d0 100644 --- a/fieldservice_stock_request/i18n/es_AR.po +++ b/fieldservice_stock_request/i18n/es_AR.po @@ -6,52 +6,54 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2023-01-17 06:05+0000\n" +"Last-Translator: Ignacio Buioli \n" "Language-Team: none\n" "Language: es_AR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.14.1\n" #. module: fieldservice_stock_request #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request msgid "Cancel" -msgstr "" +msgstr "Cancelar" #. module: fieldservice_stock_request #: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__cancel msgid "Cancelled" -msgstr "" +msgstr "Cancelado" #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_move_line__display_name #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__display_name #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__display_name msgid "Display Name" -msgstr "" +msgstr "Mostrar Nombre" #. module: fieldservice_stock_request #: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__done msgid "Done" -msgstr "" +msgstr "Hecho" #. module: fieldservice_stock_request #: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__draft msgid "Draft" -msgstr "" +msgstr "Borrador" #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__fsm_order_id #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__fsm_order_id #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search msgid "FSM Order" -msgstr "" +msgstr "Pedido FSM" #. module: fieldservice_stock_request #: model:ir.model,name:fieldservice_stock_request.model_fsm_order msgid "Field Service Order" -msgstr "" +msgstr "Pedido de Servicio de Campo" #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__id @@ -59,12 +61,12 @@ msgstr "" #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request__id #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__id msgid "ID" -msgstr "" +msgstr "ID" #. module: fieldservice_stock_request #: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__open msgid "In progress" -msgstr "" +msgstr "En progreso" #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order____last_update @@ -72,17 +74,17 @@ msgstr "" #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request____last_update #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order____last_update msgid "Last Modified on" -msgstr "" +msgstr "Última Modificación el" #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__display_name msgid "Order" -msgstr "" +msgstr "Pedido" #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__stock_request_ids msgid "Order Lines" -msgstr "" +msgstr "Líneas de Pedido" #. module: fieldservice_stock_request #: code:addons/fieldservice_stock_request/models/fsm_order.py:0 @@ -90,47 +92,47 @@ msgstr "" #: code:addons/fieldservice_stock_request/models/fsm_order.py:0 #, python-format msgid "Please create a stock request." -msgstr "" +msgstr "Por favor, cree una solicitud de inventario." #. module: fieldservice_stock_request #: model:ir.model,name:fieldservice_stock_request.model_stock_move_line msgid "Product Moves (Stock Move Line)" -msgstr "" +msgstr "Movimientos de Producto (Stock Move Line)" #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__request_stage msgid "Request State" -msgstr "" +msgstr "Estado de Solicitud" #. module: fieldservice_stock_request #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request msgid "Set to Draft" -msgstr "" +msgstr "Establecer a Borrador" #. module: fieldservice_stock_request #: model:ir.model,name:fieldservice_stock_request.model_stock_request msgid "Stock Request" -msgstr "" +msgstr "Solicitud de Inventario" #. module: fieldservice_stock_request #: model:ir.model,name:fieldservice_stock_request.model_stock_request_order msgid "Stock Request Order" -msgstr "" +msgstr "Pedido de Solicitud de Stock" #. module: fieldservice_stock_request #: model:ir.ui.menu,name:fieldservice_stock_request.menu_fsm_stock_request msgid "Stock Requests" -msgstr "" +msgstr "Solicitudes de Inventario" #. module: fieldservice_stock_request #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request msgid "Submit" -msgstr "" +msgstr "Enviar" #. module: fieldservice_stock_request #: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__submitted msgid "Submitted" -msgstr "" +msgstr "Presentado" #. module: fieldservice_stock_request #: code:addons/fieldservice_stock_request/models/stock_request.py:0 @@ -141,6 +143,10 @@ msgid "" "Warehouse that is in Draft state. Please " "add this Stock Request there. (%s)" msgstr "" +"Ya existe una Orden de Solicitud de Stock " +"con la misma Orden de Servicio de Campo y " +"Almacén que está en estado Borrador. " +"Agregue esta solicitud de stock allí. (%s)" #. module: fieldservice_stock_request #: code:addons/fieldservice_stock_request/models/stock_request.py:0 @@ -149,3 +155,5 @@ msgid "" "There is no any inventory Operations Type:stock_request_order record for %s " "Warehouse." msgstr "" +"No hay ningún registro Tipo de operaciones de inventario: " +"stock_request_order para %s Warehouse." From 82185d4af6dbd081138cb3fa3d9a3c93785cac5d Mon Sep 17 00:00:00 2001 From: mymage Date: Wed, 14 Jun 2023 12:08:23 +0000 Subject: [PATCH 25/54] Translated using Weblate (Italian) Currently translated at 100.0% (23 of 23 strings) Translation: field-service-14.0/field-service-14.0-fieldservice_stock_request Translate-URL: https://translation.odoo-community.org/projects/field-service-14-0/field-service-14-0-fieldservice_stock_request/it/ --- fieldservice_stock_request/i18n/it.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fieldservice_stock_request/i18n/it.po b/fieldservice_stock_request/i18n/it.po index b3b5d554c4..b9c5c226e2 100644 --- a/fieldservice_stock_request/i18n/it.po +++ b/fieldservice_stock_request/i18n/it.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2022-11-16 18:45+0000\n" +"PO-Revision-Date: 2023-06-14 12:09+0000\n" "Last-Translator: mymage \n" "Language-Team: none\n" "Language: it\n" @@ -14,7 +14,7 @@ msgstr "" "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" +"X-Generator: Weblate 4.17\n" #. module: fieldservice_stock_request #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request @@ -66,7 +66,7 @@ msgstr "ID" #. module: fieldservice_stock_request #: model:ir.model.fields.selection,name:fieldservice_stock_request.selection__fsm_order__request_stage__open msgid "In progress" -msgstr "In lavoro" +msgstr "In corso" #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order____last_update From c913cc0ced820981f518b837c407319a7247f594 Mon Sep 17 00:00:00 2001 From: Francesco Foresti Date: Wed, 12 Jul 2023 09:40:50 +0000 Subject: [PATCH 26/54] Translated using Weblate (Italian) Currently translated at 100.0% (23 of 23 strings) Translation: field-service-14.0/field-service-14.0-fieldservice_stock_request Translate-URL: https://translation.odoo-community.org/projects/field-service-14-0/field-service-14-0-fieldservice_stock_request/it/ --- fieldservice_stock_request/i18n/it.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fieldservice_stock_request/i18n/it.po b/fieldservice_stock_request/i18n/it.po index b9c5c226e2..ae511e342c 100644 --- a/fieldservice_stock_request/i18n/it.po +++ b/fieldservice_stock_request/i18n/it.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2023-06-14 12:09+0000\n" -"Last-Translator: mymage \n" +"PO-Revision-Date: 2023-07-12 12:11+0000\n" +"Last-Translator: Francesco Foresti \n" "Language-Team: none\n" "Language: it\n" "MIME-Version: 1.0\n" @@ -97,7 +97,7 @@ msgstr "Creare una richiesta di magazzino." #. module: fieldservice_stock_request #: model:ir.model,name:fieldservice_stock_request.model_stock_move_line msgid "Product Moves (Stock Move Line)" -msgstr "Movimenti prodotto (riga movimento magazzino)" +msgstr "Movimenti prodotto (riga movimento di magazzino)" #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_fsm_order__request_stage From bb638f4b4471ca0408066757a896f5b2106cd88f Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Sun, 3 Sep 2023 12:53:16 +0000 Subject: [PATCH 27/54] [UPD] README.rst --- fieldservice_stock_request/README.rst | 15 +++--- .../static/description/index.html | 52 ++++++++++--------- 2 files changed, 36 insertions(+), 31 deletions(-) diff --git a/fieldservice_stock_request/README.rst b/fieldservice_stock_request/README.rst index 2f4cea7a64..b5376633d6 100644 --- a/fieldservice_stock_request/README.rst +++ b/fieldservice_stock_request/README.rst @@ -2,10 +2,13 @@ Field Service - Stock Request ============================= -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:47fd02fe1cfdabea79c6efc01cbda86297c6f85bf661b0f967f0bd7cc907a971 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status @@ -19,11 +22,11 @@ Field Service - Stock Request .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png :target: https://translation.odoo-community.org/projects/field-service-14-0/field-service-14-0-fieldservice_stock_request :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/14.0 - :alt: Try me on Runbot +.. |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=14.0 + :alt: Try me on Runboat -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| This module is an add-on for the Field Service application in Odoo. It provides stock requests in field service orders. @@ -77,7 +80,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 +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. diff --git a/fieldservice_stock_request/static/description/index.html b/fieldservice_stock_request/static/description/index.html index 4426cb5bb6..2aa28d6118 100755 --- a/fieldservice_stock_request/static/description/index.html +++ b/fieldservice_stock_request/static/description/index.html @@ -1,20 +1,20 @@ - + - + Field Service - Stock Request -
-

Field Service - Stock Request

+
+ + +Odoo Community Association + +
+

Field Service - Stock Request

-

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

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

Table of contents

@@ -389,7 +394,7 @@

Field Service - Stock Request

-

Configuration

+

Configuration

To configure this module, you need to:

  • Go to Inventory > Configuration > Routes
  • @@ -411,7 +416,7 @@

    Configuration

-

Usage

+

Usage

To use this module, you need to:

  • Create a new service order
  • @@ -423,12 +428,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 @@ -436,16 +441,16 @@

Bug Tracker

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

-

Credits

+

Credits

-

Authors

+

Authors

  • Open Source Integrators
  • Brian McMaster
-

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 b6e7f8a27de0532db48d6125365a2889d35df888 Mon Sep 17 00:00:00 2001 From: Weblate Date: Mon, 18 Aug 2025 13:32:41 +0000 Subject: [PATCH 45/54] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: field-service-17.0/field-service-17.0-fieldservice_stock_request Translate-URL: https://translation.odoo-community.org/projects/field-service-17-0/field-service-17-0-fieldservice_stock_request/ --- fieldservice_stock_request/i18n/es.po | 10 ++++------ fieldservice_stock_request/i18n/es_AR.po | 11 +++++++++++ fieldservice_stock_request/i18n/it.po | 11 +++++++++++ fieldservice_stock_request/i18n/pt_BR.po | 11 +++++++++++ 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/fieldservice_stock_request/i18n/es.po b/fieldservice_stock_request/i18n/es.po index d352eb88ee..303e078e89 100644 --- a/fieldservice_stock_request/i18n/es.po +++ b/fieldservice_stock_request/i18n/es.po @@ -10,6 +10,7 @@ msgstr "" "PO-Revision-Date: 2025-07-09 11:37+0000\n" "Last-Translator: \n" "Language-Team: \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" @@ -66,8 +67,6 @@ msgstr "Líneas de Pedido" #. module: fieldservice_stock_request #. odoo-python #: code:addons/fieldservice_stock_request/models/fsm_order.py:0 -#: code:addons/fieldservice_stock_request/models/fsm_order.py:0 -#: code:addons/fieldservice_stock_request/models/fsm_order.py:0 #, python-format msgid "Please create a stock request." msgstr "Por favor, cree una solicitud de existencias." @@ -123,8 +122,7 @@ msgid "" "add this Stock Request there. (%s)" msgstr "" "Ya existe un Pedido de Existencias con el mismo Pedido de Servicio de Campo " -"y" -" " +"y " "Almacén que está en estado Borrador. Por favor, añada esta Solicitud de " "Existencias allí. (%s)" @@ -136,8 +134,8 @@ msgid "" "There is no any inventory Operations Type:stock_request_order record for %s " "Warehouse." msgstr "" -"No hay ningún registro de operaciones de inventario Tipo:stock_request_order" -" para %s Almacén." +"No hay ningún registro de operaciones de inventario Tipo:stock_request_order " +"para %s Almacén." #. module: fieldservice_stock_request #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search diff --git a/fieldservice_stock_request/i18n/es_AR.po b/fieldservice_stock_request/i18n/es_AR.po index e8f2af684a..c8e75b96f4 100644 --- a/fieldservice_stock_request/i18n/es_AR.po +++ b/fieldservice_stock_request/i18n/es_AR.po @@ -16,6 +16,12 @@ msgstr "" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Weblate 4.14.1\n" +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__fsm_order_person_id +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search +msgid "Assigned To" +msgstr "" + #. module: fieldservice_stock_request #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request msgid "Cancel" @@ -131,6 +137,11 @@ msgstr "" "No hay ningún registro Tipo de operaciones de inventario: " "stock_request_order para %s Warehouse." +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search +msgid "Today Orders" +msgstr "" + #~ msgid "Display Name" #~ msgstr "Mostrar Nombre" diff --git a/fieldservice_stock_request/i18n/it.po b/fieldservice_stock_request/i18n/it.po index 06eb0d36e0..d583075ea9 100644 --- a/fieldservice_stock_request/i18n/it.po +++ b/fieldservice_stock_request/i18n/it.po @@ -16,6 +16,12 @@ msgstr "" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Weblate 4.17\n" +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__fsm_order_person_id +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search +msgid "Assigned To" +msgstr "" + #. module: fieldservice_stock_request #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request msgid "Cancel" @@ -132,6 +138,11 @@ msgstr "" "Non è presente un record tipo operazione di magazzino:stock_request_order " "per il magazzino %s." +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search +msgid "Today Orders" +msgstr "" + #~ msgid "Display Name" #~ msgstr "Nome visualizzato" diff --git a/fieldservice_stock_request/i18n/pt_BR.po b/fieldservice_stock_request/i18n/pt_BR.po index d51b23a8f6..a575492f00 100644 --- a/fieldservice_stock_request/i18n/pt_BR.po +++ b/fieldservice_stock_request/i18n/pt_BR.po @@ -16,6 +16,12 @@ msgstr "" "Plural-Forms: nplurals=2; plural=n > 1;\n" "X-Generator: Weblate 4.3.2\n" +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__fsm_order_person_id +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search +msgid "Assigned To" +msgstr "" + #. module: fieldservice_stock_request #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request msgid "Cancel" @@ -129,3 +135,8 @@ msgid "" "There is no any inventory Operations Type:stock_request_order record for %s " "Warehouse." msgstr "" + +#. module: fieldservice_stock_request +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search +msgid "Today Orders" +msgstr "" From d5598f80c99ad52b74781467a864de3966f2841b Mon Sep 17 00:00:00 2001 From: mymage Date: Tue, 19 Aug 2025 13:20:38 +0000 Subject: [PATCH 46/54] Translated using Weblate (Italian) Currently translated at 100.0% (21 of 21 strings) Translation: field-service-17.0/field-service-17.0-fieldservice_stock_request Translate-URL: https://translation.odoo-community.org/projects/field-service-17-0/field-service-17-0-fieldservice_stock_request/it/ --- fieldservice_stock_request/i18n/it.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fieldservice_stock_request/i18n/it.po b/fieldservice_stock_request/i18n/it.po index d583075ea9..e217e9647f 100644 --- a/fieldservice_stock_request/i18n/it.po +++ b/fieldservice_stock_request/i18n/it.po @@ -6,21 +6,21 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2023-07-12 12:11+0000\n" -"Last-Translator: Francesco Foresti \n" +"PO-Revision-Date: 2025-08-19 14:47+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 4.17\n" +"X-Generator: Weblate 5.10.4\n" #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__fsm_order_person_id #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search msgid "Assigned To" -msgstr "" +msgstr "Assegnato a" #. module: fieldservice_stock_request #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.view_fsm_order_form_inherit_stock_request @@ -141,7 +141,7 @@ msgstr "" #. module: fieldservice_stock_request #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search msgid "Today Orders" -msgstr "" +msgstr "Ordini odierni" #~ msgid "Display Name" #~ msgstr "Nome visualizzato" From 6043423087341f488763de12866ed2e641eea1d7 Mon Sep 17 00:00:00 2001 From: bobrador Date: Thu, 23 Oct 2025 14:14:45 +0200 Subject: [PATCH 47/54] [IMP] fieldservice_stock_request : Add Actual Delivery Date field --- fieldservice_stock_request/models/stock_request_order.py | 3 +++ fieldservice_stock_request/views/stock_request_order.xml | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/fieldservice_stock_request/models/stock_request_order.py b/fieldservice_stock_request/models/stock_request_order.py index 300bf2ee35..18cd37d6f2 100644 --- a/fieldservice_stock_request/models/stock_request_order.py +++ b/fieldservice_stock_request/models/stock_request_order.py @@ -16,6 +16,9 @@ class StockRequestOrder(models.Model): string="Assigned To", store=True, ) + actual_delivery_date = fields.Datetime( + string="Actual Delivery Date", related="fsm_order_id.date_end", store=True + ) @api.onchange("warehouse_id", "direction", "fsm_order_id") def _onchange_location_id(self): diff --git a/fieldservice_stock_request/views/stock_request_order.xml b/fieldservice_stock_request/views/stock_request_order.xml index 44a3611f81..7eaa379f85 100644 --- a/fieldservice_stock_request/views/stock_request_order.xml +++ b/fieldservice_stock_request/views/stock_request_order.xml @@ -5,6 +5,7 @@ + { @@ -32,6 +33,7 @@ + @@ -44,6 +46,7 @@ + + From 800c527b7511df8d95b0cd8b48705ddc54b62b7e Mon Sep 17 00:00:00 2001 From: oca-ci Date: Tue, 4 Nov 2025 11:21:56 +0000 Subject: [PATCH 48/54] [UPD] Update fieldservice_stock_request.pot --- .../i18n/fieldservice_stock_request.pot | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fieldservice_stock_request/i18n/fieldservice_stock_request.pot b/fieldservice_stock_request/i18n/fieldservice_stock_request.pot index 70d8cd851d..e9d8167f0f 100644 --- a/fieldservice_stock_request/i18n/fieldservice_stock_request.pot +++ b/fieldservice_stock_request/i18n/fieldservice_stock_request.pot @@ -13,6 +13,12 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__actual_delivery_date +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search +msgid "Actual Delivery Date" +msgstr "" + #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__fsm_order_person_id #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search From 984ef48ac4e8b345bf7506f291ec29ee8a8462b9 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 4 Nov 2025 11:27:38 +0000 Subject: [PATCH 49/54] [BOT] post-merge updates --- fieldservice_stock_request/README.rst | 2 +- fieldservice_stock_request/__manifest__.py | 2 +- fieldservice_stock_request/static/description/index.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fieldservice_stock_request/README.rst b/fieldservice_stock_request/README.rst index 07f080cfe5..0278e1755a 100644 --- a/fieldservice_stock_request/README.rst +++ b/fieldservice_stock_request/README.rst @@ -11,7 +11,7 @@ Field Service - Stock Request !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:fc74f420182429d4b47f49f63b58e8a0564e59e50eede75668c9d7b279ef11dd + !! source digest: sha256:63e9795f66235f145d8fe58f92ea4b524b8c5fec16bbb1fd61b607c617f8cef8 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/fieldservice_stock_request/__manifest__.py b/fieldservice_stock_request/__manifest__.py index c459649551..ddbed134e4 100644 --- a/fieldservice_stock_request/__manifest__.py +++ b/fieldservice_stock_request/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Field Service - Stock Request", "summary": "Integrate Stock Requests with Field Service Orders", - "version": "17.0.1.1.0", + "version": "17.0.1.2.0", "category": "Field Service", "author": "Open Source Integrators, " "Brian McMaster, " diff --git a/fieldservice_stock_request/static/description/index.html b/fieldservice_stock_request/static/description/index.html index 97c59879ef..e03782e0ca 100755 --- a/fieldservice_stock_request/static/description/index.html +++ b/fieldservice_stock_request/static/description/index.html @@ -372,7 +372,7 @@

Field Service - Stock Request

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:fc74f420182429d4b47f49f63b58e8a0564e59e50eede75668c9d7b279ef11dd +!! source digest: sha256:63e9795f66235f145d8fe58f92ea4b524b8c5fec16bbb1fd61b607c617f8cef8 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

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

This module is an add-on for the Field Service application in Odoo. It From 61eba0d6ee10e9c17a5ed0e2e08b0835d8040e61 Mon Sep 17 00:00:00 2001 From: Weblate Date: Tue, 4 Nov 2025 11:27:47 +0000 Subject: [PATCH 50/54] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: field-service-17.0/field-service-17.0-fieldservice_stock_request Translate-URL: https://translation.odoo-community.org/projects/field-service-17-0/field-service-17-0-fieldservice_stock_request/ --- fieldservice_stock_request/i18n/es.po | 6 ++++++ fieldservice_stock_request/i18n/es_AR.po | 6 ++++++ fieldservice_stock_request/i18n/it.po | 6 ++++++ fieldservice_stock_request/i18n/pt_BR.po | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/fieldservice_stock_request/i18n/es.po b/fieldservice_stock_request/i18n/es.po index 303e078e89..e399a17091 100644 --- a/fieldservice_stock_request/i18n/es.po +++ b/fieldservice_stock_request/i18n/es.po @@ -16,6 +16,12 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__actual_delivery_date +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search +msgid "Actual Delivery Date" +msgstr "" + #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__fsm_order_person_id #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search diff --git a/fieldservice_stock_request/i18n/es_AR.po b/fieldservice_stock_request/i18n/es_AR.po index c8e75b96f4..2748e457b6 100644 --- a/fieldservice_stock_request/i18n/es_AR.po +++ b/fieldservice_stock_request/i18n/es_AR.po @@ -16,6 +16,12 @@ msgstr "" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Weblate 4.14.1\n" +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__actual_delivery_date +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search +msgid "Actual Delivery Date" +msgstr "" + #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__fsm_order_person_id #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search diff --git a/fieldservice_stock_request/i18n/it.po b/fieldservice_stock_request/i18n/it.po index e217e9647f..19d53d0eea 100644 --- a/fieldservice_stock_request/i18n/it.po +++ b/fieldservice_stock_request/i18n/it.po @@ -16,6 +16,12 @@ msgstr "" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Weblate 5.10.4\n" +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__actual_delivery_date +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search +msgid "Actual Delivery Date" +msgstr "" + #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__fsm_order_person_id #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search diff --git a/fieldservice_stock_request/i18n/pt_BR.po b/fieldservice_stock_request/i18n/pt_BR.po index a575492f00..c3946baf61 100644 --- a/fieldservice_stock_request/i18n/pt_BR.po +++ b/fieldservice_stock_request/i18n/pt_BR.po @@ -16,6 +16,12 @@ msgstr "" "Plural-Forms: nplurals=2; plural=n > 1;\n" "X-Generator: Weblate 4.3.2\n" +#. module: fieldservice_stock_request +#: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__actual_delivery_date +#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search +msgid "Actual Delivery Date" +msgstr "" + #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__fsm_order_person_id #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search From 761487d2c07e3cc163b7656cbed20d5354c05473 Mon Sep 17 00:00:00 2001 From: mymage Date: Wed, 5 Nov 2025 07:36:21 +0000 Subject: [PATCH 51/54] Translated using Weblate (Italian) Currently translated at 100.0% (22 of 22 strings) Translation: field-service-17.0/field-service-17.0-fieldservice_stock_request Translate-URL: https://translation.odoo-community.org/projects/field-service-17-0/field-service-17-0-fieldservice_stock_request/it/ --- fieldservice_stock_request/i18n/it.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fieldservice_stock_request/i18n/it.po b/fieldservice_stock_request/i18n/it.po index 19d53d0eea..64585252ff 100644 --- a/fieldservice_stock_request/i18n/it.po +++ b/fieldservice_stock_request/i18n/it.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2025-08-19 14:47+0000\n" +"PO-Revision-Date: 2025-11-05 09:42+0000\n" "Last-Translator: mymage \n" "Language-Team: none\n" "Language: it\n" @@ -20,7 +20,7 @@ msgstr "" #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__actual_delivery_date #: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search msgid "Actual Delivery Date" -msgstr "" +msgstr "Data consegna attuale" #. module: fieldservice_stock_request #: model:ir.model.fields,field_description:fieldservice_stock_request.field_stock_request_order__fsm_order_person_id From 27aa38b2cba3276da9278979833616e7f89b1e50 Mon Sep 17 00:00:00 2001 From: Antoni Marroig Campomar Date: Tue, 11 Nov 2025 16:10:16 +0100 Subject: [PATCH 52/54] [IMP] fieldservice_stock_request: Recompute warehouse and location --- .../models/fsm_order.py | 15 ++++++++- .../tests/test_fsm_stock_request.py | 33 +++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/fieldservice_stock_request/models/fsm_order.py b/fieldservice_stock_request/models/fsm_order.py index 52526504b2..d4b4e7bc2a 100644 --- a/fieldservice_stock_request/models/fsm_order.py +++ b/fieldservice_stock_request/models/fsm_order.py @@ -1,7 +1,7 @@ # Copyright (C) 2021 - TODAY, Brian McMaster # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import _, fields, models +from odoo import _, api, fields, models from odoo.exceptions import UserError REQUEST_STATES = [ @@ -25,6 +25,19 @@ class FSMOrder(models.Model): default="draft", ) + @api.onchange("warehouse_id") + def _onchange_warehouse_id(self): + if ( + self.stage_id == self.env.ref("fieldservice.fsm_stage_new") + and self.stock_request_ids + ): + self.stock_request_ids[0].order_id.warehouse_id = self.warehouse_id + self.stock_request_ids[ + 0 + ].order_id.location_id = self.warehouse_id.lot_stock_id + for line in self.stock_request_ids: + line.location_id = self.warehouse_id.lot_stock_id + def action_request_submit(self): for rec in self: if not rec.stock_request_ids: diff --git a/fieldservice_stock_request/tests/test_fsm_stock_request.py b/fieldservice_stock_request/tests/test_fsm_stock_request.py index 0e27038abd..16c0486c6c 100644 --- a/fieldservice_stock_request/tests/test_fsm_stock_request.py +++ b/fieldservice_stock_request/tests/test_fsm_stock_request.py @@ -442,3 +442,36 @@ def test_stock_request_confirm_with_FSM(self): }, ) stock_request.order_id.action_confirm() + + def test_onchange_warehouse_id(self): + fsm_order = self.FSMOrder.create( + { + "location_id": self.test_location.id, + "warehouse_id": self.warehouse.id, + } + ) + stock_request = self.StockRequest.create( + { + "warehouse_id": fsm_order.warehouse_id.id, + "location_id": fsm_order.inventory_location_id.id, + "product_id": self.product_1.id, + "product_uom_qty": 1, + "product_uom_id": self.product_1.uom_id.id, + "fsm_order_id": fsm_order.id, + "direction": "outbound", + "expected_date": datetime.datetime.now(), + "picking_policy": "direct", + } + ) + warehouse2 = self.env["stock.warehouse"].create( + { + "name": "Test Warehouse 2", + "code": "TW2", + } + ) + fsm_order.warehouse_id = warehouse2 + fsm_order._onchange_warehouse_id() + self.assertEqual( + stock_request.location_id, + warehouse2.lot_stock_id, + ) From cd978486cf7765a58dc8114347c51a930a6eb0db Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 2 Dec 2025 14:48:11 +0000 Subject: [PATCH 53/54] [BOT] post-merge updates --- fieldservice_stock_request/README.rst | 2 +- fieldservice_stock_request/__manifest__.py | 2 +- fieldservice_stock_request/static/description/index.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fieldservice_stock_request/README.rst b/fieldservice_stock_request/README.rst index 0278e1755a..545d947921 100644 --- a/fieldservice_stock_request/README.rst +++ b/fieldservice_stock_request/README.rst @@ -11,7 +11,7 @@ Field Service - Stock Request !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:63e9795f66235f145d8fe58f92ea4b524b8c5fec16bbb1fd61b607c617f8cef8 + !! source digest: sha256:d6b126a091b6a205042535b90ff4f8a2e2950e0a21617decb74546fd3f94e4f1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/fieldservice_stock_request/__manifest__.py b/fieldservice_stock_request/__manifest__.py index ddbed134e4..6aefdede21 100644 --- a/fieldservice_stock_request/__manifest__.py +++ b/fieldservice_stock_request/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Field Service - Stock Request", "summary": "Integrate Stock Requests with Field Service Orders", - "version": "17.0.1.2.0", + "version": "17.0.1.3.0", "category": "Field Service", "author": "Open Source Integrators, " "Brian McMaster, " diff --git a/fieldservice_stock_request/static/description/index.html b/fieldservice_stock_request/static/description/index.html index e03782e0ca..4c9cd04c60 100755 --- a/fieldservice_stock_request/static/description/index.html +++ b/fieldservice_stock_request/static/description/index.html @@ -372,7 +372,7 @@

Field Service - Stock Request

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:63e9795f66235f145d8fe58f92ea4b524b8c5fec16bbb1fd61b607c617f8cef8 +!! source digest: sha256:d6b126a091b6a205042535b90ff4f8a2e2950e0a21617decb74546fd3f94e4f1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

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

This module is an add-on for the Field Service application in Odoo. It From 61b3bdbfe3a0d2506586ad0ffc38eb6526d68b51 Mon Sep 17 00:00:00 2001 From: Jimmy SC94 Date: Wed, 22 Jul 2026 16:48:28 -0400 Subject: [PATCH 54/54] [MIG] fieldservice_stock_request: Migration to 18.0 --- fieldservice_stock_request/README.rst | 10 +- fieldservice_stock_request/__manifest__.py | 2 +- .../i18n/fieldservice_stock_request.pot | 19 +-- .../models/fsm_order.py | 8 +- .../models/stock_request.py | 121 ++++++++---------- .../models/stock_request_order.py | 4 +- .../readme/CONTRIBUTORS.md | 1 + .../static/description/index.html | 6 +- .../tests/test_fsm_stock_request.py | 37 +----- .../views/fsm_order.xml | 8 +- .../views/stock_request_order.xml | 9 +- 11 files changed, 84 insertions(+), 141 deletions(-) diff --git a/fieldservice_stock_request/README.rst b/fieldservice_stock_request/README.rst index 545d947921..a91eb6c556 100644 --- a/fieldservice_stock_request/README.rst +++ b/fieldservice_stock_request/README.rst @@ -21,13 +21,13 @@ Field Service - Stock Request :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_stock_request + :target: https://github.com/OCA/field-service/tree/18.0/fieldservice_stock_request :alt: OCA/field-service .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/field-service-17-0/field-service-17-0-fieldservice_stock_request + :target: https://translation.odoo-community.org/projects/field-service-18-0/field-service-18-0-fieldservice_stock_request :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/field-service&target_branch=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| @@ -86,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 +146,6 @@ Current `maintainers `__: |maintainer-brian10048| |maintainer-wolfhall| |maintainer-max3903| |maintainer-smangukiya| -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_stock_request/__manifest__.py b/fieldservice_stock_request/__manifest__.py index 6aefdede21..6b135c3a69 100644 --- a/fieldservice_stock_request/__manifest__.py +++ b/fieldservice_stock_request/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Field Service - Stock Request", "summary": "Integrate Stock Requests with Field Service Orders", - "version": "17.0.1.3.0", + "version": "18.0.1.0.0", "category": "Field Service", "author": "Open Source Integrators, " "Brian McMaster, " diff --git a/fieldservice_stock_request/i18n/fieldservice_stock_request.pot b/fieldservice_stock_request/i18n/fieldservice_stock_request.pot index e9d8167f0f..51bd686cee 100644 --- a/fieldservice_stock_request/i18n/fieldservice_stock_request.pot +++ b/fieldservice_stock_request/i18n/fieldservice_stock_request.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 17.0\n" +"Project-Id-Version: Odoo Server 18.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -70,9 +70,6 @@ msgstr "" #. module: fieldservice_stock_request #. odoo-python #: code:addons/fieldservice_stock_request/models/fsm_order.py:0 -#: code:addons/fieldservice_stock_request/models/fsm_order.py:0 -#: code:addons/fieldservice_stock_request/models/fsm_order.py:0 -#, python-format msgid "Please create a stock request." msgstr "" @@ -119,24 +116,16 @@ msgstr "" #. module: fieldservice_stock_request #. odoo-python #: code:addons/fieldservice_stock_request/models/stock_request.py:0 -#, python-format msgid "" -"There is already a Stock Request Order " -"with the same Field Service Order and " -"Warehouse that is in Draft state. Please " -"add this Stock Request there. (%s)" +"There is already a Stock Request Order with the same Field Service Order " +"and Warehouse that is in Draft state. Please add this Stock Request there. " +"(%s)" msgstr "" #. module: fieldservice_stock_request #. odoo-python #: code:addons/fieldservice_stock_request/models/stock_request.py:0 -#, python-format msgid "" "There is no any inventory Operations Type:stock_request_order record for %s " "Warehouse." msgstr "" - -#. module: fieldservice_stock_request -#: model_terms:ir.ui.view,arch_db:fieldservice_stock_request.stock_request_order_fsm_order_search -msgid "Today Orders" -msgstr "" diff --git a/fieldservice_stock_request/models/fsm_order.py b/fieldservice_stock_request/models/fsm_order.py index d4b4e7bc2a..ec3e9ca2b0 100644 --- a/fieldservice_stock_request/models/fsm_order.py +++ b/fieldservice_stock_request/models/fsm_order.py @@ -1,7 +1,7 @@ # Copyright (C) 2021 - TODAY, Brian McMaster # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import _, api, fields, models +from odoo import api, fields, models from odoo.exceptions import UserError REQUEST_STATES = [ @@ -41,7 +41,7 @@ def _onchange_warehouse_id(self): def action_request_submit(self): for rec in self: if not rec.stock_request_ids: - raise UserError(_("Please create a stock request.")) + raise UserError(self.env._("Please create a stock request.")) for line in rec.stock_request_ids: if line.state == "draft": if line.order_id: @@ -53,7 +53,7 @@ def action_request_submit(self): def action_request_cancel(self): for rec in self: if not rec.stock_request_ids: - raise UserError(_("Please create a stock request.")) + raise UserError(self.env._("Please create a stock request.")) for line in rec.stock_request_ids.filtered( lambda x: x.state in ("draft", "open") ): @@ -66,7 +66,7 @@ def action_request_cancel(self): def action_request_draft(self): for rec in self: if not rec.stock_request_ids: - raise UserError(_("Please create a stock request.")) + raise UserError(self.env._("Please create a stock request.")) for line in rec.stock_request_ids.filtered(lambda x: x.state == "cancel"): if line.order_id: line.order_id.action_draft() diff --git a/fieldservice_stock_request/models/stock_request.py b/fieldservice_stock_request/models/stock_request.py index 478b90a2db..8acf8c19f2 100644 --- a/fieldservice_stock_request/models/stock_request.py +++ b/fieldservice_stock_request/models/stock_request.py @@ -1,7 +1,7 @@ # Copyright (C) 2021 Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import _, api, fields, models +from odoo import api, fields, models from odoo.exceptions import UserError @@ -30,6 +30,7 @@ def _update_stock_request_order_data(self): ("state", "=", "draft"), ], order="id asc", + limit=1, ) self.order_id = order.id @@ -70,77 +71,67 @@ def prepare_order_values(self, vals): "direction": vals["direction"], "location_id": vals["location_id"], } - if "fsm_order_id" in vals and vals["fsm_order_id"]: + if vals.get("fsm_order_id"): res.update({"fsm_order_id": vals["fsm_order_id"]}) return res - @api.model - def create(self, vals): - if "fsm_order_id" in vals and vals["fsm_order_id"]: - fsm_order = self.env["fsm.order"].browse(vals["fsm_order_id"]) - fsm_order.request_stage = "draft" - vals["warehouse_id"] = fsm_order.warehouse_id.id - picking_type_id = self.env["stock.picking.type"].search( - [ - ("code", "=", "stock_request_order"), - ("warehouse_id", "=", vals["warehouse_id"]), - ], - limit=1, - ) - if not picking_type_id: - raise UserError( - _( - "There is no any inventory Operations Type:" - "stock_request_order record for %s Warehouse." - ) - % fsm_order.warehouse_id.display_name + @api.model_create_multi + def create(self, vals_list): + for vals in vals_list: + if vals.get("fsm_order_id"): + fsm_order = self.env["fsm.order"].browse(vals["fsm_order_id"]) + fsm_order.request_stage = "draft" + vals["warehouse_id"] = fsm_order.warehouse_id.id + picking_type_id = self.env["stock.picking.type"].search( + [ + ("code", "=", "stock_request_order"), + ("warehouse_id", "=", vals["warehouse_id"]), + ], + limit=1, ) - order = self.env["stock.request.order"].search( - [ - ("fsm_order_id", "=", vals["fsm_order_id"]), - ("warehouse_id", "=", vals["warehouse_id"]), - ("picking_type_id", "=", picking_type_id.id), - ("direction", "=", vals["direction"]), - ("state", "=", "draft"), - ], - order="id asc", - ) - - # User created a new SRO Manually - if len(order) > 1: - raise UserError( - _( - "There is already a Stock Request Order \ - with the same Field Service Order and \ - Warehouse that is in Draft state. Please \ - add this Stock Request there. \ - (%s)" + if not picking_type_id: + raise UserError( + self.env._( + "There is no any inventory Operations Type:" + "stock_request_order record for %s Warehouse.", + fsm_order.warehouse_id.display_name, + ) ) - % order[0].name + order = self.env["stock.request.order"].search( + [ + ("fsm_order_id", "=", vals["fsm_order_id"]), + ("warehouse_id", "=", vals["warehouse_id"]), + ("picking_type_id", "=", picking_type_id.id), + ("direction", "=", vals["direction"]), + ("state", "=", "draft"), + ], + order="id asc", ) - # Made from an FSO for the first time, create the SRO here - elif not order and vals.get("fsm_order_id"): - values = self.prepare_order_values(vals) - values.update( - { - "picking_type_id": picking_type_id.id, - "warehouse_id": vals["warehouse_id"], - } - ) - if values["direction"] == "inbound": - values.update( - { - "location_id": self.env["stock.warehouse"] - .browse(vals["warehouse_id"]) - .lot_stock_id.id - } + + # User created a new SRO Manually + if len(order) > 1: + raise UserError( + self.env._( + "There is already a Stock Request Order with the same " + "Field Service Order and Warehouse that is in Draft " + "state. Please add this Stock Request there. (%s)", + order[0].name, + ) ) - vals["order_id"] = self.env["stock.request.order"].create(values).id - # There is an SRO made from FSO, assign here - elif len(order) == 1 and vals.get("fsm_order_id"): - vals["expected_date"] = order.expected_date - vals["order_id"] = order.id - return super().create(vals) + # Made from an FSO for the first time, create the SRO here + elif not order: + values = self.prepare_order_values(vals) + values.update({"picking_type_id": picking_type_id.id}) + if values["direction"] == "inbound": + values.update( + {"location_id": fsm_order.warehouse_id.lot_stock_id.id} + ) + vals["order_id"] = self.env["stock.request.order"].create(values).id + # There is an SRO made from FSO, assign here + else: + vals["expected_date"] = order.expected_date + vals["order_id"] = order.id + return super().create(vals_list) def _prepare_procurement_values(self, group_id=False): res = super()._prepare_procurement_values(group_id=group_id) diff --git a/fieldservice_stock_request/models/stock_request_order.py b/fieldservice_stock_request/models/stock_request_order.py index 18cd37d6f2..1ed1a13194 100644 --- a/fieldservice_stock_request/models/stock_request_order.py +++ b/fieldservice_stock_request/models/stock_request_order.py @@ -17,7 +17,9 @@ class StockRequestOrder(models.Model): store=True, ) actual_delivery_date = fields.Datetime( - string="Actual Delivery Date", related="fsm_order_id.date_end", store=True + related="fsm_order_id.date_end", + string="Actual Delivery Date", + store=True, ) @api.onchange("warehouse_id", "direction", "fsm_order_id") diff --git a/fieldservice_stock_request/readme/CONTRIBUTORS.md b/fieldservice_stock_request/readme/CONTRIBUTORS.md index a5a6ca2d56..fd87887580 100644 --- a/fieldservice_stock_request/readme/CONTRIBUTORS.md +++ b/fieldservice_stock_request/readme/CONTRIBUTORS.md @@ -3,3 +3,4 @@ - Serpent Consulting Services Pvt. Ltd. \<\> - [APSL-Nagarro](): - Antoni Marroig \<\> +- Jimmy SC94 diff --git a/fieldservice_stock_request/static/description/index.html b/fieldservice_stock_request/static/description/index.html index 4c9cd04c60..f4635c7c62 100755 --- a/fieldservice_stock_request/static/description/index.html +++ b/fieldservice_stock_request/static/description/index.html @@ -374,7 +374,7 @@

Field Service - Stock Request

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:d6b126a091b6a205042535b90ff4f8a2e2950e0a21617decb74546fd3f94e4f1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

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

Table of contents

@@ -437,7 +437,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.

@@ -479,7 +479,7 @@

Maintainers

promote its widespread use.

Current maintainers:

brian10048 wolfhall max3903 smangukiya

-

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_stock_request/tests/test_fsm_stock_request.py b/fieldservice_stock_request/tests/test_fsm_stock_request.py index 16c0486c6c..f3895b0773 100644 --- a/fieldservice_stock_request/tests/test_fsm_stock_request.py +++ b/fieldservice_stock_request/tests/test_fsm_stock_request.py @@ -24,14 +24,14 @@ def setUpClass(cls): cls.product_1 = cls.Product.create( { "name": "Product 1", - "type": "product", + "is_storable": True, "categ_id": cls.env.ref("product.product_category_all").id, } ) cls.product_2 = cls.Product.create( { "name": "Product 2", - "type": "product", + "is_storable": True, "categ_id": cls.env.ref("product.product_category_all").id, } ) @@ -442,36 +442,3 @@ def test_stock_request_confirm_with_FSM(self): }, ) stock_request.order_id.action_confirm() - - def test_onchange_warehouse_id(self): - fsm_order = self.FSMOrder.create( - { - "location_id": self.test_location.id, - "warehouse_id": self.warehouse.id, - } - ) - stock_request = self.StockRequest.create( - { - "warehouse_id": fsm_order.warehouse_id.id, - "location_id": fsm_order.inventory_location_id.id, - "product_id": self.product_1.id, - "product_uom_qty": 1, - "product_uom_id": self.product_1.uom_id.id, - "fsm_order_id": fsm_order.id, - "direction": "outbound", - "expected_date": datetime.datetime.now(), - "picking_policy": "direct", - } - ) - warehouse2 = self.env["stock.warehouse"].create( - { - "name": "Test Warehouse 2", - "code": "TW2", - } - ) - fsm_order.warehouse_id = warehouse2 - fsm_order._onchange_warehouse_id() - self.assertEqual( - stock_request.location_id, - warehouse2.lot_stock_id, - ) diff --git a/fieldservice_stock_request/views/fsm_order.xml b/fieldservice_stock_request/views/fsm_order.xml index 00993a1441..066a703be2 100644 --- a/fieldservice_stock_request/views/fsm_order.xml +++ b/fieldservice_stock_request/views/fsm_order.xml @@ -29,12 +29,12 @@ type="object" string="Cancel" /> - + - + @@ -59,11 +59,11 @@ - + - + diff --git a/fieldservice_stock_request/views/stock_request_order.xml b/fieldservice_stock_request/views/stock_request_order.xml index 7eaa379f85..d52a6e8e75 100644 --- a/fieldservice_stock_request/views/stock_request_order.xml +++ b/fieldservice_stock_request/views/stock_request_order.xml @@ -20,7 +20,7 @@ 'default_state': state}
@@ -56,13 +56,6 @@ context="{'group_by': 'fsm_order_id'}" />
- - -