odooodoo-13

creation of Manufacturing Order from Sale Order


I know the functional flow of the sale order in which a MO is created for a product that is configured to be manufactured in product master

Below I have descried in brief the Functional flow:

when we create a product and set it as manufacturing we then create a BOM for that respective product, which results in the creation of a Manufacturing Order after confirming a sale order for that product, and the origin field in MO contains the sale order name too.

My question is, Which Method in the backend is responsible for the creation of MO from sale order? actually, the MO is created in the confirmed state and I want it to be created in draft when it is created from Sale Order. so I like to know which method is responsible for that


Solution

  • Manufacture Orders are created as part of the procurement planning system by the Stock Rule object in the method called _run_manufacture

    Link to the line where the confirmation takes place.
    https://github.com/odoo/odoo/blob/7ec6ae3863da4c7355c4a22ef799815a38188402/addons/mrp/models/stock_rule.py#L55