Search code examples
productodoo-15purchase-order

How product.supplierinfo works in odoo 15?


I've seen that whenever i create a new PO(Purchase Order), odoo will create a new product.supplierinfo related to my products.

But i can't find which function that let them do that.

enter image description here

Please help, thanks.


Solution

  • Thanks to Waleed Mohsen, i've found the answer:

    When you confirm a PO the button_confirm method will be called and in this method there is another method called _add_supplier_to_product which loop all PO lines and add the supplier info to the product.

    You can check the method _add_supplier_to_product in purchase.py file inside models folder of purchase app.

    I've found how it save in line.product_id.write(vals) in _add_supplier_to_product() function, which line.product_id.seller_ids is linked to product.supplierinfo model:

    enter image description here