Skip to content

stock_available_mrp: Available to promise and Potiential qty for Kit products #2301

@mt-software-de

Description

@mt-software-de

res[product.id]["immediately_usable_qty"] = potential_qty

Hey @rousseldenis @lmignon @guewen maybe someone of you can help me here.

I quite don't understand why the implementation for potential_qty and immediately_usable_qty for products with kit bom, is done like it is done in stock_available_mrp.

The addon calculates the potential qty for a product with a bom and set this qty also on immediately_usable_qty for products with a kit bom. The calculation is basically the same as it is done by odoo, ttps://github.com/odoo/odoo/blob/05e5a908a41ba8a38f1d8a28e750220a65f03bef/addons/mrp/models/product.py#L302
With the small difference that it uses the uom.rounding and allowing float values. Which you can see here

potential_qty = bom_id.product_uom_id._compute_quantity(
. Odoo calculates only integers.

I quite don't understand why it is done like that.
Because for example if you have the following Product configuration.

Product A has a Bom with two Components.
Product B is needed 2 times
Product C is needed 4 times
Qty on hand Product B 4
Qty on hand Product C 3

This results in
Product B can fulfil Product A 2 times
Product C can fulfil Product A 1,5 times

In my opinion it should be like

Case 1 Bom is normal bom
Product A has a on hand qty of 2
potential_qty should be 1,5
immediately_usable_qty should be 3,5 (2 on hand, 1,5 potential)
depending on the uom rounding
This case is developed like that

Case 2 Bom is a kit bom
Potential_qty should be 0 (i don't know why this should be usefull)
immediately_usable_qty should be 1
In this case there will be never a real qty on hand for Product A
Also if would be like that the calculation would not be needed, because it is like with this addon.
But this isn't the case right now.
It is
potential_qty = 1,5
immediately_usable_qty = 1,5

I have a few questions / thoughts want i think needs to be changed here.

  • the calculation should only be done for products with normal boms
  • we should get rid of the used config parameter
    stock_available_mrp_based_on = icp.sudo().get_param(
    we should rely on the installed addons stock_available and stock_available_immediately and just use the field immediately_usable_qty
  • potential_qty is only really used and calculated in stock_available_mrp why is it not defined there?

It would be nice to here from you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    stalePR/Issue without recent activity, it'll be soon closed automatically.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions