|
|
default_supplier_location_id = self.env['ir.default'].sudo()._get('res.partner', 'property_stock_supplier')
for picking in self:
if picking.state in ('cancel', 'done') or picking.return_id:
continue
picking = picking.with_company(picking.company_id)
if picking.picking_type_id:
location_src = picking.picking_type_id.default_location_src_id
if location_src.usage == 'supplier' and picking.partner_id:
supplier_location = picking.partner_id.property_stock_supplier
if supplier_location and supplier_location.id != default_supplier_location_id:
location_src = supplier_location
picking.location_id = location_src.id
|
|