Skip to content

Commit

Permalink
Merge PR #1274 into 17.0
Browse files Browse the repository at this point in the history
Signed-off-by brian10048
  • Loading branch information
OCA-git-bot committed Dec 4, 2024
2 parents 18d4f88 + 30b5f08 commit c35808d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion fieldservice_recurring/models/fsm_recurring.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,17 @@ def onchange_recurring_template_id(self):
def populate_from_template(self, template=False):
if not template:
template = self.fsm_recurring_template_id
return {
vals = {
"fsm_frequency_set_id": template.fsm_frequency_set_id,
"max_orders": template.max_orders,
"description": template.description,
"fsm_order_template_id": template.fsm_order_template_id,
"scheduled_duration": template.fsm_order_template_id.duration,
"company_id": template.company_id,
}
if template.fsm_order_template_id.team_id:
vals["team_id"] = template.fsm_order_template_id.team_id.id
return vals

@api.model_create_multi
def create(self, vals_list):
Expand Down
9 changes: 6 additions & 3 deletions fieldservice_sale_recurring/models/sale_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,24 @@ def _field_create_fsm_recurring_prepare_values(self):
self.ensure_one()
template = self.product_id.fsm_recurring_template_id
product = self.product_id
order_template = product.fsm_order_template_id or template.fsm_order_template_id
note = self.name
if template.description:
note += "\n " + template.description
return {
vals = {
"location_id": self.order_id.fsm_location_id.id,
"start_date": self.order_id.expected_date,
"fsm_recurring_template_id": template.id,
"description": note,
"max_orders": template.max_orders,
"fsm_frequency_set_id": template.fsm_frequency_set_id.id,
"fsm_order_template_id": product.fsm_order_template_id.id
or template.fsm_order_template_id.id,
"fsm_order_template_id": order_template.id,
"sale_line_id": self.id,
"company_id": self.company_id.id,
}
if order_template.team_id:
vals["team_id"] = order_template.team_id.id
return vals

def _field_create_fsm_recurring(self):
"""Generate fsm_recurring for the given so line, and link it.
Expand Down

0 comments on commit c35808d

Please sign in to comment.