Skip to content
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

Open
wants to merge 1 commit into
base: 17.0
Choose a base branch
from

Conversation

imlopes
Copy link

@imlopes imlopes commented Oct 23, 2024

No description provided.

@max3903 max3903 added this to the 17.0 milestone Oct 29, 2024
@max3903 max3903 changed the title [17.0][ADD]: fieldservice_recurring_repair [17.0][ADD] fieldservice_recurring_repair Oct 29, 2024
Copy link

@vvrossem vvrossem left a 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

fieldservice_recurring_repair/__manifest__.py Outdated Show resolved Hide resolved
fieldservice_recurring_repair/__manifest__.py Outdated Show resolved Hide resolved
fieldservice_recurring_repair/models/fsm_recurring.py Outdated Show resolved Hide resolved
fieldservice_recurring_repair/models/fsm_recurring.py Outdated Show resolved Hide resolved
fieldservice_recurring_repair/models/fsm_recurring.py Outdated Show resolved Hide resolved
@imlopes imlopes force-pushed the 17.0-add-fieldservice_recurring_repair branch from a6ac238 to 83b5837 Compare October 30, 2024 12:02
@max3903 max3903 self-assigned this Nov 15, 2024
Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

- 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`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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`.

Comment on lines +17 to +22
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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)

Comment on lines +25 to +29
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"
)

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:

Suggested change
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()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
orders._onchange_template_id()

Already done by super, isn't it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants