-
Notifications
You must be signed in to change notification settings - Fork 23.1k
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
[FIX] mrp, sale_mrp: _run_pull creates many pickings #162947
[FIX] mrp, sale_mrp: _run_pull creates many pickings #162947
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.
Thanks for your fix, can you add a test as well? 🙂
addons/mrp/models/stock_rule.py
Outdated
if rule.picking_type_id == warehouse_id.sam_type_id or ( | ||
warehouse_id.manufacture_steps == 'pbm_sam' | ||
and warehouse_id.sam_loc_id | ||
and warehouse_id.sam_loc_id.parent_path in rule.location_src_id.parent_path | ||
): |
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 rule.picking_type_id == warehouse_id.sam_type_id or ( | |
warehouse_id.manufacture_steps == 'pbm_sam' | |
and warehouse_id.sam_loc_id | |
and warehouse_id.sam_loc_id.parent_path in rule.location_src_id.parent_path | |
): | |
if warehouse_id.manufacture_steps != 'pbm_sam': | |
continue | |
if rule.picking_type_id == warehouse_id.sam_type_id or (warehouse_id.sam_loc_id and warehouse_id.sam_loc_id.parent_path in rule.location_src_id.parent_path): |
Since the whole point of this override is to handle the pbm_sam
case, I don't think we should do any of the following if the option is disabled.
1e1da7b
to
2bcfc08
Compare
Have you tried running your test locally? And doesn't it looks a bit... out of place? 👀 Even with the required fixes on it, the test passes even without your fix as well. |
2bcfc08
to
4589c8a
Compare
Oops, my bad. It should be alright now. |
I think you missed that part:
|
Turns out I was dumb. 🥲 |
4589c8a
to
e8882b3
Compare
addons/mrp/models/stock_rule.py
Outdated
if warehouse_id.manufacture_steps != 'pbm_sam': | ||
continue |
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.
After some more thinking and discussion, this is sadly not enough. While this effectively solves your case, it still leaves other doors open if a rule unrelated to manufacture ends up having a location child of sam_loc_id
.
I'd propose something along those lines instead:
if warehouse_id.manufacture_steps != 'pbm_sam': | |
continue | |
manu_rule = rule.route_id.rule_ids.filtered(lambda r: r.action == 'manufacture' and r.warehouse_id == warehouse_id) | |
if warehouse_id.manufacture_steps != 'pbm_sam' or not manu_rule: | |
continue |
Basically move the manu_rule
search above (and remove the useless code that checked if it was found or not), to avoid triggering this code if we're not in a manufacture
context at all. Hopefully this will be enough.
What do you think?
The steps to reproduce: - Go to a warehouse. Under the technical information tab, change the field sam_loc_id from "WH/Post-Production" to "WH/Stock". - Create a sales order with 2 different products and confirm it. - 2 pickings will be created with different group_id MO/XXXX instead of a single picking. After this commit we only check the sam_loc_id if we are in 3 steps manufacturing. OPW-3871886
e8882b3
to
21ee104
Compare
Thank you! |
The steps to reproduce: - Go to a warehouse. Under the technical information tab, change the field sam_loc_id from "WH/Post-Production" to "WH/Stock". - Create a sales order with 2 different products and confirm it. - 2 pickings will be created with different group_id MO/XXXX instead of a single picking. After this commit we only check the sam_loc_id if we are in 3 steps manufacturing. OPW-3871886 closes #162947 Signed-off-by: Quentin Wolfs (quwo) <quwo@odoo.com>
The steps to reproduce: - Go to a warehouse. Under the technical information tab, change the field sam_loc_id from "WH/Post-Production" to "WH/Stock". - Create a sales order with 2 different products and confirm it. - 2 pickings will be created with different group_id MO/XXXX instead of a single picking. After this commit we only check the sam_loc_id if we are in 3 steps manufacturing. OPW-3871886 closes odoo#162947 Signed-off-by: Quentin Wolfs (quwo) <quwo@odoo.com>
The steps to reproduce:
After this commit, we only check the sam_loc_id if we are in 3 steps manufacturing.
OPW-3871886
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr