-
-
Notifications
You must be signed in to change notification settings - Fork 552
[15.0][ADD] mrp_bom_assing_auto: New module #1662
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
base: 15.0
Are you sure you want to change the base?
[15.0][ADD] mrp_bom_assing_auto: New module #1662
Conversation
|
Check CI |
1420419 to
61a2c1d
Compare
| for line in bom.bom_line_ids: | ||
| required = line.product_qty | ||
| component = line.product_id | ||
| available = quant._get_available_quantity( |
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.
It may be better to load the availability of all products at once to obtain better performance.
See how this is done in the production order:
https://github.com/odoo/odoo/blob/fb4c85e007ee70e95e95197d358f1cde19b82338/addons/stock/models/stock_move.py#L440
Then decide (either you or add an option for the user to do so) whether to take into account free_qty, virtual_available, or another option.
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.
At the moment, virtual_available is hard-coded, but it might be useful to make this a configurable setting for the user. What do you think?
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, it is better to add an option for the user to decide.
The default option should be free_qty.
406d769 to
d5e2c31
Compare
| rec["id"]: rec["virtual_available"] for rec in product_available | ||
| } | ||
| for bom in boms: | ||
| if not bom: |
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.
When does this condition occur within the for?
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.
will never occur, that was code left behind.
b6197b8 to
49c4790
Compare
49c4790 to
6294525
Compare
6294525 to
e1758d5
Compare
|
@carlosdauden @sergio-teruel please could you review? |
cc @Tecnativa TT59293
ping @sergio-teruel @victoralmau
This module verifies all available BoMs for a given product and automatically selects the first BoM for which all required components are currently in stock. If no BoM meets the availability criteria, the module gracefully falls back to Odoo’s default BoM selection logic.