[FIX] sale_stock: make Warehouse field readonly in locked state

State `done` means *Locked*, which means that most of the fields should not be
editable.

However, the behavior for the field `warehouse_id` was changed during refactoring in
https://github.com/odoo/odoo/commit/f9f68adb2cdfdfd16bc24c82acae015ddfb9b83a

This commit restores Odoo 15 behavior in Odoo 16+

opw-3204896

closes odoo/odoo#114973

X-original-commit: 9efc8190565db160615f8a3e92f2e7f89edfca8b
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
Ivan Yelizariev
2023-03-10 17:55:05 +01:00
parent abbdaf0562
commit ffbc3be76f
+1 -1
View File
@@ -27,7 +27,7 @@ class SaleOrder(models.Model):
warehouse_id = fields.Many2one(
'stock.warehouse', string='Warehouse', required=True,
compute='_compute_warehouse_id', store=True, readonly=False, precompute=True,
states={'sale': [('readonly', True)], 'done': [('readonly', False)], 'cancel': [('readonly', False)]},
states={'sale': [('readonly', True)], 'done': [('readonly', True)], 'cancel': [('readonly', False)]},
check_company=True)
picking_ids = fields.One2many('stock.picking', 'sale_id', string='Transfers')
delivery_count = fields.Integer(string='Delivery Orders', compute='_compute_picking_ids')