Skip to content

Commit

Permalink
[MIG] fieldservice_stock: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gbrito committed Nov 3, 2022
1 parent 8b648da commit 3883c70
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion 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": "15.0.1.0.0",
"version": "16.0.1.0.0",
"category": "Field Service",
"author": "Open Source Integrators, "
"Brian McMaster, "
Expand Down
15 changes: 10 additions & 5 deletions fieldservice_stock/models/fsm_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@ class FSMLocation(models.Model):
inventory_location_id = fields.Many2one(
"stock.location",
string="Inventory Location",
compute="_compute_inventory_location_id",
store=True,
required=True,
default=lambda self: self.env.ref("stock.stock_location_customers"),
)
shipping_address_id = fields.Many2one("res.partner", string="Shipping Location")

@api.onchange("fsm_parent_id")
def _onchange_fsm_parent_id(self):
res = super(FSMLocation, self)._onchange_fsm_parent_id()
self.inventory_location_id = self.fsm_parent_id.inventory_location_id.id
return res
@api.depends("fsm_parent_id", "fsm_parent_id.inventory_location_id")
def _compute_inventory_location_id(self):
for rec in self:
if not rec.fsm_parent_id.inventory_location_id:
rec.inventory_location_id = None
continue

rec.inventory_location_id = rec.fsm.fsm_parent_id.inventory_location_id
4 changes: 2 additions & 2 deletions fieldservice_stock/models/fsm_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ class FSMOrder(models.Model):

@api.model
def _default_warehouse_id(self):
company = self.env.user.company_id.id
company = self.env.user.company_id
warehouse_ids = self.env["stock.warehouse"].search(
[("company_id", "=", company)], limit=1
[("company_id", "=", company.id)], limit=1
)
return warehouse_ids and warehouse_ids.id

Expand Down

0 comments on commit 3883c70

Please sign in to comment.