[FIX] stock: prevent updating picking locations with move lines

Since #91640, the locations on stock picking are editable except in `done` state. This can leads to misunderstanding if some stock move lines
are already created. The locations on stock picking act as default
values for stock move/ stock move lines. Validating a picking will
always use the location set on stock move lines even if those ones
differ from the picking. This commit adds a simple error message in
to address this situation.

Close #113486
opw-3148993

closes odoo/odoo#114868

X-original-commit: 3eeab703f4e36723eae6005cf4b966f20f1e62dd
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
William Henrotin
2023-03-10 10:18:20 +01:00
parent b896b35dd2
commit 0c301855ea
2 changed files with 13 additions and 0 deletions
+7
View File
@@ -9318,6 +9318,13 @@ msgstr ""
msgid "You may only return one picking at a time."
msgstr ""
#. module: stock
#. odoo-python
#: code:addons/stock/model/stock_picking.py:0
#, python-format
msgid " You might want to update the locations of this transfer's operations "
msgstr ""
#. module: stock
#. odoo-python
#: code:addons/stock/models/stock_picking.py:0
+6
View File
@@ -757,6 +757,12 @@ class Picking(models.Model):
"location_id": self.location_id,
"location_dest_id": self.location_dest_id
})
if any(line.reserved_qty or line.qty_done for line in self.move_ids.move_line_ids):
return {'warning': {
'title': 'Locations to update',
'message': _("You might want to update the locations of this transfer's operations")
}
}
@api.model_create_multi
def create(self, vals_list):