Search code examples
odooodoo-8purchase-order

How to override button "confirm order" in module Purchase of Odoo


I'm trying to override button "confirm order" in module "Purchase". This button will change a quotation into a purchase order (state: Purchase Confirmed), simultaneous automatically create a new receipt in module "Warehouse" so when I click button "Receive Products", I can see the receipt.

I tried to super many different functions but when i clicked the button, it just changed state, not create a new receipt. Beside, I found out that this button is from workflow and its function may be "wkf_confirm_order" but it didn't work.

@api.multi
def purchase_confirm(self):
    #super(purchase_order,self).wkf_bid_received()
    super(purchase_order,self).wkf_confirm_order()
    #super(purchase_order,self).wkf_approve_order()
    return True

Please, help me to find the correct function. I really appreciate your help. Thanks in advance.


Solution

  • To know which function of that model will be called while you click on that button you need to follow these steps.

    • Start developer mode
    • Click on Purchase Orders menu
    • Click on EDIT WORKFLOW option from the debug menu

    enter image description here

    • Then open that workflow record in diagram view by clicking on diagram view.

    enter image description here

    • Then it will open entire workflow of purchase order

    enter image description here

    • Click on confirm order action, it will open activity wizard from where you can see which action has been done while you click on that button.

    enter image description here

    Click here to know more about workflow.