pythonodooerpodoo-15

How to stop Odoo from automatically generate a purchase order when no stock in Odoo 15?


I'm basically trying to set a custom property for products, so if a product has a specific property, even if there is no stock of that product Odoo does not create a purchase order after confirming a sale order; instead, Odoo sends an email to the customer, so the customer must confirm the order, and then the purchase order is generated. My problem here is confirming the order and creating the picking (to reserve the products), but not creating the purchase order.

I tried a few things, like looking at _run_pull and _action_launch_stock_rule, but I am rather lost. Any suggestions would be really helpful.


Solution

  • The answer: _action_launch_stock_rule is the intial entry point for procurements. A lot of things can happen at that point. Usually pickings with moves are created first, which then will start a procurement probably ending in creating a purchase order. So if you only want to temporarly skip the purchase order creation _run_buy() could be a good entry point for you to look at. – CZoellner