-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[17.0][ADD] fieldservice_recurring_repair #1250
base: 17.0
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add docstring and/or find a more suitable name for the methods in fsm.reccuring
a6ac238
to
83b5837
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@imlopes Can you use the latest logo from fieldservice
?
equipment, this module allows you to create a recurring work order for several | ||
equipments. This way, you can create a recurring order for a group of equipments | ||
and the `fsm.order` will be created for each equipment. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- set the equipment to the one delivered | ||
7. click Start | ||
|
||
This will create one `fsm.order` per equipment and one `repair.order` by `fsm.order`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will create one `fsm.order` per equipment and one `repair.order` by `fsm.order`. | |
This will create one `fsm.order` per equipment and one `repair.order` per `fsm.order`. |
orders = self.env["fsm.order"] | ||
for equipment in self.equipment_ids: | ||
order_vals = vals.copy() | ||
order_vals["equipment_id"] = equipment.id | ||
orders |= self.env["fsm.order"].create(order_vals) | ||
return orders |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
orders = self.env["fsm.order"] | |
for equipment in self.equipment_ids: | |
order_vals = vals.copy() | |
order_vals["equipment_id"] = equipment.id | |
orders |= self.env["fsm.order"].create(order_vals) | |
return orders | |
return self.env["fsm.order"].create( | |
[ | |
dict(vals, equipment_id=equipment.id) | |
for equipment in self.equipment_ids | |
] | |
) |
nitpicking: to create all at once (better for perf)
return bool( | ||
self.fsm_order_template_id | ||
and self.fsm_order_template_id.type_id | ||
and self.fsm_order_template_id.type_id.internal_type == "repair" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 tip: This is exactly the same as:
return bool( | |
self.fsm_order_template_id | |
and self.fsm_order_template_id.type_id | |
and self.fsm_order_template_id.type_id.internal_type == "repair" | |
) | |
return self.fsm_order_template_id.type_id.internal_type == "repair" |
order._onchange_template_id() | ||
else: | ||
orders = super()._create_order(date) | ||
orders._onchange_template_id() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
orders._onchange_template_id() |
Already done by super, isn't it?
No description provided.