I am new to Odoo development. I am trying to override the default picking validate action to add a shipment booking process to it with a third party shipping delegate. I can see that is done in stock.picking. There is a method action_done changes the status of the picking status to done. So I created a class that extends this stock.picking and have this method like this,
from odoo import api, fields, models
class StockPicking(models.Model):
_inherit = 'stock.picking'
@api.multi
def action_done(self):
res = super(StockPicking, self).action_done()
print('BOOKING THE SHIPMENT NOW!!')
return res
I was wondering what else I need to do to make it use my class as I did not see my model method was executed when I click on the validate button in the picking.
The other question is about the 2 step picking/packing. I have set up the fulfilment workflow to be 2 step fulfilment, eg, picking -> packing/shipment booking. It seems that the validate button always runs action_done method in the stock.picking. I would like to add a shipment booking only in the packing step. How do I do this? Is this place the best place to add the shipment booking logic? Or how do I tell if that is in picking or in packing step in the code?
Thanks so much!