[IMP] <mrp_operations_extension>: Modifications added to avoid errors in miss configurations.

This commit is contained in:
campos
2015-03-03 18:03:29 +01:00
committed by Pedro M. Baeza
parent 3ffaa5146d
commit cf823afa89
2 changed files with 4 additions and 3 deletions

View File

@@ -43,7 +43,7 @@ class MrpBom(models.Model):
seq = work_order['sequence'] - level
routing_lines = routing_line_obj.search([
('routing_id', '=', routing_id), ('sequence', '=', seq)])
routing_line_id = routing_lines.id
routing_line_id = routing_lines and routing_lines[0].id or False
for routing_line in routing_lines:
if routing_line.name in work_order['name']:
routing_line_id = routing_line.id

View File

@@ -84,8 +84,9 @@ class MrpRoutingWorkcenter(models.Model):
'op_number': self.operation.op_number,
}
op_wc_lst.append(data)
op_wc_lst[0]['default'] = True
self.op_wc_lines = op_wc_lst
if op_wc_lst:
op_wc_lst[0]['default'] = True
self.op_wc_lines = op_wc_lst
@api.one
@api.onchange('op_wc_lines')