[FIX] stock: empty reusable package

When using reusable package in chained transfers, indicates the package
should not be propagated for the next moves `result_package_id`.
This change has no effect by itself, but it's used in enterprise by
https://github.com/odoo/enterprise/pull/13146/commits/611b2c0b188ab9906eb21feab087a1794bd2d015 when Picking Batch is enabled
and barcode app is installed.

task-2333834

X-original-commit: 6677f501d5a1717af8da08a7e235d87aeb85f862
This commit is contained in:
svs-odoo
2020-11-05 09:19:03 +00:00
parent c97e605457
commit d44b95fd45
2 changed files with 8 additions and 3 deletions
+5 -3
View File
@@ -848,9 +848,11 @@ class Picking(models.Model):
'move_line_ids': [(6, 0, move_lines_to_pack.ids)],
'company_id': picking.company_id.id,
})
move_lines_to_pack.write({
'result_package_id': pack.id,
})
# TODO: in master, move package field in `stock` and clean code.
if pack._allowed_to_move_between_transfers():
move_lines_to_pack.write({
'result_package_id': pack.id,
})
else:
move_lines_in_package_level = move_lines_to_pack.filtered(lambda ml: ml.move_id.package_level_id)
move_lines_without_package_level = move_lines_to_pack - move_lines_in_package_level
+3
View File
@@ -729,3 +729,6 @@ class QuantPackage(models.Model):
def _get_contained_quants(self):
return self.env['stock.quant'].search([('package_id', 'in', self.ids)])
def _allowed_to_move_between_transfers(self):
return True