mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[11.0][IMP] stock_move_location:
* fix tests as per latest changes * extend test as per latest changes * add little help in technical fields
This commit is contained in:
@@ -3,3 +3,4 @@
|
||||
* Sergio Teruel <sergio.teruel@tecnativa.com>
|
||||
* Joan Sisquella <joan.sisquella@eficent.com>
|
||||
* Jordi Ballester Alomar <jordi.ballester@eficent.com>
|
||||
* Lois Rilo <lois.rilo@eficent.com>
|
||||
|
||||
@@ -16,6 +16,12 @@ class TestsCommon(common.SavepointCase):
|
||||
cls.wizard_obj = cls.env["wiz.stock.move.location"]
|
||||
cls.quant_obj = cls.env["stock.quant"]
|
||||
|
||||
# Enable multi-locations:
|
||||
wizard = cls.env['res.config.settings'].create({
|
||||
'group_stock_multi_locations': True,
|
||||
})
|
||||
wizard.execute()
|
||||
|
||||
cls.internal_loc_1 = cls.location_obj.create({
|
||||
"name": "INT_1",
|
||||
"usage": "internal",
|
||||
|
||||
@@ -100,7 +100,9 @@ class TestMoveLocation(TestsCommon):
|
||||
"""Test planned transfer."""
|
||||
wizard = self._create_wizard(self.internal_loc_1, self.internal_loc_2)
|
||||
wizard.onchange_origin_location()
|
||||
wizard.with_context({'planned': True}).action_move_location()
|
||||
wizard.add_lines()
|
||||
wizard = wizard.with_context({'planned': True})
|
||||
wizard.action_move_location()
|
||||
picking = wizard.picking_id
|
||||
self.assertEqual(picking.state, 'assigned')
|
||||
self.assertEqual(len(picking.move_line_ids), 4)
|
||||
@@ -129,3 +131,20 @@ class TestMoveLocation(TestsCommon):
|
||||
wizard.origin_location_id = self.internal_loc_2
|
||||
wizard._onchange_destination_location_id()
|
||||
self.assertEqual(len(lines), 3)
|
||||
|
||||
def test_readonly_location_computation(self):
|
||||
"""Test that origin_location_disable and destination_location_disable
|
||||
are computed correctly."""
|
||||
wizard = self._create_wizard(self.internal_loc_1, self.internal_loc_2)
|
||||
# locations are editable.
|
||||
self.assertFalse(wizard.origin_location_disable)
|
||||
self.assertFalse(wizard.destination_location_disable)
|
||||
# Disable edit mode:
|
||||
wizard.edit_locations = False
|
||||
self.assertTrue(wizard.origin_location_disable)
|
||||
self.assertTrue(wizard.destination_location_disable)
|
||||
|
||||
def test_picking_type_action_dummy(self):
|
||||
"""Test that no error is raised from actions."""
|
||||
pick_type = self.env.ref("stock.picking_type_internal")
|
||||
pick_type.action_move_location()
|
||||
|
||||
@@ -20,7 +20,9 @@ class StockMoveLocationWizard(models.TransientModel):
|
||||
('warehouse_id.company_id', '=', company_id)], limit=1).id
|
||||
|
||||
origin_location_disable = fields.Boolean(
|
||||
compute='_compute_readonly_locations')
|
||||
compute="_compute_readonly_locations",
|
||||
help="technical field to disable the edition of origin location."
|
||||
)
|
||||
origin_location_id = fields.Many2one(
|
||||
string='Origin Location',
|
||||
comodel_name='stock.location',
|
||||
@@ -28,7 +30,9 @@ class StockMoveLocationWizard(models.TransientModel):
|
||||
domain=lambda self: self._get_locations_domain(),
|
||||
)
|
||||
destination_location_disable = fields.Boolean(
|
||||
compute='_compute_readonly_locations')
|
||||
compute="_compute_readonly_locations",
|
||||
help="technical field to disable the edition of destination location."
|
||||
)
|
||||
destination_location_id = fields.Many2one(
|
||||
string='Destination Location',
|
||||
comodel_name='stock.location',
|
||||
|
||||
Reference in New Issue
Block a user