Skip to content

Commit

Permalink
[IMP] fieldservice_stock: Split equipment
Browse files Browse the repository at this point in the history
Remove the equipment related functionality from the fieldservice_stock module and make into separate module
  • Loading branch information
brian10048 committed Jan 5, 2021
1 parent 1d50fe7 commit 1c4a5fb
Show file tree
Hide file tree
Showing 27 changed files with 245 additions and 55 deletions.
137 changes: 137 additions & 0 deletions fieldservice_equipment_stock/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
===============================
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_stock
:alt: OCA/field-service
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/field-service-12-0/field-service-12-0-fieldservice_stock
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/264/12.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

This module is an add-on for the Field Service application in Odoo.
It 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
=====

To use this module, you need to:

Known issues / Roadmap
======================

The roadmap of the Field Service application is documented on
`Github <https://github.com/OCA/field-service/issues/1>`_.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/field-service/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 <https://github.com/OCA/field-service/issues/new?body=module:%20fieldservice_stock%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
~~~~~~~

* Open Source Integrators
* Brian McMaster

Contributors
~~~~~~~~~~~~

* Brian McMaster <brian@mcmpest.com>
* Sandip Mangukiya <smangukiya@opensourceintegrators.com>
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>

Other credits
~~~~~~~~~~~~~

The development of this module has been financially supported by:

* Open Source Integrators <https://opensourceintegrators.com>

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 <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-brian10048| |maintainer-wolfhall| |maintainer-max3903| |maintainer-smangukiya|

This module is part of the `OCA/field-service <https://github.com/OCA/field-service/tree/12.0/fieldservice_stock_equipment>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions fieldservice_equipment_stock/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (C) 2020, Brian McMaster
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
31 changes: 31 additions & 0 deletions fieldservice_equipment_stock/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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',
],
}
7 changes: 7 additions & 0 deletions fieldservice_equipment_stock/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from . import (
stock_move,
stock_picking_type,
fsm_equipment,
product_template,
stock_production_lot,
)
File renamed without changes.
30 changes: 30 additions & 0 deletions fieldservice_equipment_stock/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (C) 2018 Brian McMaster
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, 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
20 changes: 20 additions & 0 deletions fieldservice_equipment_stock/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions fieldservice_equipment_stock/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Brian McMaster <brian@mcmpest.com>
* Sandip Mangukiya <smangukiya@opensourceintegrators.com>
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
3 changes: 3 additions & 0 deletions fieldservice_equipment_stock/readme/CREDITS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The development of this module has been financially supported by:

* Open Source Integrators <https://opensourceintegrators.com>
2 changes: 2 additions & 0 deletions fieldservice_equipment_stock/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 2 additions & 0 deletions fieldservice_equipment_stock/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The roadmap of the Field Service application is documented on
`Github <https://github.com/OCA/field-service/issues/1>`_.
2 changes: 2 additions & 0 deletions fieldservice_equipment_stock/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
To use this module, you need to:

2 changes: 2 additions & 0 deletions fieldservice_equipment_stock/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
4 changes: 2 additions & 2 deletions fieldservice_repair/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
{
'name': 'Field Service - Repair',
'summary': 'Integrate Field Service orders with MRP repair orders',
'version': '12.0.1.1.0',
'version': '12.0.1.2.0',
'category': 'Field Service',
'author': 'Open Source Integrators, Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/field-service',
'depends': [
'fieldservice_stock',
'fieldservice_equipment_stock',
'repair',
],
'data': [
Expand Down
4 changes: 0 additions & 4 deletions fieldservice_stock/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
'views/fsm_location.xml',
'views/fsm_order.xml',
'views/stock.xml',
'views/fsm_equipment.xml',
'views/product_template.xml',
'views/stock_picking_type.xml',
'views/stock_production_lot.xml',
],
'license': 'AGPL-3',
'development_status': 'Beta',
Expand Down
4 changes: 0 additions & 4 deletions fieldservice_stock/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,5 @@
procurement_group,
stock_rule,
stock_picking,
stock_picking_type,
fsm_equipment,
product_template,
stock_production_lot,
fsm_wizard,
)
23 changes: 0 additions & 23 deletions fieldservice_stock/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,3 @@ class StockMove(models.Model):
_inherit = "stock.move"

fsm_order_id = fields.Many2one('fsm.order', string='Field Service Order')

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
21 changes: 0 additions & 21 deletions fieldservice_stock/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,3 @@ If you are in a multi-warehouse situation:
* Go to Field Service > Configuration > Territories
* Create or select a territory
* Set the warehouse that will serve this territory

Products can be automatically converted into FSM Equipments.
This is only available only for products tracked by serial number.
This needs to be enabled both on Operation Types and Products.
For example, we may want to create the FSM Equipment on Delivery,
or on Receipts.

To enable on Products:

* Go to Inventory > Master Data > Products
* Open the Product form, Inventory tab
* On the "Traceability" section, make sure
"Tracking" is set to "By Unique Serial Number"
* Enable the "Creates FSM Equipment" checkbox

To enable on Operation Types:

* Go to Inventory > Configuration > Operation Types
* Select the intended Operation Type ("Receipts" for example)
* On the "Traceability" section, enable the
"Create FSM Equipment" checkbox
1 change: 0 additions & 1 deletion fieldservice_stock/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_stock_move_portal,access.stock.move.portal,stock.model_stock_move,base.group_portal,1,1,0,0
access_stock_picking_type_portal,access.stock.picking.type.portal,stock.model_stock_picking_type,base.group_portal,1,0,0,0
access_product_product_portal,access.product.product.portal,product.model_product_product,base.group_portal,1,0,0,0
access_product_template_portal,access.product.template.portal,product.model_product_template,base.group_portal,1,0,0,0
access_uom_uom_portal,access.uom.uom.portal,uom.model_uom_uom,base.group_portal,1,0,0,0

0 comments on commit 1c4a5fb

Please sign in to comment.