From 8adc2ef440aec35a3829ebf26b3759dbc0b39903 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 13 Mar 2017 09:38:42 +0100 Subject: [PATCH] [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 --- addons/stock/models/stock_picking.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index 83a83c3e10b..dbf11a61dd9 100644 --- a/addons/stock/models/stock_picking.py +++ b/addons/stock/models/stock_picking.py @@ -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',