-
-
Notifications
You must be signed in to change notification settings - Fork 501
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
[11.0][MIG] mrp_auto_assign #270
Conversation
022ecc4
to
ed050d4
Compare
ed050d4
to
efc7891
Compare
I identified a problem with the module |
|
||
from odoo import api, models | ||
import logging | ||
_logger = logging.getLogger(__name__) |
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.
Useless import
if qty_to_procure < move.product_uom_qty: | ||
move.product_uom_qty - move.reserved_availability - | ||
sum(move.mapped('move_orig_ids.product_uom_qty'))) | ||
if 0.0 < qty_to_procure < move.product_uom_qty: |
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.
I see the problem. It would be nice to add a test to show the problem, so we avoid a regression on next migration.
But I don't think this change fixes the problem fully. For instance, if the raw material is purchased instead of manufactured, the system will create a draft PO instead of a MO. In this case, and until the PO is validated, the move.mapped('move_orig_ids.product_uom_qty')
will always be 0 (because the incoming shipment is not yet created) and the bug will still happen.
IMHO, after creating the raw material MO or PO, we should :
- write procure_method = 'make_to_order' on the raw material stock move that need the sub MO/PO
- Recompute its state so it become 'waiting' (method
_recompute_state
)
This way, we have the same data as if the raw material product is configured with route make to order.
Then we can add the procure_method
field in the condition :
if move.state in ('partially_available', 'confirmed') \
and move.location_id in \
move.product_id.mrp_mts_mto_location_ids \
and not mto_with_no_move_dest_id and move.procure_method != 'make_to_order':
This way, a raw material move that has already generated a sub MO/PO won't be taken into account anymore and it works for the purchase raw material case.
Indeed, with the present way, what I don't like is that the raw material moves states and procurement method are not coherent with what really happen. (When a stock move waits another move, it has to be in waiting
state, not confirmed
For the second case (mto_with_no_move_dest_id checked) I don't think there is any problem. I guess we could also put move.procure_method != 'make_to_order'
in the main condition. But for this case, we should not write the procure_method to make_to_order, as there are no link between the sub MOs/POs and the main.
What do you think?
Do you know if the bug is also present in version 10?
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.
You are right, the issue will still be persistent with POs. I like your approach, to actually manage them as make_to_order it's indeed a improvement , the problem is odoo does allow a easy modification to the procure_method, see.
I will try to play around it and extend the tests.
No, the bug is not present in v10 as there were procurement.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.
@florian-dacosta I think it should be good now. I saw that what I did finally was what you were saying on the first place, I guess I misunderstood you a little bit on my previous comment. Anyway, it is ready now!
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.
23b2073
to
ee72a52
Compare
May you review minor improvement at ForgeFlow#4 |
I've made a rework of The fix done here it's not the good one I think. Can you please review? |
Since maybe the fix on |
ee72a52
to
5d3c959
Compare
@florian-dacosta yes, done! |
Thanks! |
5d3c959
to
14519df
Compare
Rebased and 🍏 ! |
Migration to v11.
cc @florian-dacosta