Skip to content

Commit

Permalink
fix create
Browse files Browse the repository at this point in the history
  • Loading branch information
EdgarRetes committed Nov 19, 2024
1 parent f0f1d80 commit 923c972
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions fieldservice_account_analytic/models/analytic_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ class AccountAnalyticLine(models.Model):
fsm_order_id = fields.Many2one("fsm.order", string="FSM Order")
product_id = fields.Many2one("product.product", string="Time Type")

@api.model
@api.model_create_multi
def create(self, vals_list):
records = super().create(vals_list)
for record, vals in zip(records, vals_list):
for vals in vals_list:
order = self.env["fsm.order"].browse(vals.get("fsm_order_id"))
if order:
if order.location_id.analytic_account_id:
Expand All @@ -23,7 +22,7 @@ def create(self, vals_list):
raise ValidationError(
_("No analytic account set " "on the order's Location.")
)
return records
return super().create(vals_list)

@api.onchange("product_id")
def onchange_product_id(self):
Expand Down

0 comments on commit 923c972

Please sign in to comment.