Skip to content

Commit

Permalink
[IMP] repair_order_type
Browse files Browse the repository at this point in the history
  • Loading branch information
unaiberis authored and oihane committed Jul 23, 2024
1 parent 45f8996 commit 14e1e93
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion repair_order_type/models/repair_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class RepairLine(models.Model):
_inherit = "repair.line"

@api.onchange("type", "repair_id", "repair_id.type_id")
@api.onchange("type", "repair_id")
def onchange_operation_type(self):
res = super().onchange_operation_type()
if self.type == "add":
Expand All @@ -16,3 +16,14 @@ def onchange_operation_type(self):
self.location_id = self.repair_id.type_id.location_dest_id.id
self.location_dest_id = self.repair_id.type_id.location_id.id
return res

@api.depends("repair_id.type_id")
def _compute_location_id(self):
res = super()._compute_location_id()
if self.type == "add":
self.location_id = self.repair_id.type_id.location_id.id
self.location_dest_id = self.repair_id.type_id.location_dest_id.id
else:
self.location_id = self.repair_id.type_id.location_dest_id.id
self.location_dest_id = self.repair_id.type_id.location_id.id
return res

0 comments on commit 14e1e93

Please sign in to comment.