feat: Add final location lookup and assign it to stock moves.
This commit is contained in:
parent
fa261b7b82
commit
f943db9235
@ -53,6 +53,14 @@ class ApprovalRequest(models.Model):
|
||||
if not dest_loc:
|
||||
raise UserError(_("Destination Location '%s' not found. Please contact administrator.") % dest_loc_name)
|
||||
|
||||
# Find Final Location
|
||||
final_loc_name = "WHBK/Stock/Preparation"
|
||||
final_loc = self.env['stock.location'].search([('complete_name', '=', final_loc_name)], limit=1)
|
||||
if not final_loc:
|
||||
final_loc = self.env['stock.location'].search([('complete_name', 'ilike', 'whbk/stock/preparation')], limit=1)
|
||||
if not final_loc:
|
||||
raise UserError(_("Final Location '%s' not found. Please contact administrator.") % final_loc_name)
|
||||
|
||||
if not self.product_line_ids:
|
||||
raise UserError(_("You must select products to create a transfer."))
|
||||
|
||||
@ -73,6 +81,7 @@ class ApprovalRequest(models.Model):
|
||||
'product_uom': line.product_uom_id.id,
|
||||
'location_id': picking_type.default_location_src_id.id,
|
||||
'location_dest_id': dest_loc.id,
|
||||
'location_final_id': final_loc.id,
|
||||
}
|
||||
picking_vals['move_ids'].append((0, 0, move_vals))
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user