[FIX] stock: update picking type sequences
Suppose a picking type in company C1 that uses a sequence in company C2. If a user then tries to install mrp/pos, it will lead to a Server Error because at some point, we write on the picking type: https://github.com/odoo/odoo/blob/c02df957d9f04c911f330aaaadd80fe97a601509/addons/stock/models/stock_warehouse.py#L332 It will trigger the company checking and lead to the error https://github.com/odoo/odoo/blob/a32c98beb5d57c3af481558c6db08767e9258959/odoo/models.py#L3548 When updating the picking types, we should also update the sequences to ensure the data consistency. OPW-3501199 closes odoo/odoo#138710 X-original-commit: 2ad97c6aeda86e4fed7573fb395b25adae935610 Signed-off-by: William Henrotin (whe) <whe@odoo.com> Signed-off-by: Adrien Widart (awt) <awt@odoo.com>
This commit is contained in:
@@ -349,6 +349,7 @@ class Warehouse(models.Model):
|
||||
|
||||
for picking_type, values in data.items():
|
||||
if self[picking_type]:
|
||||
self[picking_type].sudo().sequence_id.write(sequence_data[picking_type])
|
||||
self[picking_type].write(values)
|
||||
else:
|
||||
data[picking_type].update(create_data[picking_type])
|
||||
|
||||
Reference in New Issue
Block a user