[FIX] stock: Error if warehouse_id is given to the form view
If the developer wants to give warehouse_id form view, when create new location, there will be an error in the compute function because it use function split() with field parent_path has no value closes odoo/odoo#115103 X-original-commit: 4d9b2ec6c85a178898bd81fe45bb0fcd3ba1a901 Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
@@ -152,6 +152,8 @@ class Location(models.Model):
|
||||
view_by_wh = OrderedDict((wh.view_location_id.id, wh.id) for wh in warehouses)
|
||||
self.warehouse_id = False
|
||||
for loc in self:
|
||||
if not loc.parent_path:
|
||||
continue
|
||||
path = set(int(loc_id) for loc_id in loc.parent_path.split('/')[:-1])
|
||||
for view_location_id in view_by_wh:
|
||||
if view_location_id in path:
|
||||
|
||||
Reference in New Issue
Block a user