Skip to content

Commit

Permalink
[MIG] fieldservice_stock: Migration to 13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
RLeeOSI committed Oct 14, 2020
1 parent 79eda98 commit cf0dfc5
Show file tree
Hide file tree
Showing 20 changed files with 59 additions and 68 deletions.
10 changes: 5 additions & 5 deletions fieldservice_stock/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Field Service - Stock",
"summary": "Integrate the logistics operations with Field Service",
"version": "12.0.2.2.0",
"version": "13.0.1.0.0",
"category": "Field Service",
"author": "Open Source Integrators, "
"Brian McMaster, "
Expand All @@ -18,18 +18,18 @@
"data": [
"security/ir.model.access.csv",
"data/fsm_stock_data.xml",
"views/fsm_territory.xml",
"views/fsm_equipment.xml",
"views/fsm_location.xml",
"views/fsm_order.xml",
"views/stock.xml",
"views/fsm_equipment.xml",
"views/product_template.xml",
"views/res_territory.xml",
"views/stock.xml",
"views/stock_picking_type.xml",
"views/stock_production_lot.xml",
"views/stock_request.xml",
"views/stock_request_order.xml",
],
"license": "AGPL-3",
"development_status": "Beta",
"maintainers": ["brian10048", "wolfhall", "max3903", "smangukiya",],
"maintainers": ["brian10048", "wolfhall", "max3903", "smangukiya"],
}
4 changes: 2 additions & 2 deletions fieldservice_stock/i18n/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ msgid "Submitted"
msgstr ""

#. module: fieldservice_stock
#: model:ir.model,name:fieldservice_stock.model_fsm_territory
#: model:ir.model,name:fieldservice_stock.model_res_territory
msgid "Territory"
msgstr ""

Expand Down Expand Up @@ -298,7 +298,7 @@ msgstr ""

#. module: fieldservice_stock
#: model:ir.model.fields,field_description:fieldservice_stock.field_fsm_order__warehouse_id
#: model:ir.model.fields,field_description:fieldservice_stock.field_fsm_territory__warehouse_id
#: model:ir.model.fields,field_description:fieldservice_stock.field_res_territory__warehouse_id
msgid "Warehouse"
msgstr ""

Expand Down
4 changes: 2 additions & 2 deletions fieldservice_stock/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ msgid "Submitted"
msgstr "Enviado"

#. module: fieldservice_stock
#: model:ir.model,name:fieldservice_stock.model_fsm_territory
#: model:ir.model,name:fieldservice_stock.model_res_territory
msgid "Territory"
msgstr "Territorio"

Expand Down Expand Up @@ -300,7 +300,7 @@ msgstr "Unidad de Medida"

#. module: fieldservice_stock
#: model:ir.model.fields,field_description:fieldservice_stock.field_fsm_order__warehouse_id
#: model:ir.model.fields,field_description:fieldservice_stock.field_fsm_territory__warehouse_id
#: model:ir.model.fields,field_description:fieldservice_stock.field_res_territory__warehouse_id
msgid "Warehouse"
msgstr "Almacén"

Expand Down
4 changes: 2 additions & 2 deletions fieldservice_stock/i18n/es_CL.po
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ msgid "Submitted"
msgstr "Enviado"

#. module: fieldservice_stock
#: model:ir.model,name:fieldservice_stock.model_fsm_territory
#: model:ir.model,name:fieldservice_stock.model_res_territory
msgid "Territory"
msgstr "Territorio"

Expand Down Expand Up @@ -300,7 +300,7 @@ msgstr "Unidad de Medida"

#. module: fieldservice_stock
#: model:ir.model.fields,field_description:fieldservice_stock.field_fsm_order__warehouse_id
#: model:ir.model.fields,field_description:fieldservice_stock.field_fsm_territory__warehouse_id
#: model:ir.model.fields,field_description:fieldservice_stock.field_res_territory__warehouse_id
msgid "Warehouse"
msgstr "Almacén"

Expand Down
4 changes: 2 additions & 2 deletions fieldservice_stock/i18n/fieldservice_stock.pot
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ msgid "Submitted"
msgstr ""

#. module: fieldservice_stock
#: model:ir.model,name:fieldservice_stock.model_fsm_territory
#: model:ir.model,name:fieldservice_stock.model_res_territory
msgid "Territory"
msgstr ""

Expand All @@ -289,7 +289,7 @@ msgstr ""

#. module: fieldservice_stock
#: model:ir.model.fields,field_description:fieldservice_stock.field_fsm_order__warehouse_id
#: model:ir.model.fields,field_description:fieldservice_stock.field_fsm_territory__warehouse_id
#: model:ir.model.fields,field_description:fieldservice_stock.field_res_territory__warehouse_id
msgid "Warehouse"
msgstr ""

Expand Down
4 changes: 2 additions & 2 deletions fieldservice_stock/i18n/pt_BR.po
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ msgid "Submitted"
msgstr "Submetido"

#. module: fieldservice_stock
#: model:ir.model,name:fieldservice_stock.model_fsm_territory
#: model:ir.model,name:fieldservice_stock.model_res_territory
msgid "Territory"
msgstr "Território"

Expand Down Expand Up @@ -297,7 +297,7 @@ msgstr "Unidade de Medida (UoM)"

#. module: fieldservice_stock
#: model:ir.model.fields,field_description:fieldservice_stock.field_fsm_order__warehouse_id
#: model:ir.model.fields,field_description:fieldservice_stock.field_fsm_territory__warehouse_id
#: model:ir.model.fields,field_description:fieldservice_stock.field_res_territory__warehouse_id
msgid "Warehouse"
msgstr "Armazém"

Expand Down
15 changes: 0 additions & 15 deletions fieldservice_stock/migrations/12.0.2.0.0/post-migration.py

This file was deleted.

14 changes: 7 additions & 7 deletions fieldservice_stock/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import (
fsm_territory,
fsm_equipment,
fsm_location,
fsm_order,
stock_move_line,
stock_move,
fsm_wizard,
procurement_group,
stock_rule,
product_template,
res_territory,
stock_move,
stock_move_line,
stock_picking,
stock_picking_type,
fsm_equipment,
product_template,
stock_production_lot,
fsm_wizard,
stock_request,
stock_request_order,
stock_rule,
)
2 changes: 0 additions & 2 deletions fieldservice_stock/models/fsm_equipment.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class FSMEquipment(models.Model):
compute="_compute_current_stock_loc_id",
)

@api.multi
def _compute_current_stock_loc_id(self):
for equipment in self:
quants = self.env["stock.quant"].search(
Expand All @@ -33,7 +32,6 @@ def create(self, vals):
res.lot_id.fsm_equipment_id = res.id
return res

@api.multi
def write(self, vals):
for equipment in self:
prev_lot = equipment.lot_id
Expand Down
5 changes: 0 additions & 5 deletions fieldservice_stock/models/fsm_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def _get_move_domain(self):
"stock.move", "fsm_order_id", string="Operations", domain=_get_move_domain
)

@api.multi
def action_request_submit(self):
for rec in self:
if not rec.stock_request_ids:
Expand All @@ -76,7 +75,6 @@ def action_request_submit(self):
line.action_submit()
rec.request_stage = "submitted"

@api.multi
def action_request_cancel(self):
for rec in self:
if not rec.stock_request_ids:
Expand All @@ -89,7 +87,6 @@ def action_request_cancel(self):
line.action_cancel()
rec.request_stage = "cancel"

@api.multi
def action_request_draft(self):
for rec in self:
if not rec.stock_request_ids:
Expand Down Expand Up @@ -120,7 +117,6 @@ def _compute_picking_ids(self):
]
)

@api.multi
def action_view_delivery(self):
"""
This function returns an action that display existing delivery orders
Expand All @@ -141,7 +137,6 @@ def action_view_delivery(self):
action["res_id"] = delivery_ids[0]
return action

@api.multi
def action_view_returns(self):
"""
This function returns an action that display existing return orders
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from odoo import fields, models


class FSMTerritory(models.Model):
_inherit = "fsm.territory"
class ResTerritory(models.Model):
_inherit = "res.territory"

warehouse_id = fields.Many2one("stock.warehouse", string="Warehouse")
18 changes: 12 additions & 6 deletions fieldservice_stock/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,20 @@ class StockMove(models.Model):

def prepare_equipment_values(self, move_line):
return {
"name": "{} ({})".format(move_line.product_id.name, move_line.lot_id.name),
"name": "{} ({})".format(
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_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()
def _action_done(self, cancel_backorder=False):
res = super()._action_done(cancel_backorder)
for rec in self:
if (
rec.state == "done"
Expand All @@ -28,5 +32,7 @@ def _action_done(self):
):
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
3 changes: 2 additions & 1 deletion fieldservice_stock/models/stock_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ def create(self, vals):
picking_type_id = self.env["stock.picking.type"].search(
[
("code", "=", "stock_request_order"),
"|",
("warehouse_id", "=", vals["warehouse_id"]),
("warehouse_id", "=", False),
],
limit=1,
)
Expand Down Expand Up @@ -107,7 +109,6 @@ def _prepare_procurement_group_values(self):
else:
return {}

@api.multi
def _action_confirm(self):
for req in self:
if (not req.procurement_group_id) and req.fsm_order_id:
Expand Down
1 change: 0 additions & 1 deletion fieldservice_stock/models/stock_request_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def _prepare_procurement_group_values(self):
else:
return {}

@api.multi
def action_confirm(self):
if self.fsm_order_id:
fsm_order = self.env["fsm.order"].browse(self.fsm_order_id.id)
Expand Down
4 changes: 2 additions & 2 deletions fieldservice_stock/models/stock_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def _get_stock_move_values(
location_id,
name,
origin,
company_id,
values,
group_id,
):
vals = super()._get_stock_move_values(
product_id,
Expand All @@ -24,8 +24,8 @@ def _get_stock_move_values(
location_id,
name,
origin,
company_id,
values,
group_id,
)
vals.update({"fsm_order_id": values.get("fsm_order_id")})
return vals
1 change: 1 addition & 0 deletions fieldservice_stock/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* Brian McMaster <brian@mcmpest.com>
* Sandip Mangukiya <smangukiya@opensourceintegrators.com>
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
* Raphael Lee <rlee@opensourceintegrators.com>
2 changes: 1 addition & 1 deletion fieldservice_stock/readme/INSTALL.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
To install Field Service and have the mapping features, you need to install GeoEngine.

Please refer to the installation instructions available at:
https://github.com/OCA/geospatial/tree/11.0/base_geoengine
https://github.com/OCA/geospatial/tree/13.0/base_geoengine
10 changes: 8 additions & 2 deletions fieldservice_stock/views/fsm_equipment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@
<field name="product_id" />
<field
name="lot_id"
domain="[('product_id', '=', product_id)]"
context="{'default_product_id': product_id}"
domain="[
('product_id', '=', product_id),
('company_id', '=', company_id),
]"
context="{
'default_product_id': product_id,
'default_company_id': company_id,
}"
/>
<field name="current_stock_location_id" />
</group>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<odoo>
<!-- Territory Tree View -->
<record id="fsm_territory_wh_tree_view" model="ir.ui.view">
<field name="name">fsm.territory.warehouse.tree</field>
<field name="model">fsm.territory</field>
<field name="inherit_id" ref="fieldservice.fsm_territory_tree_view" />
<record id="res_territory_wh_tree_view" model="ir.ui.view">
<field name="name">res.territory.warehouse.tree</field>
<field name="model">res.territory</field>
<field name="inherit_id" ref="base_territory.res_territory_tree_view" />
<field name="arch" type="xml">
<field name="branch_id" position="after">
<field
Expand All @@ -14,10 +14,10 @@
</field>
</record>
<!-- Territory Form View -->
<record id="fsm_territory_wh_form_view" model="ir.ui.view">
<field name="name">fsm.territory.warehouse.form</field>
<field name="model">fsm.territory</field>
<field name="inherit_id" ref="fieldservice.fsm_territory_form_view" />
<record id="res_territory_wh_form_view" model="ir.ui.view">
<field name="name">res.territory.warehouse.form</field>
<field name="model">res.territory</field>
<field name="inherit_id" ref="base_territory.res_territory_form_view" />
<field name="arch" type="xml">
<field name="person_id" position="after">
<field
Expand Down
2 changes: 1 addition & 1 deletion fieldservice_stock/views/stock.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<menuitem
id="menu_fsm_stock_inventory"
name="Inventory"
action="stock.quantsact"
action="stock.action_view_quants"
parent="fieldservice.reporting"
sequence="30"
/>
Expand Down

0 comments on commit cf0dfc5

Please sign in to comment.