[18.0][FIX] fieldservice_sale: preserve FSM template type#1532
Conversation
|
Hi @wolfhall, @brian10048, @max3903, |
|
The current failing test job is unrelated to this PR's |
|
CI should now be green after #1533 merged (fixes the upstream date-test flakiness). This is a focused [FIX] preserving FSM template types on SO lines. Ready for review when possible! |
|
@fsmw Please do a rebase — the red tests might turn green afterward. |
rrebollo
left a comment
There was a problem hiding this comment.
Functional and code review: It's working really well.
From a technical perspective, I would personally suggest refactoring to simplify the template_ids approach. Please consider it.
| @@ -78,13 +78,16 @@ def _prepare_fsm_values(self, **kwargs): | |||
| template_id = kwargs.get("template_id", False) | |||
| template_ids = kwargs.get("template_ids", [template_id]) | |||
There was a problem hiding this comment.
I did my research. The template_ids keyword argument is misleading. Look at how it's used: the fsm_order_template_id field on sale.order is a many2one, so it always points to a single record — not many.
If You go this way You would need to refactor almost all the method here.
I might be wrong, so please review and consider this. You could even correct it in
field-service/fieldservice_sale/models/sale_order.py
Lines 102 to 122 in 9560bf6
82304de to
44ca041
Compare
|
This PR has the |
Fixes #1398
Summary
Verification
pre-commit run --files fieldservice_sale/models/sale_order.py fieldservice_sale/tests/test_fsm_sale_common.py fieldservice_sale/tests/test_fsm_sale_order.py/home/fsmw/dev/smwlab/.venv/bin/python /home/fsmw/dev/smwlab/OCB/odoo-bin --addons-path=/home/fsmw/dev/smwlab/OCB/odoo/addons,/home/fsmw/dev/smwlab/OCB/addons,/home/fsmw/dev/smwlab/oca-fsmw/field-service -d test_fieldservice_sale_template_type_green3 --init=fieldservice_sale --test-enable --stop-after-init --test-tags /fieldservice_sale --http-port=18073