Hi odoor,
You can specify source location when stock move create from sale order.
so you need to call super method of create and you can add source location.
also need find there which location you want to set.
stock move have picking_type_id and warehouse_id based on that field, you can set source location in SO.
for example:
class StockMove(models.Model):
_inherit='stock.move'
@api.model
def create(self,vals):
stock_picking_data = self.env['stock.picking.type'].browse(vals.get('picking_type_id'))
if stock_picking_data.code == 'incoming':
warehouse_data = self.env['stock.warehouse'].browse(vals.get('warehouse_id'))
if warehouse_data:
your condition here which location you want to set.
return super(StockMove,self).create(vals)
Hope this help you.
Best Thanks,
Ankit H Gandhi.