From f576e0c7ff612a42e3a1b9cac208f0c83fa5fc19 Mon Sep 17 00:00:00 2001 From: brian10048 Date: Sat, 21 Nov 2020 13:05:46 -0500 Subject: [PATCH 01/23] [IMP] fieldservice_stock: Split equipment Remove the equipment related functionality from the fieldservice_stock module and make into separate module --- fieldservice_equipment_stock/README.rst | 138 +++++ fieldservice_equipment_stock/__init__.py | 4 + fieldservice_equipment_stock/__manifest__.py | 31 ++ .../i18n/fieldservice_equipment_stock.pot | 81 +++ .../migrations/12.0.1.0.0/post-migration.py | 13 + .../models/__init__.py | 7 + .../models/fsm_equipment.py | 50 ++ .../models/product_template.py | 10 + .../models/stock_move.py | 30 ++ .../models/stock_picking_type.py | 13 + .../models/stock_production_lot.py | 11 + .../readme/CONFIGURE.rst | 20 + .../readme/CONTRIBUTORS.rst | 4 + .../readme/CREDITS.rst | 3 + .../readme/DESCRIPTION.rst | 2 + .../readme/ROADMAP.rst | 2 + fieldservice_equipment_stock/readme/USAGE.rst | 2 + .../security/ir.model.access.csv | 2 + .../static/description/index.html | 470 ++++++++++++++++++ .../tests/__init__.py | 4 + .../tests/test_fsm_equipment.py | 44 ++ .../views/fsm_equipment.xml | 33 ++ .../views/product_template.xml | 16 + .../views/stock_picking_type.xml | 16 + .../views/stock_production_lot.xml | 24 + 25 files changed, 1030 insertions(+) create mode 100644 fieldservice_equipment_stock/README.rst create mode 100644 fieldservice_equipment_stock/__init__.py create mode 100644 fieldservice_equipment_stock/__manifest__.py create mode 100644 fieldservice_equipment_stock/i18n/fieldservice_equipment_stock.pot create mode 100644 fieldservice_equipment_stock/migrations/12.0.1.0.0/post-migration.py create mode 100644 fieldservice_equipment_stock/models/__init__.py create mode 100644 fieldservice_equipment_stock/models/fsm_equipment.py create mode 100644 fieldservice_equipment_stock/models/product_template.py create mode 100644 fieldservice_equipment_stock/models/stock_move.py create mode 100644 fieldservice_equipment_stock/models/stock_picking_type.py create mode 100644 fieldservice_equipment_stock/models/stock_production_lot.py create mode 100644 fieldservice_equipment_stock/readme/CONFIGURE.rst create mode 100644 fieldservice_equipment_stock/readme/CONTRIBUTORS.rst create mode 100644 fieldservice_equipment_stock/readme/CREDITS.rst create mode 100644 fieldservice_equipment_stock/readme/DESCRIPTION.rst create mode 100644 fieldservice_equipment_stock/readme/ROADMAP.rst create mode 100644 fieldservice_equipment_stock/readme/USAGE.rst create mode 100644 fieldservice_equipment_stock/security/ir.model.access.csv create mode 100644 fieldservice_equipment_stock/static/description/index.html create mode 100644 fieldservice_equipment_stock/tests/__init__.py create mode 100644 fieldservice_equipment_stock/tests/test_fsm_equipment.py create mode 100644 fieldservice_equipment_stock/views/fsm_equipment.xml create mode 100644 fieldservice_equipment_stock/views/product_template.xml create mode 100644 fieldservice_equipment_stock/views/stock_picking_type.xml create mode 100644 fieldservice_equipment_stock/views/stock_production_lot.xml diff --git a/fieldservice_equipment_stock/README.rst b/fieldservice_equipment_stock/README.rst new file mode 100644 index 0000000000..a28a09a020 --- /dev/null +++ b/fieldservice_equipment_stock/README.rst @@ -0,0 +1,138 @@ +=============================== +Field Service - Stock Equipment +=============================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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_equipment_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_equipment_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 allows you to track your FSM Equipments in stock moves. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +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 +===== + +A completed stock move for a properly configured Product on a configured +stock Operation Type will automatically create a field service equipment. + +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. +* Marcel Savegnago + +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_equipment_stock/__init__.py b/fieldservice_equipment_stock/__init__.py new file mode 100644 index 0000000000..e27a9c3831 --- /dev/null +++ b/fieldservice_equipment_stock/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2020, Brian McMaster +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/fieldservice_equipment_stock/__manifest__.py b/fieldservice_equipment_stock/__manifest__.py new file mode 100644 index 0000000000..97931b2d09 --- /dev/null +++ b/fieldservice_equipment_stock/__manifest__.py @@ -0,0 +1,31 @@ +# Copyright (C) 2020, Brian McMaster +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': 'Field Service - Stock Equipment', + 'summary': 'Integrate stock operations with your field service equipments', + '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', + ], + 'data': [ + 'security/ir.model.access.csv', + 'views/fsm_equipment.xml', + 'views/product_template.xml', + 'views/stock_picking_type.xml', + 'views/stock_production_lot.xml', + ], + 'license': 'AGPL-3', + 'development_status': 'Beta', + 'maintainers': [ + 'brian10048', + 'wolfhall', + 'max3903', + 'smangukiya', + ], +} diff --git a/fieldservice_equipment_stock/i18n/fieldservice_equipment_stock.pot b/fieldservice_equipment_stock/i18n/fieldservice_equipment_stock.pot new file mode 100644 index 0000000000..99245a7fba --- /dev/null +++ b/fieldservice_equipment_stock/i18n/fieldservice_equipment_stock.pot @@ -0,0 +1,81 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_equipment_stock +# +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_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_picking_type__create_fsm_equipment +msgid "Create Fsm Equipment" +msgstr "" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_product_product__create_fsm_equipment +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_product_template__create_fsm_equipment +msgid "Creates a FSM Equipment" +msgstr "" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment__current_stock_location_id +msgid "Current Inventory Location" +msgstr "" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_production_lot__fsm_equipment_id +msgid "Equipment" +msgstr "" + +#. module: fieldservice_equipment_stock +#: model:ir.model,name:fieldservice_equipment_stock.model_fsm_equipment +msgid "Field Service Equipment" +msgstr "" + +#. module: fieldservice_equipment_stock +#: model_terms:ir.ui.view,arch_db:fieldservice_equipment_stock.fsm_equipment_form_view_stock +msgid "Inventory" +msgstr "" + +#. module: fieldservice_equipment_stock +#: model:ir.model,name:fieldservice_equipment_stock.model_stock_production_lot +msgid "Lot/Serial" +msgstr "" + +#. module: fieldservice_equipment_stock +#: model:ir.model,name:fieldservice_equipment_stock.model_stock_picking_type +msgid "Picking Type" +msgstr "" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment__product_id +msgid "Product" +msgstr "" + +#. module: fieldservice_equipment_stock +#: model:ir.model,name:fieldservice_equipment_stock.model_product_template +msgid "Product Template" +msgstr "" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,help:fieldservice_equipment_stock.field_stock_picking_type__create_fsm_equipment +msgid "Products with the 'Creates a FSM Equipment' flag will automatically be converted to an FSM Equipment." +msgstr "" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment__lot_id +msgid "Serial #" +msgstr "" + +#. module: fieldservice_equipment_stock +#: model:ir.model,name:fieldservice_equipment_stock.model_stock_move +msgid "Stock Move" +msgstr "" + diff --git a/fieldservice_equipment_stock/migrations/12.0.1.0.0/post-migration.py b/fieldservice_equipment_stock/migrations/12.0.1.0.0/post-migration.py new file mode 100644 index 0000000000..2855328b90 --- /dev/null +++ b/fieldservice_equipment_stock/migrations/12.0.1.0.0/post-migration.py @@ -0,0 +1,13 @@ +# Copyright (C) 2020, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +def migrate(env, version): + if not version: + return + + env.execute(""" + UPDATE stock_picking_type + SET create_fsm_equipment = 'true' + WHERE code = 'outgoing'; + """) diff --git a/fieldservice_equipment_stock/models/__init__.py b/fieldservice_equipment_stock/models/__init__.py new file mode 100644 index 0000000000..3f2717ba38 --- /dev/null +++ b/fieldservice_equipment_stock/models/__init__.py @@ -0,0 +1,7 @@ +from . import ( + stock_move, + stock_picking_type, + fsm_equipment, + product_template, + stock_production_lot, +) diff --git a/fieldservice_equipment_stock/models/fsm_equipment.py b/fieldservice_equipment_stock/models/fsm_equipment.py new file mode 100644 index 0000000000..0093df66c6 --- /dev/null +++ b/fieldservice_equipment_stock/models/fsm_equipment.py @@ -0,0 +1,50 @@ +# Copyright (C) 2018 - TODAY, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class FSMEquipment(models.Model): + _inherit = 'fsm.equipment' + + product_id = fields.Many2one( + 'product.product', string='Product', required=True) + lot_id = fields.Many2one( + 'stock.production.lot', string='Serial #', required=True) + current_stock_location_id = fields.Many2one( + 'stock.location', string='Current Inventory Location', + compute='_compute_current_stock_loc_id') + + @api.depends('product_id', 'lot_id') + def _compute_current_stock_loc_id(self): + for equipment in self: + quants = self.env['stock.quant'].search( + [('lot_id', '=', equipment.lot_id.id)], order="id desc", + limit=1) + if quants and quants.location_id: + equipment.current_stock_location_id = \ + quants.location_id.id + else: + equipment.current_stock_location_id = False + + @api.onchange('product_id') + def _onchange_product(self): + for equipment in self: + self.current_stock_location_id = False + + @api.model + def create(self, vals): + res = super(FSMEquipment, self).create(vals) + if 'lot_id' in vals: + res.lot_id.fsm_equipment_id = res.id + return res + + @api.multi + def write(self, vals): + for equipment in self: + prev_lot = equipment.lot_id + res = super(FSMEquipment, equipment).write(vals) + if 'lot_id' in vals: + prev_lot.fsm_equipment_id = False + equipment.lot_id.fsm_equipment_id = equipment.id + return res diff --git a/fieldservice_equipment_stock/models/product_template.py b/fieldservice_equipment_stock/models/product_template.py new file mode 100644 index 0000000000..54195f55d7 --- /dev/null +++ b/fieldservice_equipment_stock/models/product_template.py @@ -0,0 +1,10 @@ +# Copyright (C) 2018 - TODAY, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ProductTemplate(models.Model): + _inherit = 'product.template' + + create_fsm_equipment = fields.Boolean(string='Creates a FSM Equipment') diff --git a/fieldservice_equipment_stock/models/stock_move.py b/fieldservice_equipment_stock/models/stock_move.py new file mode 100644 index 0000000000..e3e3133794 --- /dev/null +++ b/fieldservice_equipment_stock/models/stock_move.py @@ -0,0 +1,30 @@ +# Copyright (C) 2018 Brian McMaster +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import models + + +class StockMove(models.Model): + _inherit = "stock.move" + + def prepare_equipment_values(self, move_line): + return {'name': '%s (%s)' % ( + move_line.product_id.name, move_line.lot_id.name), + 'product_id': move_line.product_id.id, + 'lot_id': move_line.lot_id.id, + 'location_id': + move_line.move_id.stock_request_ids.fsm_order_id.location_id.id, + 'current_location_id': + move_line.move_id.stock_request_ids.fsm_order_id.location_id.id, + 'current_stock_location_id': move_line.location_dest_id.id} + + def _action_done(self): + res = super()._action_done() + for rec in self: + if (rec.state == 'done' + and rec.picking_type_id.create_fsm_equipment + and rec.product_tmpl_id.create_fsm_equipment): + for line in rec.move_line_ids: + vals = self.prepare_equipment_values(line) + line.lot_id.fsm_equipment_id = \ + rec.env['fsm.equipment'].create(vals) + return res diff --git a/fieldservice_equipment_stock/models/stock_picking_type.py b/fieldservice_equipment_stock/models/stock_picking_type.py new file mode 100644 index 0000000000..5fe0671881 --- /dev/null +++ b/fieldservice_equipment_stock/models/stock_picking_type.py @@ -0,0 +1,13 @@ +# Copyright (C) 2020 Open Source Integrators, Daniel Reis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class StockPickingType(models.Model): + _inherit = 'stock.picking.type' + + create_fsm_equipment = fields.Boolean( + name="Create FSM Equipment", + help="Products with the 'Creates a FSM Equipment' flag " + "will automatically be converted to an FSM Equipment." + ) diff --git a/fieldservice_equipment_stock/models/stock_production_lot.py b/fieldservice_equipment_stock/models/stock_production_lot.py new file mode 100644 index 0000000000..5e52651e3e --- /dev/null +++ b/fieldservice_equipment_stock/models/stock_production_lot.py @@ -0,0 +1,11 @@ +# Copyright (C) 2018 - TODAY, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class StockProductionLot(models.Model): + _inherit = 'stock.production.lot' + + fsm_equipment_id = fields.Many2one('fsm.equipment', + string='Equipment', readonly=True) diff --git a/fieldservice_equipment_stock/readme/CONFIGURE.rst b/fieldservice_equipment_stock/readme/CONFIGURE.rst new file mode 100644 index 0000000000..863d148ca1 --- /dev/null +++ b/fieldservice_equipment_stock/readme/CONFIGURE.rst @@ -0,0 +1,20 @@ +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 diff --git a/fieldservice_equipment_stock/readme/CONTRIBUTORS.rst b/fieldservice_equipment_stock/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..5db5c162c6 --- /dev/null +++ b/fieldservice_equipment_stock/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* Brian McMaster +* Sandip Mangukiya +* Serpent Consulting Services Pvt. Ltd. +* Marcel Savegnago diff --git a/fieldservice_equipment_stock/readme/CREDITS.rst b/fieldservice_equipment_stock/readme/CREDITS.rst new file mode 100644 index 0000000000..0eff0acf4e --- /dev/null +++ b/fieldservice_equipment_stock/readme/CREDITS.rst @@ -0,0 +1,3 @@ +The development of this module has been financially supported by: + +* Open Source Integrators diff --git a/fieldservice_equipment_stock/readme/DESCRIPTION.rst b/fieldservice_equipment_stock/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..bb3d99466c --- /dev/null +++ b/fieldservice_equipment_stock/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module is an add-on for the Field Service application in Odoo. +It allows you to track your FSM Equipments in stock moves. diff --git a/fieldservice_equipment_stock/readme/ROADMAP.rst b/fieldservice_equipment_stock/readme/ROADMAP.rst new file mode 100644 index 0000000000..f607015959 --- /dev/null +++ b/fieldservice_equipment_stock/readme/ROADMAP.rst @@ -0,0 +1,2 @@ +The roadmap of the Field Service application is documented on +`Github `_. diff --git a/fieldservice_equipment_stock/readme/USAGE.rst b/fieldservice_equipment_stock/readme/USAGE.rst new file mode 100644 index 0000000000..09534067ba --- /dev/null +++ b/fieldservice_equipment_stock/readme/USAGE.rst @@ -0,0 +1,2 @@ +A completed stock move for a properly configured Product on a configured +stock Operation Type will automatically create a field service equipment. diff --git a/fieldservice_equipment_stock/security/ir.model.access.csv b/fieldservice_equipment_stock/security/ir.model.access.csv new file mode 100644 index 0000000000..431ba34601 --- /dev/null +++ b/fieldservice_equipment_stock/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_stock_picking_type_portal,access.stock.picking.type.portal,stock.model_stock_picking_type,base.group_portal,1,0,0,0 diff --git a/fieldservice_equipment_stock/static/description/index.html b/fieldservice_equipment_stock/static/description/index.html new file mode 100644 index 0000000000..24708b961b --- /dev/null +++ b/fieldservice_equipment_stock/static/description/index.html @@ -0,0 +1,470 @@ + + + + + + +Field Service - Stock Equipment + + + +
+

Field Service - Stock Equipment

+ + +

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 allows you to track your FSM Equipments in stock moves.

+

Table of contents

+ +
+

Configuration

+

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

+

A completed stock move for a properly configured Product on a configured +stock Operation Type will automatically create a field service equipment.

+
+
+

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_equipment_stock/tests/__init__.py b/fieldservice_equipment_stock/tests/__init__.py new file mode 100644 index 0000000000..50a5826fe6 --- /dev/null +++ b/fieldservice_equipment_stock/tests/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2020 - TODAY, Marcel Savegnago (Escodoo) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) + +from . import test_fsm_equipment diff --git a/fieldservice_equipment_stock/tests/test_fsm_equipment.py b/fieldservice_equipment_stock/tests/test_fsm_equipment.py new file mode 100644 index 0000000000..c6488b2598 --- /dev/null +++ b/fieldservice_equipment_stock/tests/test_fsm_equipment.py @@ -0,0 +1,44 @@ +# Copyright (C) 2020 - TODAY, Marcel Savegnago (Escodoo) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo.tests.common import TransactionCase + + +class TestFSMEquipment(TransactionCase): + + def setUp(self): + super(TestFSMEquipment, self).setUp() + self.Equipment = self.env['fsm.equipment'] + self.stock_location = self.env.ref('stock.stock_location_customers') + + product1 = self.env['product.product'].create({ + 'name': 'Product A', + 'type': 'product', + 'tracking': 'serial', + }) + lot1 = self.env['stock.production.lot'].create({ + 'name': 'serial1', + 'product_id': product1.id, + }) + self.env['stock.quant'].create({ + 'product_id': product1.id, + 'location_id': self.stock_location.id, + 'quantity': 1.0, + 'lot_id': lot1.id, + }) + + self.equipment = self.Equipment.create({ + 'name': 'Equipment 1', + 'product_id': product1.id, + 'lot_id': lot1.id, + 'current_stock_location_id': self.stock_location.id, + }) + + def test_onchange_product(self): + equipment = self.equipment + equipment._onchange_product() + self.assertFalse(equipment.current_stock_location_id) + + def test_compute_current_stock_loc_id(self): + equipment = self.equipment + equipment._compute_current_stock_loc_id() + self.assertTrue(equipment.current_stock_location_id == self.stock_location) diff --git a/fieldservice_equipment_stock/views/fsm_equipment.xml b/fieldservice_equipment_stock/views/fsm_equipment.xml new file mode 100644 index 0000000000..1ce8ae287f --- /dev/null +++ b/fieldservice_equipment_stock/views/fsm_equipment.xml @@ -0,0 +1,33 @@ + + + + + fsm.equipment.form.stock + fsm.equipment + + + + + + + + + + + + + + fsm.equipment.model + fsm.equipment + + + + + + + + diff --git a/fieldservice_equipment_stock/views/product_template.xml b/fieldservice_equipment_stock/views/product_template.xml new file mode 100644 index 0000000000..6b9d6f36e3 --- /dev/null +++ b/fieldservice_equipment_stock/views/product_template.xml @@ -0,0 +1,16 @@ + + + + + product.template + + + + + + + + + diff --git a/fieldservice_equipment_stock/views/stock_picking_type.xml b/fieldservice_equipment_stock/views/stock_picking_type.xml new file mode 100644 index 0000000000..d197e10f6a --- /dev/null +++ b/fieldservice_equipment_stock/views/stock_picking_type.xml @@ -0,0 +1,16 @@ + + + + + stock.picking.type + + + + + + + + + + + diff --git a/fieldservice_equipment_stock/views/stock_production_lot.xml b/fieldservice_equipment_stock/views/stock_production_lot.xml new file mode 100644 index 0000000000..4f23b37cad --- /dev/null +++ b/fieldservice_equipment_stock/views/stock_production_lot.xml @@ -0,0 +1,24 @@ + + + + + stock.production.lot + + + + + + + + + + + + {'search_default_group_by_product': 1, + 'default_product_id': context.get('product_id', False)} + + + + From 253ea67d48acbfff3ca03d4fd798dfd7bf8509e7 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 9 Mar 2021 22:53:52 +0000 Subject: [PATCH 02/23] [ADD] icon.png --- .../static/description/icon.png | Bin 0 -> 9455 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 fieldservice_equipment_stock/static/description/icon.png diff --git a/fieldservice_equipment_stock/static/description/icon.png b/fieldservice_equipment_stock/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_jq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x{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 748e85ec65613379c37cc36f435d89a201586447 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 9 Mar 2021 22:54:06 +0000 Subject: [PATCH 03/23] fieldservice_equipment_stock 12.0.2.0.0 Added translation using Weblate (Portuguese (Brazil)) Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (13 of 13 strings) Translation: field-service-12.0/field-service-12.0-fieldservice_equipment_stock Translate-URL: https://translation.odoo-community.org/projects/field-service-12-0/field-service-12-0-fieldservice_equipment_stock/pt_BR/ --- fieldservice_equipment_stock/__manifest__.py | 2 +- fieldservice_equipment_stock/i18n/pt_BR.po | 85 ++++++++++++++++++++ 2 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 fieldservice_equipment_stock/i18n/pt_BR.po diff --git a/fieldservice_equipment_stock/__manifest__.py b/fieldservice_equipment_stock/__manifest__.py index 97931b2d09..136b66512d 100644 --- a/fieldservice_equipment_stock/__manifest__.py +++ b/fieldservice_equipment_stock/__manifest__.py @@ -4,7 +4,7 @@ { 'name': 'Field Service - Stock Equipment', 'summary': 'Integrate stock operations with your field service equipments', - '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_equipment_stock/i18n/pt_BR.po b/fieldservice_equipment_stock/i18n/pt_BR.po new file mode 100644 index 0000000000..8320a3aa66 --- /dev/null +++ b/fieldservice_equipment_stock/i18n/pt_BR.po @@ -0,0 +1,85 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_equipment_stock +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-03-15 05:45+0000\n" +"Last-Translator: Marcel Savegnago \n" +"Language-Team: none\n" +"Language: pt_BR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_picking_type__create_fsm_equipment +msgid "Create Fsm Equipment" +msgstr "Criar Equipamentos FSM" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_product_product__create_fsm_equipment +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_product_template__create_fsm_equipment +msgid "Creates a FSM Equipment" +msgstr "Cria um Equipamento FSM" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment__current_stock_location_id +msgid "Current Inventory Location" +msgstr "Localização de Inventário Atual" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_production_lot__fsm_equipment_id +msgid "Equipment" +msgstr "Equipamento" + +#. module: fieldservice_equipment_stock +#: model:ir.model,name:fieldservice_equipment_stock.model_fsm_equipment +msgid "Field Service Equipment" +msgstr "Equipamento de Serviço de Campo" + +#. module: fieldservice_equipment_stock +#: model_terms:ir.ui.view,arch_db:fieldservice_equipment_stock.fsm_equipment_form_view_stock +msgid "Inventory" +msgstr "Inventário" + +#. module: fieldservice_equipment_stock +#: model:ir.model,name:fieldservice_equipment_stock.model_stock_production_lot +msgid "Lot/Serial" +msgstr "Lote/Serie" + +#. module: fieldservice_equipment_stock +#: model:ir.model,name:fieldservice_equipment_stock.model_stock_picking_type +msgid "Picking Type" +msgstr "Tipo de Separação" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment__product_id +msgid "Product" +msgstr "Produto" + +#. module: fieldservice_equipment_stock +#: model:ir.model,name:fieldservice_equipment_stock.model_product_template +msgid "Product Template" +msgstr "Modelo de Produto" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,help:fieldservice_equipment_stock.field_stock_picking_type__create_fsm_equipment +msgid "Products with the 'Creates a FSM Equipment' flag will automatically be converted to an FSM Equipment." +msgstr "" +"Produtos com o sinalizador ‘Cria um Equipamento FSM’ serão automaticamente " +"convertidos em um Equipamento FSM." + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment__lot_id +msgid "Serial #" +msgstr "Série #" + +#. module: fieldservice_equipment_stock +#: model:ir.model,name:fieldservice_equipment_stock.model_stock_move +msgid "Stock Move" +msgstr "Movimento de Estoque" From c27c15597ba1b53cf43c34ebc218e011022c58ca Mon Sep 17 00:00:00 2001 From: Reed Hayashikawa Date: Fri, 2 Jul 2021 09:23:57 -0700 Subject: [PATCH 04/23] [IMP] fieldservice_equipment_stock: black, isort, prettier --- fieldservice_equipment_stock/__manifest__.py | 46 ++++++++-------- .../migrations/12.0.1.0.0/post-migration.py | 6 +- .../models/fsm_equipment.py | 31 +++++------ .../models/product_template.py | 4 +- .../models/stock_move.py | 28 +++++----- .../models/stock_picking_type.py | 4 +- .../models/stock_production_lot.py | 7 ++- .../tests/test_fsm_equipment.py | 55 +++++++++++-------- .../views/fsm_equipment.xml | 24 ++++---- .../views/product_template.xml | 11 ++-- .../views/stock_picking_type.xml | 6 +- .../views/stock_production_lot.xml | 16 +++--- 12 files changed, 125 insertions(+), 113 deletions(-) diff --git a/fieldservice_equipment_stock/__manifest__.py b/fieldservice_equipment_stock/__manifest__.py index 136b66512d..c8bb0f1607 100644 --- a/fieldservice_equipment_stock/__manifest__.py +++ b/fieldservice_equipment_stock/__manifest__.py @@ -2,30 +2,30 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { - 'name': 'Field Service - Stock Equipment', - 'summary': 'Integrate stock operations with your field service equipments', - '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', + "name": "Field Service - Stock Equipment", + "summary": "Integrate stock operations with your field service equipments", + "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", ], - 'data': [ - 'security/ir.model.access.csv', - 'views/fsm_equipment.xml', - 'views/product_template.xml', - 'views/stock_picking_type.xml', - 'views/stock_production_lot.xml', + "data": [ + "security/ir.model.access.csv", + "views/fsm_equipment.xml", + "views/product_template.xml", + "views/stock_picking_type.xml", + "views/stock_production_lot.xml", ], - 'license': 'AGPL-3', - 'development_status': 'Beta', - 'maintainers': [ - 'brian10048', - 'wolfhall', - 'max3903', - 'smangukiya', + "license": "AGPL-3", + "development_status": "Beta", + "maintainers": [ + "brian10048", + "wolfhall", + "max3903", + "smangukiya", ], } diff --git a/fieldservice_equipment_stock/migrations/12.0.1.0.0/post-migration.py b/fieldservice_equipment_stock/migrations/12.0.1.0.0/post-migration.py index 2855328b90..c3221ab722 100644 --- a/fieldservice_equipment_stock/migrations/12.0.1.0.0/post-migration.py +++ b/fieldservice_equipment_stock/migrations/12.0.1.0.0/post-migration.py @@ -6,8 +6,10 @@ def migrate(env, version): if not version: return - env.execute(""" + env.execute( + """ UPDATE stock_picking_type SET create_fsm_equipment = 'true' WHERE code = 'outgoing'; - """) + """ + ) diff --git a/fieldservice_equipment_stock/models/fsm_equipment.py b/fieldservice_equipment_stock/models/fsm_equipment.py index 0093df66c6..6a25ed3afe 100644 --- a/fieldservice_equipment_stock/models/fsm_equipment.py +++ b/fieldservice_equipment_stock/models/fsm_equipment.py @@ -5,29 +5,28 @@ class FSMEquipment(models.Model): - _inherit = 'fsm.equipment' + _inherit = "fsm.equipment" - product_id = fields.Many2one( - 'product.product', string='Product', required=True) - lot_id = fields.Many2one( - 'stock.production.lot', string='Serial #', required=True) + product_id = fields.Many2one("product.product", string="Product", required=True) + lot_id = fields.Many2one("stock.production.lot", string="Serial #", required=True) current_stock_location_id = fields.Many2one( - 'stock.location', string='Current Inventory Location', - compute='_compute_current_stock_loc_id') + "stock.location", + string="Current Inventory Location", + compute="_compute_current_stock_loc_id", + ) - @api.depends('product_id', 'lot_id') + @api.depends("product_id", "lot_id") def _compute_current_stock_loc_id(self): for equipment in self: - quants = self.env['stock.quant'].search( - [('lot_id', '=', equipment.lot_id.id)], order="id desc", - limit=1) + quants = self.env["stock.quant"].search( + [("lot_id", "=", equipment.lot_id.id)], order="id desc", limit=1 + ) if quants and quants.location_id: - equipment.current_stock_location_id = \ - quants.location_id.id + equipment.current_stock_location_id = quants.location_id.id else: equipment.current_stock_location_id = False - @api.onchange('product_id') + @api.onchange("product_id") def _onchange_product(self): for equipment in self: self.current_stock_location_id = False @@ -35,7 +34,7 @@ def _onchange_product(self): @api.model def create(self, vals): res = super(FSMEquipment, self).create(vals) - if 'lot_id' in vals: + if "lot_id" in vals: res.lot_id.fsm_equipment_id = res.id return res @@ -44,7 +43,7 @@ def write(self, vals): for equipment in self: prev_lot = equipment.lot_id res = super(FSMEquipment, equipment).write(vals) - if 'lot_id' in vals: + if "lot_id" in vals: prev_lot.fsm_equipment_id = False equipment.lot_id.fsm_equipment_id = equipment.id return res diff --git a/fieldservice_equipment_stock/models/product_template.py b/fieldservice_equipment_stock/models/product_template.py index 54195f55d7..d0bb3485db 100644 --- a/fieldservice_equipment_stock/models/product_template.py +++ b/fieldservice_equipment_stock/models/product_template.py @@ -5,6 +5,6 @@ class ProductTemplate(models.Model): - _inherit = 'product.template' + _inherit = "product.template" - create_fsm_equipment = fields.Boolean(string='Creates a FSM Equipment') + create_fsm_equipment = fields.Boolean(string="Creates a FSM Equipment") diff --git a/fieldservice_equipment_stock/models/stock_move.py b/fieldservice_equipment_stock/models/stock_move.py index e3e3133794..0547419e32 100644 --- a/fieldservice_equipment_stock/models/stock_move.py +++ b/fieldservice_equipment_stock/models/stock_move.py @@ -7,24 +7,24 @@ class StockMove(models.Model): _inherit = "stock.move" def prepare_equipment_values(self, move_line): - return {'name': '%s (%s)' % ( - move_line.product_id.name, move_line.lot_id.name), - 'product_id': move_line.product_id.id, - 'lot_id': move_line.lot_id.id, - 'location_id': - move_line.move_id.stock_request_ids.fsm_order_id.location_id.id, - 'current_location_id': - move_line.move_id.stock_request_ids.fsm_order_id.location_id.id, - 'current_stock_location_id': move_line.location_dest_id.id} + return { + "name": "%s (%s)" % (move_line.product_id.name, move_line.lot_id.name), + "product_id": move_line.product_id.id, + "lot_id": move_line.lot_id.id, + "location_id": move_line.move_id.stock_request_ids.fsm_order_id.location_id.id, + "current_location_id": move_line.move_id.stock_request_ids.fsm_order_id.location_id.id, + "current_stock_location_id": move_line.location_dest_id.id, + } def _action_done(self): res = super()._action_done() for rec in self: - if (rec.state == 'done' - and rec.picking_type_id.create_fsm_equipment - and rec.product_tmpl_id.create_fsm_equipment): + if ( + rec.state == "done" + and rec.picking_type_id.create_fsm_equipment + and rec.product_tmpl_id.create_fsm_equipment + ): for line in rec.move_line_ids: vals = self.prepare_equipment_values(line) - line.lot_id.fsm_equipment_id = \ - rec.env['fsm.equipment'].create(vals) + line.lot_id.fsm_equipment_id = rec.env["fsm.equipment"].create(vals) return res diff --git a/fieldservice_equipment_stock/models/stock_picking_type.py b/fieldservice_equipment_stock/models/stock_picking_type.py index 5fe0671881..f4001b609e 100644 --- a/fieldservice_equipment_stock/models/stock_picking_type.py +++ b/fieldservice_equipment_stock/models/stock_picking_type.py @@ -4,10 +4,10 @@ class StockPickingType(models.Model): - _inherit = 'stock.picking.type' + _inherit = "stock.picking.type" create_fsm_equipment = fields.Boolean( name="Create FSM Equipment", help="Products with the 'Creates a FSM Equipment' flag " - "will automatically be converted to an FSM Equipment." + "will automatically be converted to an FSM Equipment.", ) diff --git a/fieldservice_equipment_stock/models/stock_production_lot.py b/fieldservice_equipment_stock/models/stock_production_lot.py index 5e52651e3e..c8430c080e 100644 --- a/fieldservice_equipment_stock/models/stock_production_lot.py +++ b/fieldservice_equipment_stock/models/stock_production_lot.py @@ -5,7 +5,8 @@ class StockProductionLot(models.Model): - _inherit = 'stock.production.lot' + _inherit = "stock.production.lot" - fsm_equipment_id = fields.Many2one('fsm.equipment', - string='Equipment', readonly=True) + fsm_equipment_id = fields.Many2one( + "fsm.equipment", string="Equipment", readonly=True + ) diff --git a/fieldservice_equipment_stock/tests/test_fsm_equipment.py b/fieldservice_equipment_stock/tests/test_fsm_equipment.py index c6488b2598..dbbda29ffc 100644 --- a/fieldservice_equipment_stock/tests/test_fsm_equipment.py +++ b/fieldservice_equipment_stock/tests/test_fsm_equipment.py @@ -4,34 +4,41 @@ class TestFSMEquipment(TransactionCase): - def setUp(self): super(TestFSMEquipment, self).setUp() - self.Equipment = self.env['fsm.equipment'] - self.stock_location = self.env.ref('stock.stock_location_customers') + self.Equipment = self.env["fsm.equipment"] + self.stock_location = self.env.ref("stock.stock_location_customers") - product1 = self.env['product.product'].create({ - 'name': 'Product A', - 'type': 'product', - 'tracking': 'serial', - }) - lot1 = self.env['stock.production.lot'].create({ - 'name': 'serial1', - 'product_id': product1.id, - }) - self.env['stock.quant'].create({ - 'product_id': product1.id, - 'location_id': self.stock_location.id, - 'quantity': 1.0, - 'lot_id': lot1.id, - }) + product1 = self.env["product.product"].create( + { + "name": "Product A", + "type": "product", + "tracking": "serial", + } + ) + lot1 = self.env["stock.production.lot"].create( + { + "name": "serial1", + "product_id": product1.id, + } + ) + self.env["stock.quant"].create( + { + "product_id": product1.id, + "location_id": self.stock_location.id, + "quantity": 1.0, + "lot_id": lot1.id, + } + ) - self.equipment = self.Equipment.create({ - 'name': 'Equipment 1', - 'product_id': product1.id, - 'lot_id': lot1.id, - 'current_stock_location_id': self.stock_location.id, - }) + self.equipment = self.Equipment.create( + { + "name": "Equipment 1", + "product_id": product1.id, + "lot_id": lot1.id, + "current_stock_location_id": self.stock_location.id, + } + ) def test_onchange_product(self): equipment = self.equipment diff --git a/fieldservice_equipment_stock/views/fsm_equipment.xml b/fieldservice_equipment_stock/views/fsm_equipment.xml index 1ce8ae287f..ae9d0becdf 100644 --- a/fieldservice_equipment_stock/views/fsm_equipment.xml +++ b/fieldservice_equipment_stock/views/fsm_equipment.xml @@ -1,19 +1,20 @@ - + fsm.equipment.form.stock fsm.equipment - + - - - - + + + + @@ -22,11 +23,10 @@ fsm.equipment.model fsm.equipment - + - + diff --git a/fieldservice_equipment_stock/views/product_template.xml b/fieldservice_equipment_stock/views/product_template.xml index 6b9d6f36e3..4276d1a920 100644 --- a/fieldservice_equipment_stock/views/product_template.xml +++ b/fieldservice_equipment_stock/views/product_template.xml @@ -1,14 +1,15 @@ - + product.template - + - + diff --git a/fieldservice_equipment_stock/views/stock_picking_type.xml b/fieldservice_equipment_stock/views/stock_picking_type.xml index d197e10f6a..85b59de062 100644 --- a/fieldservice_equipment_stock/views/stock_picking_type.xml +++ b/fieldservice_equipment_stock/views/stock_picking_type.xml @@ -1,13 +1,13 @@ - + stock.picking.type - + - + diff --git a/fieldservice_equipment_stock/views/stock_production_lot.xml b/fieldservice_equipment_stock/views/stock_production_lot.xml index 4f23b37cad..9b80ee0ac4 100644 --- a/fieldservice_equipment_stock/views/stock_production_lot.xml +++ b/fieldservice_equipment_stock/views/stock_production_lot.xml @@ -1,21 +1,23 @@ - + stock.production.lot - + - + - + - + {'search_default_group_by_product': 1, 'default_product_id': context.get('product_id', False)} From 4cd75a96a86f27e8792a888544834abaa5c24123 Mon Sep 17 00:00:00 2001 From: Reed Hayashikawa Date: Fri, 2 Jul 2021 10:17:03 -0700 Subject: [PATCH 05/23] [MIG] fieldservice_equipment_stock: Migration to 14.0 --- fieldservice_equipment_stock/README.rst | 10 ++-- fieldservice_equipment_stock/__manifest__.py | 2 +- .../i18n/fieldservice_equipment_stock.pot | 38 ++++++++++++-- .../migrations/12.0.1.0.0/post-migration.py | 15 ------ .../models/fsm_equipment.py | 3 +- .../models/stock_move.py | 5 +- .../static/description/index.html | 6 +-- .../tests/__init__.py | 1 + .../tests/test_fsm_equipment.py | 50 +++++++++++++++--- .../tests/test_stock_move.py | 51 +++++++++++++++++++ 10 files changed, 140 insertions(+), 41 deletions(-) delete mode 100644 fieldservice_equipment_stock/migrations/12.0.1.0.0/post-migration.py create mode 100644 fieldservice_equipment_stock/tests/test_stock_move.py diff --git a/fieldservice_equipment_stock/README.rst b/fieldservice_equipment_stock/README.rst index a28a09a020..b196483152 100644 --- a/fieldservice_equipment_stock/README.rst +++ b/fieldservice_equipment_stock/README.rst @@ -14,13 +14,13 @@ Field Service - Stock Equipment :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_equipment_stock + :target: https://github.com/OCA/field-service/tree/14.0/fieldservice_equipment_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_equipment_stock + :target: https://translation.odoo-community.org/projects/field-service-14-0/field-service-14-0-fieldservice_equipment_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 + :target: https://runbot.odoo-community.org/runbot/264/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -75,7 +75,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. @@ -133,6 +133,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_equipment_stock/__manifest__.py b/fieldservice_equipment_stock/__manifest__.py index c8bb0f1607..6794d16b40 100644 --- a/fieldservice_equipment_stock/__manifest__.py +++ b/fieldservice_equipment_stock/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Field Service - Stock Equipment", "summary": "Integrate stock operations with your field service equipments", - "version": "12.0.2.0.0", + "version": "14.0.1.0.0", "category": "Field Service", "author": "Open Source Integrators, " "Brian McMaster, " diff --git a/fieldservice_equipment_stock/i18n/fieldservice_equipment_stock.pot b/fieldservice_equipment_stock/i18n/fieldservice_equipment_stock.pot index 99245a7fba..ef48592f4c 100644 --- a/fieldservice_equipment_stock/i18n/fieldservice_equipment_stock.pot +++ b/fieldservice_equipment_stock/i18n/fieldservice_equipment_stock.pot @@ -1,12 +1,12 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * fieldservice_equipment_stock +# * fieldservice_equipment_stock # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.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" @@ -29,6 +29,15 @@ msgstr "" msgid "Current Inventory Location" msgstr "" +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment__display_name +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_product_template__display_name +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_move__display_name +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_picking_type__display_name +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_production_lot__display_name +msgid "Display Name" +msgstr "" + #. module: fieldservice_equipment_stock #: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_production_lot__fsm_equipment_id msgid "Equipment" @@ -39,11 +48,29 @@ msgstr "" msgid "Field Service Equipment" msgstr "" +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment__id +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_product_template__id +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_move__id +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_picking_type__id +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_production_lot__id +msgid "ID" +msgstr "" + #. module: fieldservice_equipment_stock #: model_terms:ir.ui.view,arch_db:fieldservice_equipment_stock.fsm_equipment_form_view_stock msgid "Inventory" msgstr "" +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment____last_update +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_product_template____last_update +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_move____last_update +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_picking_type____last_update +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_production_lot____last_update +msgid "Last Modified on" +msgstr "" + #. module: fieldservice_equipment_stock #: model:ir.model,name:fieldservice_equipment_stock.model_stock_production_lot msgid "Lot/Serial" @@ -66,7 +93,9 @@ msgstr "" #. module: fieldservice_equipment_stock #: model:ir.model.fields,help:fieldservice_equipment_stock.field_stock_picking_type__create_fsm_equipment -msgid "Products with the 'Creates a FSM Equipment' flag will automatically be converted to an FSM Equipment." +msgid "" +"Products with the 'Creates a FSM Equipment' flag will automatically be " +"converted to an FSM Equipment." msgstr "" #. module: fieldservice_equipment_stock @@ -78,4 +107,3 @@ msgstr "" #: model:ir.model,name:fieldservice_equipment_stock.model_stock_move msgid "Stock Move" msgstr "" - diff --git a/fieldservice_equipment_stock/migrations/12.0.1.0.0/post-migration.py b/fieldservice_equipment_stock/migrations/12.0.1.0.0/post-migration.py deleted file mode 100644 index c3221ab722..0000000000 --- a/fieldservice_equipment_stock/migrations/12.0.1.0.0/post-migration.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (C) 2020, Open Source Integrators -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - - -def migrate(env, version): - if not version: - return - - env.execute( - """ - UPDATE stock_picking_type - SET create_fsm_equipment = 'true' - WHERE code = 'outgoing'; - """ - ) diff --git a/fieldservice_equipment_stock/models/fsm_equipment.py b/fieldservice_equipment_stock/models/fsm_equipment.py index 6a25ed3afe..db3f1219bf 100644 --- a/fieldservice_equipment_stock/models/fsm_equipment.py +++ b/fieldservice_equipment_stock/models/fsm_equipment.py @@ -29,7 +29,7 @@ def _compute_current_stock_loc_id(self): @api.onchange("product_id") def _onchange_product(self): for equipment in self: - self.current_stock_location_id = False + equipment.current_stock_location_id = False @api.model def create(self, vals): @@ -38,7 +38,6 @@ def create(self, vals): res.lot_id.fsm_equipment_id = res.id return res - @api.multi def write(self, vals): for equipment in self: prev_lot = equipment.lot_id diff --git a/fieldservice_equipment_stock/models/stock_move.py b/fieldservice_equipment_stock/models/stock_move.py index 0547419e32..07657e8768 100644 --- a/fieldservice_equipment_stock/models/stock_move.py +++ b/fieldservice_equipment_stock/models/stock_move.py @@ -7,12 +7,13 @@ class StockMove(models.Model): _inherit = "stock.move" def prepare_equipment_values(self, move_line): + move = move_line.move_id return { "name": "%s (%s)" % (move_line.product_id.name, move_line.lot_id.name), "product_id": move_line.product_id.id, "lot_id": move_line.lot_id.id, - "location_id": move_line.move_id.stock_request_ids.fsm_order_id.location_id.id, - "current_location_id": move_line.move_id.stock_request_ids.fsm_order_id.location_id.id, + "location_id": move.stock_request_ids.fsm_order_id.location_id.id, + "current_location_id": move.stock_request_ids.fsm_order_id.location_id.id, "current_stock_location_id": move_line.location_dest_id.id, } diff --git a/fieldservice_equipment_stock/static/description/index.html b/fieldservice_equipment_stock/static/description/index.html index 24708b961b..3e4fa9bc1e 100644 --- a/fieldservice_equipment_stock/static/description/index.html +++ b/fieldservice_equipment_stock/static/description/index.html @@ -367,7 +367,7 @@

Field Service - Stock Equipment

!! 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 allows you to track your FSM Equipments in stock moves.

Table of contents

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

@@ -461,7 +461,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_equipment_stock/tests/__init__.py b/fieldservice_equipment_stock/tests/__init__.py index 50a5826fe6..81851e3f98 100644 --- a/fieldservice_equipment_stock/tests/__init__.py +++ b/fieldservice_equipment_stock/tests/__init__.py @@ -2,3 +2,4 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) from . import test_fsm_equipment +from . import test_stock_move diff --git a/fieldservice_equipment_stock/tests/test_fsm_equipment.py b/fieldservice_equipment_stock/tests/test_fsm_equipment.py index dbbda29ffc..02713028ab 100644 --- a/fieldservice_equipment_stock/tests/test_fsm_equipment.py +++ b/fieldservice_equipment_stock/tests/test_fsm_equipment.py @@ -1,6 +1,6 @@ # Copyright (C) 2020 - TODAY, Marcel Savegnago (Escodoo) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo.tests.common import TransactionCase +from odoo.tests.common import Form, TransactionCase class TestFSMEquipment(TransactionCase): @@ -8,34 +8,55 @@ def setUp(self): super(TestFSMEquipment, self).setUp() self.Equipment = self.env["fsm.equipment"] self.stock_location = self.env.ref("stock.stock_location_customers") + self.current_location = self.env.ref("fieldservice.location_1") + self.test_location = self.env.ref("fieldservice.test_location") - product1 = self.env["product.product"].create( + currency = self.env["res.currency"].create( + { + "name": "Currency 1", + "symbol": "$", + } + ) + partner = self.env["res.partner"].create( + { + "name": "Partner 1", + } + ) + self.company1 = self.env["res.company"].create( + { + "name": "Company 1", + "currency_id": currency.id, + "partner_id": partner.id, + } + ) + self.product1 = self.env["product.product"].create( { "name": "Product A", "type": "product", "tracking": "serial", } ) - lot1 = self.env["stock.production.lot"].create( + self.lot1 = self.env["stock.production.lot"].create( { "name": "serial1", - "product_id": product1.id, + "product_id": self.product1.id, + "company_id": self.company1.id, } ) self.env["stock.quant"].create( { - "product_id": product1.id, + "product_id": self.product1.id, "location_id": self.stock_location.id, "quantity": 1.0, - "lot_id": lot1.id, + "lot_id": self.lot1.id, } ) self.equipment = self.Equipment.create( { "name": "Equipment 1", - "product_id": product1.id, - "lot_id": lot1.id, + "product_id": self.product1.id, + "lot_id": self.lot1.id, "current_stock_location_id": self.stock_location.id, } ) @@ -49,3 +70,16 @@ def test_compute_current_stock_loc_id(self): equipment = self.equipment equipment._compute_current_stock_loc_id() self.assertTrue(equipment.current_stock_location_id == self.stock_location) + + def test_fsm_equipment(self): + # Create an equipment + view_id = "fieldservice.fsm_equipment_form_view" + with Form(self.Equipment, view=view_id) as f: + f.name = "Test Equipment 1" + f.current_location_id = self.current_location + f.location_id = self.test_location + f.lot_id = self.lot1 + f.product_id = self.product1 + equipment = f.save() + + self.assertEqual(f.id, equipment.lot_id.fsm_equipment_id.id) diff --git a/fieldservice_equipment_stock/tests/test_stock_move.py b/fieldservice_equipment_stock/tests/test_stock_move.py new file mode 100644 index 0000000000..e6df05e763 --- /dev/null +++ b/fieldservice_equipment_stock/tests/test_stock_move.py @@ -0,0 +1,51 @@ +# Copyright (C) 2021 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import TransactionCase + + +class TestStockMove(TransactionCase): + def setUp(self): + super(TestStockMove, self).setUp() + self.Move = self.env["stock.move"] + self.stock_location = self.env.ref("stock.stock_location_customers") + self.supplier_location = self.env.ref("stock.stock_location_suppliers") + self.stock_location = self.env.ref("stock.stock_location_stock") + self.uom_unit = self.env.ref("uom.product_uom_unit") + + def test_action_done(self): + # Create product template + templateAB = self.env["product.template"].create( + {"name": "templAB", "uom_id": self.uom_unit.id} + ) + + # Create product A and B + productA = self.env["product.product"].create( + { + "name": "product A", + "standard_price": 1, + "type": "product", + "uom_id": self.uom_unit.id, + "default_code": "A", + "product_tmpl_id": templateAB.id, + } + ) + + # Create a stock move from INCOMING to STOCK + stockMoveInA = self.env["stock.move"].create( + { + "location_id": self.supplier_location.id, + "location_dest_id": self.stock_location.id, + "name": "MOVE INCOMING -> STOCK ", + "product_id": productA.id, + "product_uom": productA.uom_id.id, + "product_uom_qty": 2, + } + ) + + stockMoveInA.quantity_done = stockMoveInA.product_uom_qty + stockMoveInA._action_confirm() + stockMoveInA._action_assign() + stockMoveInA._action_done() + + self.assertEqual("done", stockMoveInA.state) From 3007d5b5fdc8198e68b00a04d6156846ca07cdd0 Mon Sep 17 00:00:00 2001 From: Sandip Mangukiya Date: Thu, 12 Aug 2021 09:06:33 -0700 Subject: [PATCH 06/23] [FIX]fieldservice_equipment_stock: Issue 829 --- fieldservice_equipment_stock/models/stock_move.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fieldservice_equipment_stock/models/stock_move.py b/fieldservice_equipment_stock/models/stock_move.py index 07657e8768..170b0dd8cb 100644 --- a/fieldservice_equipment_stock/models/stock_move.py +++ b/fieldservice_equipment_stock/models/stock_move.py @@ -17,8 +17,8 @@ def prepare_equipment_values(self, move_line): "current_stock_location_id": move_line.location_dest_id.id, } - def _action_done(self): - res = super()._action_done() + def _action_done(self, cancel_backorder=False): + res = super()._action_done(cancel_backorder) for rec in self: if ( rec.state == "done" From 83d04aafff7febfc321ebce475f6f57b61797b10 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Thu, 12 Aug 2021 16:49:03 +0000 Subject: [PATCH 07/23] fieldservice_equipment_stock 14.0.1.1.0 --- fieldservice_equipment_stock/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fieldservice_equipment_stock/__manifest__.py b/fieldservice_equipment_stock/__manifest__.py index 6794d16b40..f982cacb41 100644 --- a/fieldservice_equipment_stock/__manifest__.py +++ b/fieldservice_equipment_stock/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Field Service - Stock Equipment", "summary": "Integrate stock operations with your field service equipments", - "version": "14.0.1.0.0", + "version": "14.0.1.1.0", "category": "Field Service", "author": "Open Source Integrators, " "Brian McMaster, " From ec52f3d89d28a4f845079cb31cf17fdd1145c592 Mon Sep 17 00:00:00 2001 From: Ignacio Buioli Date: Sun, 3 Oct 2021 18:32:47 +0000 Subject: [PATCH 08/23] Added translation using Weblate (Spanish (Argentina)) --- fieldservice_equipment_stock/i18n/es_AR.po | 114 +++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 fieldservice_equipment_stock/i18n/es_AR.po diff --git a/fieldservice_equipment_stock/i18n/es_AR.po b/fieldservice_equipment_stock/i18n/es_AR.po new file mode 100644 index 0000000000..9a9aa64050 --- /dev/null +++ b/fieldservice_equipment_stock/i18n/es_AR.po @@ -0,0 +1,114 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_equipment_stock +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-10-03 21:34+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.3.2\n" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_picking_type__create_fsm_equipment +msgid "Create Fsm Equipment" +msgstr "Crear Equipo FSM" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_product_product__create_fsm_equipment +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_product_template__create_fsm_equipment +msgid "Creates a FSM Equipment" +msgstr "Crea un Equipo FSM" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment__current_stock_location_id +msgid "Current Inventory Location" +msgstr "Ubicación Actual del Inventario" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment__display_name +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_product_template__display_name +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_move__display_name +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_picking_type__display_name +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_production_lot__display_name +msgid "Display Name" +msgstr "Mostrar Nombre" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_production_lot__fsm_equipment_id +msgid "Equipment" +msgstr "Equipo" + +#. module: fieldservice_equipment_stock +#: model:ir.model,name:fieldservice_equipment_stock.model_fsm_equipment +msgid "Field Service Equipment" +msgstr "Equipo de Servicio de Campo" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment__id +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_product_template__id +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_move__id +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_picking_type__id +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_production_lot__id +msgid "ID" +msgstr "ID" + +#. module: fieldservice_equipment_stock +#: model_terms:ir.ui.view,arch_db:fieldservice_equipment_stock.fsm_equipment_form_view_stock +msgid "Inventory" +msgstr "Inventario" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment____last_update +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_product_template____last_update +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_move____last_update +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_picking_type____last_update +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_production_lot____last_update +msgid "Last Modified on" +msgstr "Última Modificación el" + +#. module: fieldservice_equipment_stock +#: model:ir.model,name:fieldservice_equipment_stock.model_stock_production_lot +msgid "Lot/Serial" +msgstr "Lote / Número de Serie" + +#. module: fieldservice_equipment_stock +#: model:ir.model,name:fieldservice_equipment_stock.model_stock_picking_type +msgid "Picking Type" +msgstr "Tipo de Entrega" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment__product_id +msgid "Product" +msgstr "Producto" + +#. module: fieldservice_equipment_stock +#: model:ir.model,name:fieldservice_equipment_stock.model_product_template +msgid "Product Template" +msgstr "Plantilla del Producto" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,help:fieldservice_equipment_stock.field_stock_picking_type__create_fsm_equipment +msgid "" +"Products with the 'Creates a FSM Equipment' flag will automatically be " +"converted to an FSM Equipment." +msgstr "" +"Los productos marcados como 'Crea un Equipo FSM' se convertirán " +"automáticamente en un Equipo FSM." + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment__lot_id +msgid "Serial #" +msgstr "Serie #" + +#. module: fieldservice_equipment_stock +#: model:ir.model,name:fieldservice_equipment_stock.model_stock_move +msgid "Stock Move" +msgstr "Movimiento de Inventario" From 6146a14eb78783fb7d23d4f13a9f66e2a4a95031 Mon Sep 17 00:00:00 2001 From: Murtaza Mithaiwala Date: Mon, 7 Feb 2022 16:51:08 +0530 Subject: [PATCH 09/23] [15.0][FIX] Pre-commit. --- fieldservice_equipment_stock/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fieldservice_equipment_stock/__manifest__.py b/fieldservice_equipment_stock/__manifest__.py index f982cacb41..ffddea9bef 100644 --- a/fieldservice_equipment_stock/__manifest__.py +++ b/fieldservice_equipment_stock/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Field Service - Stock Equipment", "summary": "Integrate stock operations with your field service equipments", - "version": "14.0.1.1.0", + "version": "15.0.1.1.0", "category": "Field Service", "author": "Open Source Integrators, " "Brian McMaster, " From 0ac83b26aaf639ab14e0f88b5b1ad5943881810a Mon Sep 17 00:00:00 2001 From: Murtaza Mithaiwala Date: Thu, 3 Nov 2022 16:23:51 +0530 Subject: [PATCH 10/23] [15.0][MIG] fieldservice_equipment_stock --- fieldservice_equipment_stock/README.rst | 10 +++---- fieldservice_equipment_stock/__manifest__.py | 2 +- .../i18n/fieldservice_equipment_stock.pot | 29 +------------------ .../models/fsm_equipment.py | 17 +++++------ .../models/stock_move.py | 6 ++-- .../static/description/index.html | 6 ++-- .../views/fsm_equipment.xml | 1 - .../views/product_template.xml | 1 - .../views/stock_picking_type.xml | 1 - .../views/stock_production_lot.xml | 1 - 10 files changed, 21 insertions(+), 53 deletions(-) diff --git a/fieldservice_equipment_stock/README.rst b/fieldservice_equipment_stock/README.rst index b196483152..7ba529d255 100644 --- a/fieldservice_equipment_stock/README.rst +++ b/fieldservice_equipment_stock/README.rst @@ -14,13 +14,13 @@ Field Service - Stock Equipment :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/14.0/fieldservice_equipment_stock + :target: https://github.com/OCA/field-service/tree/15.0/fieldservice_equipment_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-14-0/field-service-14-0-fieldservice_equipment_stock + :target: https://translation.odoo-community.org/projects/field-service-15-0/field-service-15-0-fieldservice_equipment_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/14.0 + :target: https://runbot.odoo-community.org/runbot/264/15.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -75,7 +75,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. @@ -133,6 +133,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_equipment_stock/__manifest__.py b/fieldservice_equipment_stock/__manifest__.py index ffddea9bef..cdabee86b9 100644 --- a/fieldservice_equipment_stock/__manifest__.py +++ b/fieldservice_equipment_stock/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Field Service - Stock Equipment", "summary": "Integrate stock operations with your field service equipments", - "version": "15.0.1.1.0", + "version": "15.0.1.0.0", "category": "Field Service", "author": "Open Source Integrators, " "Brian McMaster, " diff --git a/fieldservice_equipment_stock/i18n/fieldservice_equipment_stock.pot b/fieldservice_equipment_stock/i18n/fieldservice_equipment_stock.pot index ef48592f4c..2b484db29a 100644 --- a/fieldservice_equipment_stock/i18n/fieldservice_equipment_stock.pot +++ b/fieldservice_equipment_stock/i18n/fieldservice_equipment_stock.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -29,15 +29,6 @@ msgstr "" msgid "Current Inventory Location" msgstr "" -#. module: fieldservice_equipment_stock -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment__display_name -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_product_template__display_name -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_move__display_name -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_picking_type__display_name -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_production_lot__display_name -msgid "Display Name" -msgstr "" - #. module: fieldservice_equipment_stock #: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_production_lot__fsm_equipment_id msgid "Equipment" @@ -48,29 +39,11 @@ msgstr "" msgid "Field Service Equipment" msgstr "" -#. module: fieldservice_equipment_stock -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment__id -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_product_template__id -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_move__id -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_picking_type__id -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_production_lot__id -msgid "ID" -msgstr "" - #. module: fieldservice_equipment_stock #: model_terms:ir.ui.view,arch_db:fieldservice_equipment_stock.fsm_equipment_form_view_stock msgid "Inventory" msgstr "" -#. module: fieldservice_equipment_stock -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment____last_update -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_product_template____last_update -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_move____last_update -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_picking_type____last_update -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_production_lot____last_update -msgid "Last Modified on" -msgstr "" - #. module: fieldservice_equipment_stock #: model:ir.model,name:fieldservice_equipment_stock.model_stock_production_lot msgid "Lot/Serial" diff --git a/fieldservice_equipment_stock/models/fsm_equipment.py b/fieldservice_equipment_stock/models/fsm_equipment.py index db3f1219bf..b266517ca1 100644 --- a/fieldservice_equipment_stock/models/fsm_equipment.py +++ b/fieldservice_equipment_stock/models/fsm_equipment.py @@ -17,19 +17,18 @@ class FSMEquipment(models.Model): @api.depends("product_id", "lot_id") def _compute_current_stock_loc_id(self): + stock_quant_obj = self.env["stock.quant"] for equipment in self: - quants = self.env["stock.quant"].search( + quants = stock_quant_obj.search( [("lot_id", "=", equipment.lot_id.id)], order="id desc", limit=1 ) - if quants and quants.location_id: - equipment.current_stock_location_id = quants.location_id.id - else: - equipment.current_stock_location_id = False + equipment.current_stock_location_id = ( + quants.location_id and quants.location_id.id or False + ) @api.onchange("product_id") def _onchange_product(self): - for equipment in self: - equipment.current_stock_location_id = False + self.current_stock_location_id = False @api.model def create(self, vals): @@ -39,10 +38,8 @@ def create(self, vals): return res def write(self, vals): + res = super(FSMEquipment, self).write(vals) for equipment in self: - prev_lot = equipment.lot_id - res = super(FSMEquipment, equipment).write(vals) if "lot_id" in vals: - prev_lot.fsm_equipment_id = False equipment.lot_id.fsm_equipment_id = equipment.id return res diff --git a/fieldservice_equipment_stock/models/stock_move.py b/fieldservice_equipment_stock/models/stock_move.py index 170b0dd8cb..0cf3b53537 100644 --- a/fieldservice_equipment_stock/models/stock_move.py +++ b/fieldservice_equipment_stock/models/stock_move.py @@ -19,6 +19,7 @@ def prepare_equipment_values(self, move_line): def _action_done(self, cancel_backorder=False): res = super()._action_done(cancel_backorder) + fsm_equipment_obj = self.env["fsm.equipment"] for rec in self: if ( rec.state == "done" @@ -26,6 +27,7 @@ def _action_done(self, cancel_backorder=False): and rec.product_tmpl_id.create_fsm_equipment ): for line in rec.move_line_ids: - vals = self.prepare_equipment_values(line) - line.lot_id.fsm_equipment_id = rec.env["fsm.equipment"].create(vals) + line.lot_id.fsm_equipment_id = fsm_equipment_obj.create( + self.prepare_equipment_values(line) + ) return res diff --git a/fieldservice_equipment_stock/static/description/index.html b/fieldservice_equipment_stock/static/description/index.html index 3e4fa9bc1e..ca390ca80d 100644 --- a/fieldservice_equipment_stock/static/description/index.html +++ b/fieldservice_equipment_stock/static/description/index.html @@ -367,7 +367,7 @@

Field Service - Stock Equipment

!! 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 allows you to track your FSM Equipments in stock moves.

Table of contents

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

@@ -461,7 +461,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_equipment_stock/views/fsm_equipment.xml b/fieldservice_equipment_stock/views/fsm_equipment.xml index ae9d0becdf..e5ddd4e6e5 100644 --- a/fieldservice_equipment_stock/views/fsm_equipment.xml +++ b/fieldservice_equipment_stock/views/fsm_equipment.xml @@ -1,4 +1,3 @@ - diff --git a/fieldservice_equipment_stock/views/product_template.xml b/fieldservice_equipment_stock/views/product_template.xml index 4276d1a920..4d51dc93d9 100644 --- a/fieldservice_equipment_stock/views/product_template.xml +++ b/fieldservice_equipment_stock/views/product_template.xml @@ -1,4 +1,3 @@ - diff --git a/fieldservice_equipment_stock/views/stock_picking_type.xml b/fieldservice_equipment_stock/views/stock_picking_type.xml index 85b59de062..8d258a29e8 100644 --- a/fieldservice_equipment_stock/views/stock_picking_type.xml +++ b/fieldservice_equipment_stock/views/stock_picking_type.xml @@ -1,4 +1,3 @@ - diff --git a/fieldservice_equipment_stock/views/stock_production_lot.xml b/fieldservice_equipment_stock/views/stock_production_lot.xml index 9b80ee0ac4..e6d74b084d 100644 --- a/fieldservice_equipment_stock/views/stock_production_lot.xml +++ b/fieldservice_equipment_stock/views/stock_production_lot.xml @@ -1,4 +1,3 @@ - From e1e4c24f682f082dc9b117e0bdc0fea9d265198b Mon Sep 17 00:00:00 2001 From: Weblate Date: Thu, 3 Nov 2022 16:21:03 +0000 Subject: [PATCH 11/23] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: field-service-15.0/field-service-15.0-fieldservice_equipment_stock Translate-URL: https://translation.odoo-community.org/projects/field-service-15-0/field-service-15-0-fieldservice_equipment_stock/ --- fieldservice_equipment_stock/i18n/es_AR.po | 36 ++++++---------------- fieldservice_equipment_stock/i18n/pt_BR.po | 6 ++-- 2 files changed, 13 insertions(+), 29 deletions(-) diff --git a/fieldservice_equipment_stock/i18n/es_AR.po b/fieldservice_equipment_stock/i18n/es_AR.po index 9a9aa64050..3d0df48e5d 100644 --- a/fieldservice_equipment_stock/i18n/es_AR.po +++ b/fieldservice_equipment_stock/i18n/es_AR.po @@ -32,15 +32,6 @@ msgstr "Crea un Equipo FSM" msgid "Current Inventory Location" msgstr "Ubicación Actual del Inventario" -#. module: fieldservice_equipment_stock -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment__display_name -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_product_template__display_name -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_move__display_name -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_picking_type__display_name -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_production_lot__display_name -msgid "Display Name" -msgstr "Mostrar Nombre" - #. module: fieldservice_equipment_stock #: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_production_lot__fsm_equipment_id msgid "Equipment" @@ -51,29 +42,11 @@ msgstr "Equipo" msgid "Field Service Equipment" msgstr "Equipo de Servicio de Campo" -#. module: fieldservice_equipment_stock -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment__id -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_product_template__id -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_move__id -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_picking_type__id -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_production_lot__id -msgid "ID" -msgstr "ID" - #. module: fieldservice_equipment_stock #: model_terms:ir.ui.view,arch_db:fieldservice_equipment_stock.fsm_equipment_form_view_stock msgid "Inventory" msgstr "Inventario" -#. module: fieldservice_equipment_stock -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment____last_update -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_product_template____last_update -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_move____last_update -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_picking_type____last_update -#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_production_lot____last_update -msgid "Last Modified on" -msgstr "Última Modificación el" - #. module: fieldservice_equipment_stock #: model:ir.model,name:fieldservice_equipment_stock.model_stock_production_lot msgid "Lot/Serial" @@ -112,3 +85,12 @@ msgstr "Serie #" #: model:ir.model,name:fieldservice_equipment_stock.model_stock_move msgid "Stock Move" msgstr "Movimiento de Inventario" + +#~ msgid "Display Name" +#~ msgstr "Mostrar Nombre" + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Última Modificación el" diff --git a/fieldservice_equipment_stock/i18n/pt_BR.po b/fieldservice_equipment_stock/i18n/pt_BR.po index 8320a3aa66..bfbfbcfe3a 100644 --- a/fieldservice_equipment_stock/i18n/pt_BR.po +++ b/fieldservice_equipment_stock/i18n/pt_BR.po @@ -1,6 +1,6 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * fieldservice_equipment_stock +# * fieldservice_equipment_stock # msgid "" msgstr "" @@ -69,7 +69,9 @@ msgstr "Modelo de Produto" #. module: fieldservice_equipment_stock #: model:ir.model.fields,help:fieldservice_equipment_stock.field_stock_picking_type__create_fsm_equipment -msgid "Products with the 'Creates a FSM Equipment' flag will automatically be converted to an FSM Equipment." +msgid "" +"Products with the 'Creates a FSM Equipment' flag will automatically be " +"converted to an FSM Equipment." msgstr "" "Produtos com o sinalizador ‘Cria um Equipamento FSM’ serão automaticamente " "convertidos em um Equipamento FSM." From 7c3bb69de628910d492db4376067adde0f8f01cc Mon Sep 17 00:00:00 2001 From: mymage Date: Fri, 4 Nov 2022 16:03:35 +0000 Subject: [PATCH 12/23] Added translation using Weblate (Italian) --- fieldservice_equipment_stock/i18n/it.po | 87 +++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 fieldservice_equipment_stock/i18n/it.po diff --git a/fieldservice_equipment_stock/i18n/it.po b/fieldservice_equipment_stock/i18n/it.po new file mode 100644 index 0000000000..b1c4fcb8d6 --- /dev/null +++ b/fieldservice_equipment_stock/i18n/it.po @@ -0,0 +1,87 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_equipment_stock +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-04-17 09:51+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_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_picking_type__create_fsm_equipment +msgid "Create Fsm Equipment" +msgstr "Crea attrezzatura FSM" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_product_product__create_fsm_equipment +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_product_template__create_fsm_equipment +msgid "Creates a FSM Equipment" +msgstr "Crea un'attrezzatura FSM" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment__current_stock_location_id +msgid "Current Inventory Location" +msgstr "Ubicazione giacenza attuale" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_production_lot__fsm_equipment_id +msgid "Equipment" +msgstr "Attrezzatura" + +#. module: fieldservice_equipment_stock +#: model:ir.model,name:fieldservice_equipment_stock.model_fsm_equipment +msgid "Field Service Equipment" +msgstr "Attrezzatura assistenza sul campo" + +#. module: fieldservice_equipment_stock +#: model_terms:ir.ui.view,arch_db:fieldservice_equipment_stock.fsm_equipment_form_view_stock +msgid "Inventory" +msgstr "Inventario" + +#. module: fieldservice_equipment_stock +#: model:ir.model,name:fieldservice_equipment_stock.model_stock_production_lot +msgid "Lot/Serial" +msgstr "Lotto/Seriale" + +#. module: fieldservice_equipment_stock +#: model:ir.model,name:fieldservice_equipment_stock.model_stock_picking_type +msgid "Picking Type" +msgstr "Tipo prelievo" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment__product_id +msgid "Product" +msgstr "Prodotto" + +#. module: fieldservice_equipment_stock +#: model:ir.model,name:fieldservice_equipment_stock.model_product_template +msgid "Product Template" +msgstr "Modello prodotto" + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,help:fieldservice_equipment_stock.field_stock_picking_type__create_fsm_equipment +msgid "" +"Products with the 'Creates a FSM Equipment' flag will automatically be " +"converted to an FSM Equipment." +msgstr "" +"I prodotti con l'opzione 'Crea una attrezzatura FSM' saranno convertiti " +"automaticamente in una attrezzatura FSM." + +#. module: fieldservice_equipment_stock +#: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment__lot_id +msgid "Serial #" +msgstr "Nr. seriale" + +#. module: fieldservice_equipment_stock +#: model:ir.model,name:fieldservice_equipment_stock.model_stock_move +msgid "Stock Move" +msgstr "Movimento di magazzino" From 41c1181c92909f34dad10de534f2da6a56de0676 Mon Sep 17 00:00:00 2001 From: Juliette BLANC Date: Thu, 27 Apr 2023 12:32:26 +0200 Subject: [PATCH 13/23] [FIX] fieldservice_equipment_stock: Fix service equipment's creation --- fieldservice_equipment_stock/i18n/it.po | 8 ++++---- fieldservice_equipment_stock/models/stock_move.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fieldservice_equipment_stock/i18n/it.po b/fieldservice_equipment_stock/i18n/it.po index b1c4fcb8d6..1efbd11d2d 100644 --- a/fieldservice_equipment_stock/i18n/it.po +++ b/fieldservice_equipment_stock/i18n/it.po @@ -6,15 +6,15 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2023-04-17 09:51+0000\n" -"Last-Translator: mymage \n" +"PO-Revision-Date: 2023-07-17 17:14+0000\n" +"Last-Translator: Francesco Foresti \n" "Language-Team: none\n" "Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.14.1\n" +"X-Generator: Weblate 4.17\n" #. module: fieldservice_equipment_stock #: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_stock_picking_type__create_fsm_equipment @@ -55,7 +55,7 @@ msgstr "Lotto/Seriale" #. module: fieldservice_equipment_stock #: model:ir.model,name:fieldservice_equipment_stock.model_stock_picking_type msgid "Picking Type" -msgstr "Tipo prelievo" +msgstr "Tipologia prelievo" #. module: fieldservice_equipment_stock #: model:ir.model.fields,field_description:fieldservice_equipment_stock.field_fsm_equipment__product_id diff --git a/fieldservice_equipment_stock/models/stock_move.py b/fieldservice_equipment_stock/models/stock_move.py index 0cf3b53537..c47718da90 100644 --- a/fieldservice_equipment_stock/models/stock_move.py +++ b/fieldservice_equipment_stock/models/stock_move.py @@ -12,8 +12,8 @@ def prepare_equipment_values(self, move_line): "name": "%s (%s)" % (move_line.product_id.name, move_line.lot_id.name), "product_id": move_line.product_id.id, "lot_id": move_line.lot_id.id, - "location_id": move.stock_request_ids.fsm_order_id.location_id.id, - "current_location_id": move.stock_request_ids.fsm_order_id.location_id.id, + "location_id": move.fsm_order_id.location_id.id, + "current_location_id": move.fsm_order_id.location_id.id, "current_stock_location_id": move_line.location_dest_id.id, } From 00683c2fc3e232919739e6c441b0c5d59fb02c71 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Mon, 28 Aug 2023 14:25:43 +0000 Subject: [PATCH 14/23] fieldservice_equipment_stock 15.0.1.0.1 --- fieldservice_equipment_stock/README.rst | 15 +++--- fieldservice_equipment_stock/__manifest__.py | 2 +- .../static/description/index.html | 52 ++++++++++--------- 3 files changed, 37 insertions(+), 32 deletions(-) diff --git a/fieldservice_equipment_stock/README.rst b/fieldservice_equipment_stock/README.rst index 7ba529d255..24eaca6200 100644 --- a/fieldservice_equipment_stock/README.rst +++ b/fieldservice_equipment_stock/README.rst @@ -2,10 +2,13 @@ Field Service - Stock Equipment =============================== -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:f79d3f7f18efdac99fcffbc3dd3ee92407b73ea5b7702569bf4e28ca799f5f0f + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |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 Equipment .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png :target: https://translation.odoo-community.org/projects/field-service-15-0/field-service-15-0-fieldservice_equipment_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/15.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=15.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 allows you to track your FSM Equipments in stock moves. @@ -74,7 +77,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_equipment_stock/__manifest__.py b/fieldservice_equipment_stock/__manifest__.py index cdabee86b9..f39e6cca3a 100644 --- a/fieldservice_equipment_stock/__manifest__.py +++ b/fieldservice_equipment_stock/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Field Service - Stock Equipment", "summary": "Integrate stock operations with your field service equipments", - "version": "15.0.1.0.0", + "version": "15.0.1.0.1", "category": "Field Service", "author": "Open Source Integrators, " "Brian McMaster, " diff --git a/fieldservice_equipment_stock/static/description/index.html b/fieldservice_equipment_stock/static/description/index.html index ca390ca80d..45a82d3c5c 100644 --- a/fieldservice_equipment_stock/static/description/index.html +++ b/fieldservice_equipment_stock/static/description/index.html @@ -1,20 +1,20 @@ - + - + Field Service - Stock Equipment