[REF] stock,stock_account: remove function do_transfer
We removed the function do_transfer that is deprecated since Odoo 10.0 We also remove useless call of functions with context 'debug'
This commit is contained in:
@@ -426,7 +426,7 @@
|
||||
obj().env.ref('stock.outgoing_shipment_main_warehouse2').id]"/>
|
||||
</function>
|
||||
|
||||
<function model="stock.picking" name="do_transfer">
|
||||
<function model="stock.picking" name="action_done">
|
||||
<value model="stock.picking" eval="[
|
||||
obj().env.ref('stock.outgoing_shipment_main_warehouse1').id,
|
||||
obj().env.ref('stock.incomming_chicago_warehouse1').id,
|
||||
|
||||
@@ -637,13 +637,6 @@ class Picking(models.Model):
|
||||
self.write({'date_done': fields.Datetime.now()})
|
||||
return True
|
||||
|
||||
# Backward compatibility
|
||||
# Problem with fixed reference to a function:
|
||||
# it doesn't allow for overriding action_done() through do_transfer
|
||||
# get rid of me in master (and make me private ?)
|
||||
def do_transfer(self):
|
||||
return self.action_done()
|
||||
|
||||
def _check_move_lines_map_quant_package(self, package):
|
||||
""" This method checks that all product of the package (quant) are well present in the move_line_ids of the picking. """
|
||||
all_in = True
|
||||
|
||||
@@ -478,7 +478,7 @@ class StockMove(TransactionCase):
|
||||
'product_id': self.product2.id,
|
||||
})
|
||||
|
||||
move1.with_context(debug=True).move_line_ids[1].lot_id = lot3
|
||||
move1.move_line_ids[1].lot_id = lot3
|
||||
|
||||
self.assertEqual(self.env['stock.quant']._get_available_quantity(self.product2, self.stock_location), 1.0)
|
||||
self.assertEqual(self.env['stock.quant']._get_available_quantity(self.product2, self.stock_location, lot_id=lot1, strict=True), 0.0)
|
||||
@@ -1678,7 +1678,7 @@ class StockMove(TransactionCase):
|
||||
self.assertEqual(move_line.product_qty, 5)
|
||||
move_line.qty_done = 5.0
|
||||
self.assertEqual(move_line.product_qty, 5) # don't change reservation
|
||||
move_line.with_context(debug=True).lot_id = lot1
|
||||
move_line.lot_id = lot1
|
||||
self.assertEqual(move_line.product_qty, 5) # don't change reservation when assgning a lot now
|
||||
|
||||
move1._action_done()
|
||||
@@ -3083,7 +3083,7 @@ class StockMove(TransactionCase):
|
||||
move1._action_confirm()
|
||||
move1._action_assign()
|
||||
self.assertEqual(move1.state, 'assigned')
|
||||
move1.with_context(debug=True).product_uom_qty = 5
|
||||
move1.product_uom_qty = 5
|
||||
self.assertEqual(move1.state, 'assigned')
|
||||
self.assertEqual(move1.product_uom_qty, 5)
|
||||
self.assertEqual(len(move1.move_line_ids), 1)
|
||||
|
||||
@@ -115,13 +115,13 @@ class TestPickShip(TestStockCommon):
|
||||
self.env['stock.quant']._update_available_quantity(self.productA, location, 10.0)
|
||||
picking_pick.action_assign()
|
||||
picking_pick.move_lines[0].move_line_ids[0].qty_done = 10.0
|
||||
picking_pick.do_transfer()
|
||||
picking_pick.action_done()
|
||||
|
||||
self.assertEqual(picking_client.state, 'assigned', 'The state of the client should be assigned')
|
||||
|
||||
# Now partially transfer the ship
|
||||
picking_client.move_lines[0].move_line_ids[0].qty_done = 5
|
||||
picking_client.do_transfer() # no new in order to create backorder
|
||||
picking_client.action_done() # no new in order to create backorder
|
||||
|
||||
backorder = self.env['stock.picking'].search([('backorder_id', '=', picking_client.id)])
|
||||
self.assertEqual(backorder.state, 'assigned', 'Backorder should be started')
|
||||
@@ -151,7 +151,7 @@ class TestPickShip(TestStockCommon):
|
||||
self.assertEqual(self.env['stock.quant']._get_available_quantity(self.productA, pack_location), 5.0)
|
||||
|
||||
move_pick.move_line_ids[0].qty_done = 10.0
|
||||
picking_pick.do_transfer()
|
||||
picking_pick.action_done()
|
||||
|
||||
self.assertEqual(move_pick.state, 'done')
|
||||
self.assertEqual(picking_pick.state, 'done')
|
||||
@@ -169,7 +169,7 @@ class TestPickShip(TestStockCommon):
|
||||
|
||||
picking_pick.action_assign()
|
||||
picking_pick.move_lines[0].move_line_ids[0].qty_done = 10.0
|
||||
picking_pick.do_transfer()
|
||||
picking_pick.action_done()
|
||||
self.assertEqual(picking_pick.state, 'done')
|
||||
self.assertEqual(picking_client.state, 'assigned')
|
||||
|
||||
@@ -181,7 +181,7 @@ class TestPickShip(TestStockCommon):
|
||||
stock_return_picking_action = stock_return_picking.create_returns()
|
||||
return_pick = self.env['stock.picking'].browse(stock_return_picking_action['res_id'])
|
||||
return_pick.move_lines[0].move_line_ids[0].qty_done = 2.0
|
||||
return_pick.do_transfer()
|
||||
return_pick.action_done()
|
||||
# the client picking should not be assigned anymore, as we returned partially what we took
|
||||
self.assertEqual(picking_client.state, 'confirmed')
|
||||
|
||||
@@ -200,7 +200,7 @@ class TestPickShip(TestStockCommon):
|
||||
picking_pick.move_lines[0].move_line_ids[0].qty_done = 5.0
|
||||
|
||||
# create a backorder
|
||||
picking_pick.do_transfer()
|
||||
picking_pick.action_done()
|
||||
picking_pick_backorder = self.env['stock.picking'].search([('backorder_id', '=', picking_pick.id)])
|
||||
self.assertEqual(picking_pick_backorder.state, 'assigned')
|
||||
self.assertEqual(picking_pick_backorder.move_line_ids.product_qty, 5.0)
|
||||
@@ -750,7 +750,7 @@ class TestSinglePicking(TestStockCommon):
|
||||
|
||||
# valid with backorder creation
|
||||
delivery_order.move_lines[0].move_line_ids[0].qty_done = 1
|
||||
delivery_order.do_transfer()
|
||||
delivery_order.action_done()
|
||||
self.assertNotEqual(delivery_order.date_done, False)
|
||||
self.assertEqual(self.env['stock.quant']._get_available_quantity(self.productA, pack_location), 0.0)
|
||||
|
||||
@@ -788,7 +788,7 @@ class TestSinglePicking(TestStockCommon):
|
||||
|
||||
# valid with backorder creation
|
||||
delivery_order.move_lines[0].move_line_ids[0].qty_done = 1
|
||||
delivery_order.do_transfer()
|
||||
delivery_order.action_done()
|
||||
self.assertNotEqual(delivery_order.date_done, False)
|
||||
self.assertEqual(self.env['stock.quant']._get_available_quantity(self.productA, pack_location), 0.0)
|
||||
|
||||
@@ -835,7 +835,7 @@ class TestSinglePicking(TestStockCommon):
|
||||
self.assertEqual(delivery_order.state, 'assigned')
|
||||
|
||||
delivery_order.move_lines[0].move_line_ids[0].qty_done = 2
|
||||
delivery_order.do_transfer()
|
||||
delivery_order.action_done()
|
||||
|
||||
backorder = self.env['stock.picking'].search([('backorder_id', '=', delivery_order.id)])
|
||||
self.assertEqual(backorder.state, 'confirmed')
|
||||
@@ -875,7 +875,7 @@ class TestSinglePicking(TestStockCommon):
|
||||
# valid with backorder creation
|
||||
delivery_order.move_lines[0].move_line_ids[0].qty_done = 2
|
||||
self.assertEqual(self.env['stock.quant']._get_available_quantity(self.productA, pack_location), 0.0)
|
||||
delivery_order.with_context(debug=True).do_transfer()
|
||||
delivery_order.action_done()
|
||||
self.assertEqual(self.env['stock.quant']._get_available_quantity(self.productA, pack_location), 0.0)
|
||||
self.assertEqual(self.env['stock.quant']._get_available_quantity(self.productA, pack_location, allow_negative=True), -1.0)
|
||||
|
||||
@@ -921,7 +921,7 @@ class TestSinglePicking(TestStockCommon):
|
||||
# valid with backorder creation
|
||||
delivery_order.move_lines[0].move_line_ids[0].qty_done = 3
|
||||
self.assertEqual(self.env['stock.quant']._get_available_quantity(self.productA, pack_location), 0.0)
|
||||
delivery_order.do_transfer()
|
||||
delivery_order.action_done()
|
||||
self.assertEqual(self.env['stock.quant']._get_available_quantity(self.productA, pack_location), 0.0)
|
||||
self.assertEqual(self.env['stock.quant']._get_available_quantity(self.productA, pack_location, allow_negative=True), -2.0)
|
||||
|
||||
@@ -960,7 +960,7 @@ class TestSinglePicking(TestStockCommon):
|
||||
|
||||
# valid with backorder creation
|
||||
receipt.move_lines[0].move_line_ids[0].qty_done = 2
|
||||
receipt.with_context(debug=True).do_transfer()
|
||||
receipt.action_done()
|
||||
self.assertEqual(self.env['stock.quant']._get_available_quantity(self.productA, stock_location), 2.0)
|
||||
|
||||
self.assertEqual(move1.product_qty, 2.0)
|
||||
|
||||
@@ -77,7 +77,7 @@ class TestPackingNeg(TransactionCase):
|
||||
})
|
||||
|
||||
# Transfer the receipt
|
||||
pick_neg.do_transfer()
|
||||
pick_neg.action_done()
|
||||
|
||||
# Make a delivery order of 300 pieces to the customer
|
||||
default_get_vals = self.env['stock.picking'].default_get(list(self.env['stock.picking'].fields_get()))
|
||||
@@ -119,7 +119,7 @@ class TestPackingNeg(TransactionCase):
|
||||
rec.result_package_id = False
|
||||
|
||||
# Process this picking
|
||||
delivery_order_neg.do_transfer()
|
||||
delivery_order_neg.action_done()
|
||||
|
||||
# Check the quants that you have -20 pieces pallet 2 in stock, and a total quantity
|
||||
# of 50 in stock from pallet 3 (should be 20+30, as it has been split by reservation)
|
||||
@@ -161,7 +161,7 @@ class TestPackingNeg(TransactionCase):
|
||||
('name', '=', 'Lot neg')], limit=1)
|
||||
pack = self.env["stock.quant.package"].search([('name', '=', 'Palneg 2')], limit=1)
|
||||
delivery_reconcile.move_line_ids[0].write({'lot_id': lot.id, 'qty_done': 20.0, 'result_package_id': pack.id})
|
||||
delivery_reconcile.do_transfer()
|
||||
delivery_reconcile.action_done()
|
||||
|
||||
# Check the negative quant was reconciled
|
||||
neg_quants = self.env['stock.quant'].search([
|
||||
|
||||
@@ -20,7 +20,7 @@ class TestInventory(TestStockCommon):
|
||||
location_id=self.env.ref('stock.stock_location_suppliers').id, # TDE FIXME: locations
|
||||
location_dest_id=self.location_1.id)
|
||||
|
||||
incoming_move.picking_id.with_context(active_model='stock.picking', active_id=incoming_move.picking_id.id, active_ids=[incoming_move.picking_id.id]).do_transfer()
|
||||
incoming_move.picking_id.with_context(active_model='stock.picking', active_id=incoming_move.picking_id.id, active_ids=[incoming_move.picking_id.id]).action_done()
|
||||
|
||||
# check backorder shipment after receiving partial shipment and check remaining shipment
|
||||
for move_line in incoming_move.picking_id.move_lines:
|
||||
@@ -39,7 +39,7 @@ class TestInventory(TestStockCommon):
|
||||
location_id=self.env.ref('stock.stock_location_suppliers').id, # TDE FIXME: locations
|
||||
location_dest_id=self.location_1.id)
|
||||
|
||||
backorder.do_transfer()
|
||||
backorder.action_done()
|
||||
|
||||
# check the incoming shipment after receipt
|
||||
backorder = self.env['stock.picking'].search([('backorder_id', '=', incoming_move.picking_id.id)])
|
||||
|
||||
@@ -418,7 +418,7 @@ class TestStockFlow(TestStockCommon):
|
||||
# Back order of Outgoing shipment
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
back_order_out.do_transfer()
|
||||
back_order_out.action_done()
|
||||
|
||||
# Check stock location quants and available quantity for product A.
|
||||
quants = self.StockQuantObj.search([('product_id', '=', self.productA.id), ('location_id', '=', self.stock_location)])
|
||||
|
||||
@@ -198,7 +198,7 @@ class TestWarehouse(TestStockCommon):
|
||||
picking_out.action_confirm()
|
||||
picking_out.force_assign()
|
||||
picking_out.move_lines.quantity_done = 1
|
||||
picking_out.do_transfer()
|
||||
picking_out.action_done()
|
||||
|
||||
# Make an inventory adjustment to set the quantity to 0
|
||||
inventory = self.env['stock.inventory'].create({
|
||||
|
||||
@@ -58,7 +58,7 @@ class TestWiseOperator(TransactionCase):
|
||||
})
|
||||
|
||||
# Transfer the receipt
|
||||
pick1_wise.do_transfer()
|
||||
pick1_wise.action_done()
|
||||
|
||||
# Check the system created 3 quants
|
||||
records = self.env['stock.quant'].search([('product_id', '=', product_wise.id)])
|
||||
@@ -147,7 +147,7 @@ class TestWiseOperator(TransactionCase):
|
||||
self.assertEqual(new_move_lines.location_id.id, self.ref('stock.stock_location_14'))
|
||||
|
||||
# Process this picking
|
||||
delivery_order_wise1.do_transfer()
|
||||
delivery_order_wise1.action_done()
|
||||
|
||||
# Check there was no negative quant created by this picking
|
||||
|
||||
|
||||
@@ -1126,7 +1126,7 @@ class TestStockValuation(TransactionCase):
|
||||
stock_return_picking_action = stock_return_picking.create_returns()
|
||||
return_pick = self.env['stock.picking'].browse(stock_return_picking_action['res_id'])
|
||||
return_pick.move_lines[0].move_line_ids[0].qty_done = 1.0
|
||||
return_pick.do_transfer()
|
||||
return_pick.action_done()
|
||||
|
||||
self.assertEqual(self.product1.standard_price, 16)
|
||||
|
||||
@@ -1840,7 +1840,7 @@ class TestStockValuation(TransactionCase):
|
||||
# Add a new move line to receive 10 more
|
||||
# ---------------------------------------------------------------------
|
||||
self.assertEqual(len(move1.move_line_ids), 1)
|
||||
self.env['stock.move.line'].with_context(debug=True).create({
|
||||
self.env['stock.move.line'].create({
|
||||
'move_id': move1.id,
|
||||
'product_id': move1.product_id.id,
|
||||
'qty_done': 10,
|
||||
@@ -2109,7 +2109,7 @@ class TestStockValuation(TransactionCase):
|
||||
# ---------------------------------------------------------------------
|
||||
# Actually, send 10 in the last move
|
||||
# ---------------------------------------------------------------------
|
||||
move2.with_context(debug=True).quantity_done = 10
|
||||
move2.quantity_done = 10
|
||||
|
||||
self.assertEqual(move2.value, -100.0)
|
||||
self.assertEqual(move2.remaining_qty, 0.0)
|
||||
@@ -2760,7 +2760,7 @@ class TestStockValuation(TransactionCase):
|
||||
# ---------------------------------------------------------------------
|
||||
# Change the production valuation to AVCO
|
||||
# ---------------------------------------------------------------------
|
||||
self.product1.with_context(debug=True).product_tmpl_id.cost_method = 'standard'
|
||||
self.product1.product_tmpl_id.cost_method = 'standard'
|
||||
|
||||
# valuation should stay to ~240
|
||||
self.assertAlmostEqual(self.product1.stock_value, 240, delta=0.03)
|
||||
|
||||
Reference in New Issue
Block a user