From 37abae957e9f5dc362761e66037900721024b742 Mon Sep 17 00:00:00 2001 From: Nikul Chaudhary Date: Tue, 9 Jan 2018 15:35:29 +0530 Subject: [PATCH] [IMP] Improved Code. --- rma/models/procurement.py | 8 ++++---- rma/tests/test_rma.py | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/rma/models/procurement.py b/rma/models/procurement.py index eeeb9eb2..d51dc585 100644 --- a/rma/models/procurement.py +++ b/rma/models/procurement.py @@ -14,10 +14,10 @@ class ProcurementOrder(models.Model): ) @api.model - def _run_move_create(self, procurement): - res = super(ProcurementOrder, self)._run_move_create(procurement) - if procurement.rma_line_id: - line = procurement.rma_line_id + def _get_stock_move_values(self): + res = super(ProcurementOrder, self)._get_stock_move_values() + if self.rma_line_id: + line = self.rma_line_id res['rma_line_id'] = line.id if line.delivery_address_id: res['partner_id'] = line.delivery_address_id.id diff --git a/rma/tests/test_rma.py b/rma/tests/test_rma.py index 4ebcfe90..b31adfcc 100644 --- a/rma/tests/test_rma.py +++ b/rma/tests/test_rma.py @@ -275,6 +275,9 @@ class TestRma(common.TransactionCase): 'active_id': 1 }).default_get({}) procurements = wizard._create_picking() + for proc in procurements: + proc._get_stock_move_values() + group_ids = set([proc.group_id.id for proc in procurements if proc.group_id]) domain = [('group_id', 'in', list(group_ids))]