-
Notifications
You must be signed in to change notification settings - Fork 244
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] [IMP] fieldservice[_*]: populate person_id
and warehouse_id
from the related territory (if set)
#1281
base: 17.0
Are you sure you want to change the base?
[17.0] [IMP] fieldservice[_*]: populate person_id
and warehouse_id
from the related territory (if set)
#1281
Conversation
Hi @brian10048, @max3903, @wolfhall, @smangukiya, |
2dda2db
to
539076d
Compare
539076d
to
bc6f807
Compare
bc6f807
to
4467947
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.
Thanks for the improvements
@OCA/field-service-maintainers ok to merge? |
@ivantodorovich Yes |
) | ||
equipment_ids = fields.Many2many("fsm.equipment") | ||
|
||
@api.depends("location_id") | ||
def _compute_person_id(self): | ||
"""Compute the person from the location's territory""" |
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.
If I recall correctly, you may not use territory and assing person directly
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.
The territory comes from the location (related to location_id.territory_id
)
So the goal here is to populate the order's assigned user from the related territory's partner (if set)
Not sure if it clarifies something for you, I'm not sure I understood what you mean
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.
Yes but leaving person_id blank is a feature.
The use of territory_id on location is optionnal.
I have business case where the vendor create the FSM Order and set a location (and leave person_id with no value), then (few days after) some manager assign a person to the 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.
That case still works, you just don't set any territory on the location, or no Assigned user on the territory.
Isn't it enough for your use case?
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.
If you need a "default_person_id" on territory or fsm_location, why not just create one ?
It will be more explicit about what it does.
In order to achieve it in a clean and performant way, some refactors have been made to convert onchanges to computed (stored and writable) fields.