[9.0][REW] rma_repair: adapt

This commit is contained in:
lreficent
2017-10-20 11:19:44 +02:00
committed by ahenriquez
parent b6657d8a3a
commit af9e1f1efb
4 changed files with 47 additions and 19 deletions

View File

@@ -60,7 +60,13 @@ class RmaOrderLine(models.Model):
def action_view_repair_order(self):
action = self.env.ref('mrp_repair.action_repair_order_tree')
result = action.read()[0]
result['domain'] = [('id', 'in', self.repair_ids.ids)]
repair_ids = self.repair_ids.ids
if len(repair_ids) != 1:
result['domain'] = [('id', 'in', repair_ids)]
elif len(repair_ids) == 1:
res = self.env.ref('mrp_repair.view_repair_order_form', False)
result['views'] = [(res and res.id or False, 'form')]
result['res_id'] = repair_ids[0]
return result
@api.multi