[FIX] stock: do not write on picking type

When creating a stock.picking, the related fields picking_type_entire_packs and
picking_type_code were both updated.
This was an issue was required write access on stock.picking.type (warehouse
manager) to create a stock.picking (warehouse user).

The fields were updated as they were present in the view and filled with the
related value. Even if the value was unchanged, it was triggering a write
anyway.

The two fields were in invisible="1" and used only in attrs for other fields.

Making these two fields in readonly does not prevent to use it in the attrs but
avoid to send a value to the server and trigger a useless write.

Fixes #15769
This commit is contained in:
Martin Trigaux
2017-03-14 15:58:42 +01:00
parent 93bb6f322d
commit 8adc2ef440
+4 -2
View File
@@ -245,8 +245,10 @@ class Picking(models.Model):
picking_type_code = fields.Selection([
('incoming', 'Vendors'),
('outgoing', 'Customers'),
('internal', 'Internal')], related='picking_type_id.code')
picking_type_entire_packs = fields.Boolean(related='picking_type_id.show_entire_packs')
('internal', 'Internal')], related='picking_type_id.code',
readonly=True)
picking_type_entire_packs = fields.Boolean(related='picking_type_id.show_entire_packs',
readonly=True)
quant_reserved_exist = fields.Boolean(
'Has quants already reserved', compute='_compute_quant_reserved_exist',