[FIX] stock: propagate package in multistep delivery
Steps to reproduce: - Enable 3 step delivery (pick,pack,ship) in inventory settings - Create and confirm an SO with a consumable product - Put the first transfer (PICK) in pack (check show detailed operation will make it easier to see the bug) - Result package is correctly set and will be correctly set as source package for the following transfer (PACK) Bug: result package is not set on the following transfers Fix: propagate the package by default (if it's disposable) since consumable product do not have a stock.quant _check_move_lines_map_quant_package will fail and package_level will not be created and result will not be assigned opw-3513870 closes odoo/odoo#141914 X-original-commit: 83996db3adaf44f5d4428d602071224095cd4790 Signed-off-by: William Henrotin (whe) <whe@odoo.com> Signed-off-by: Walid Hanniche (waha) <waha@odoo.com>
This commit is contained in:
@@ -990,7 +990,7 @@ class Picking(models.Model):
|
||||
)
|
||||
|
||||
def _check_move_lines_map_quant_package(self, package):
|
||||
return package._check_move_lines_map_quant(self.move_line_ids.filtered(lambda ml: ml.package_id == package))
|
||||
return package._check_move_lines_map_quant(self.move_line_ids.filtered(lambda ml: ml.package_id == package and ml.product_id.type == 'product'))
|
||||
|
||||
def _get_entire_pack_location_dest(self, move_line_ids):
|
||||
location_dest_ids = move_line_ids.mapped('location_dest_id')
|
||||
|
||||
@@ -418,6 +418,39 @@ class TestPacking(TestPackingCommon):
|
||||
with self.assertRaises(UserError):
|
||||
picking._action_done()
|
||||
|
||||
def test_pack_delivery_three_step_propagate_package_consumable(self):
|
||||
""" Checks all works right in the following case:
|
||||
* For a three-step delivery
|
||||
* Put products in a package then validate the receipt.
|
||||
* The automatically generated internal transfer should have package set by default.
|
||||
"""
|
||||
prod = self.env['product.product'].create({'name': 'bad dragon', 'type': 'consu'})
|
||||
ship_move = self.env['stock.move'].create({
|
||||
'name': 'The ship move',
|
||||
'product_id': prod.id,
|
||||
'product_uom_qty': 5.0,
|
||||
'product_uom': prod.uom_id.id,
|
||||
'location_id': self.warehouse.wh_output_stock_loc_id.id,
|
||||
'location_dest_id': self.env.ref('stock.stock_location_customers').id,
|
||||
'warehouse_id': self.warehouse.id,
|
||||
'picking_type_id': self.warehouse.out_type_id.id,
|
||||
'procure_method': 'make_to_order',
|
||||
'state': 'draft',
|
||||
})
|
||||
|
||||
# create chained pick/pack moves to test with
|
||||
ship_move._assign_picking()
|
||||
ship_move._action_confirm()
|
||||
pack_move = ship_move.move_orig_ids[0]
|
||||
pick_move = pack_move.move_orig_ids[0]
|
||||
|
||||
picking = pick_move.picking_id
|
||||
picking.action_confirm()
|
||||
picking.action_put_in_pack()
|
||||
self.assertTrue(picking.move_line_ids.result_package_id)
|
||||
picking.button_validate()
|
||||
self.assertEqual(pack_move.move_line_ids.result_package_id, picking.move_line_ids.result_package_id)
|
||||
|
||||
def test_pack_in_receipt_two_step_single_putway(self):
|
||||
""" Checks all works right in the following specific corner case:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user