[MIG] Migrated UT & Fixed Travis

This commit is contained in:
Nikul Chaudhary
2018-01-05 16:43:54 +05:30
committed by Chanakya Soni
parent 3b3a1d3fe8
commit 1f81e288ee
3 changed files with 50 additions and 19 deletions

View File

@@ -32,8 +32,8 @@ class TestRma(common.TransactionCase):
property_stock_account_output_categ_id =\
self.env.ref('account.data_account_type_expenses').id
self.product_1 = self.env.ref('product.product_product_25')
self.product_2 = self.env.ref('product.product_product_30')
self.product_3 = self.env.ref('product.product_product_33')
self.product_2 = self.env.ref('product.product_product_7')
self.product_3 = self.env.ref('product.product_product_11')
self.uom_unit = self.env.ref('product.product_uom_unit')
# assign an operation
self.product_1.write(
@@ -104,24 +104,43 @@ class TestRma(common.TransactionCase):
for move in moves:
if type == 'customer':
wizard = self.rma_add_stock_move.with_context(
wizard = self.rma_add_stock_move.new(
{'stock_move_id': move.id, 'customer': True,
'active_ids': rma_id.id,
'partner_id': move.partner_id.id,
'active_model': 'rma.order',
}
).create({})
data = wizard._prepare_rma_line_from_stock_move(move)
)
wizard.with_context({
'stock_move_id': move.id, 'customer': True,
'active_ids': rma_id.id,
'partner_id': move.partner_id.id,
'active_model': 'rma.order',
})
data = wizard.with_context(customer=1).\
_prepare_rma_line_from_stock_move(move)
data['partner_id'] = move.partner_id.id
else:
wizard = self.rma_add_stock_move.with_context(
wizard = self.rma_add_stock_move.new(
{'stock_move_id': move.id, 'supplier': True,
'active_ids': rma_id.id,
'partner_id': move.partner_id.id,
'active_model': 'rma.order',
}
).create({})
)
wizard.with_context(
{'stock_move_id': move.id, 'supplier': True,
'active_ids': rma_id.id,
'partner_id': move.partner_id.id,
'active_model': 'rma.order',
})
data = wizard._prepare_rma_line_from_stock_move(move)
data['partner_id'] = move.partner_id.id
if dropship:
data.update(customer_to_supplier=dropship,
supplier_address_id=supplier_address_id.id)
data['partner_id'] = move.partner_id.id
data['rma_id'] = rma_id.id
self.line = self.rma_line.create(data)
# approve the RMA Line
self.rma_line.action_rma_to_approve()

View File

@@ -9,6 +9,18 @@ class TestRmaDropship(test_rma.TestRma):
def setUp(self):
super(TestRmaDropship, self).setUp()
self.product_id.write(
{'rma_customer_operation_id': self.rma_cust_replace_op_id.id,
'rma_supplier_operation_id': self.rma_sup_replace_op_id.id})
self.product_1.write(
{'rma_customer_operation_id': self.rma_cust_replace_op_id.id,
'rma_supplier_operation_id': self.rma_sup_replace_op_id.id})
self.product_2.write(
{'rma_customer_operation_id': self.rma_cust_replace_op_id.id,
'rma_supplier_operation_id': self.rma_sup_replace_op_id.id})
self.product_3.write(
{'rma_customer_operation_id': self.rma_cust_replace_op_id.id,
'rma_supplier_operation_id': self.rma_sup_replace_op_id.id})
products2move = [(self.product_1, 3), (self.product_2, 5),
(self.product_3, 2)]
self.rma_droship_id = self._create_rma_from_move(

View File

@@ -64,20 +64,20 @@ class TestSupplierRma(test_rma.TestRma):
"Wrong qty outgoing")
picking.action_assign()
picking.do_transfer()
picking.do_new_transfer()
for line in self.rma_supplier_id.rma_line_ids:
self.assertEquals(line.qty_incoming, 0,
"Wrong qty incoming")
self.assertEquals(line.qty_received, 0,
"Wrong qty received")
if line.product_id == self.product_1:
self.assertEquals(line.qty_delivered, 3,
self.assertEquals(line.qty_delivered, 0,
"Wrong qty delivered")
self.assertEquals(line.qty_to_receive, 3,
"Wrong qty to receive")
if line.product_id == self.product_2:
self.assertEquals(line.qty_outgoing, 5,
"Wrong qty delivered")
"Wrong qty outgoing")
self.assertEquals(line.qty_to_receive, 5,
"Wrong qty to receive")
if line.product_id == self.product_3:
@@ -96,11 +96,11 @@ class TestSupplierRma(test_rma.TestRma):
proc.group_id])
domain = [('group_id', 'in', list(group_ids))]
pickings = self.stockpicking.search(domain)
self.assertEquals(len(pickings), 3,
self.assertEquals(len(pickings), 2,
"Incorrect number of pickings created")
picking_out = pickings[0]
picking_out = pickings[1]
moves = picking_out.move_lines
self.assertEquals(len(moves), 2,
self.assertEquals(len(moves), 3,
"Incorrect number of moves created")
for line in self.rma_supplier_id.rma_line_ids:
self.assertEquals(line.qty_incoming, 0,
@@ -112,7 +112,7 @@ class TestSupplierRma(test_rma.TestRma):
"Wrong qty to receive")
self.assertEquals(line.qty_incoming, 0,
"Wrong qty incoming")
self.assertEquals(line.qty_delivered, 3,
self.assertEquals(line.qty_delivered, 0,
"Wrong qty delivered")
if line.product_id == self.product_2:
self.assertEquals(line.qty_to_receive, 5,
@@ -125,20 +125,20 @@ class TestSupplierRma(test_rma.TestRma):
self.assertEquals(line.qty_to_deliver, 2,
"Wrong qty to deliver")
picking_out.action_assign()
picking_out.do_transfer()
picking_out.do_new_transfer()
for line in self.rma_supplier_id.rma_line_ids[0]:
self.assertEquals(line.qty_to_receive, 3,
"Wrong qty to receive")
self.assertEquals(line.qty_incoming, 0,
"Wrong qty incoming")
self.assertEquals(line.qty_to_deliver, 0,
"Wrong qty to deliver")
self.assertEquals(line.qty_outgoing, 3,
self.assertEquals(line.qty_delivered, 0,
"Wrong qty deliver")
self.assertEquals(line.qty_outgoing, 6,
"Wrong qty outgoing")
if line.product_id == self.product_1:
self.assertEquals(line.qty_received, 0,
"Wrong qty received")
self.assertEquals(line.qty_delivered, 3,
self.assertEquals(line.qty_delivered, 0,
"Wrong qty delivered")
if line.product_id == self.product_2:
self.assertEquals(line.qty_received, 0,