[FIX] mrp, stock: picking type automatic colors
/!\ Should not be forward-ported in saas-18 Fix bug introduced by https://github.com/odoo/odoo/commit/e59c1b49c2d9729e5f7576e1c205701a340f9396: When creating picking types, a color is automatically assigned. This color is chosen to be the first available one, or by default 1 (since mentioned commit, as '1' would be the default gray used in kanban headers). Unfortunately, this was expressed as `color = first or 1`... which will always be 1 since the very first available color is always 0.
This commit is contained in:
@@ -58,7 +58,7 @@ class StockWarehouse(models.Model):
|
||||
wh_stock_loc = warehouse.lot_stock_id
|
||||
seq = seq_obj.search([('code', '=', 'mrp.production')], limit=1)
|
||||
other_pick_type = picking_type_obj.search([('warehouse_id', '=', warehouse.id)], order = 'sequence desc', limit=1)
|
||||
color = other_pick_type and other_pick_type.color or 1
|
||||
color = other_pick_type.color if other_pick_type else 1
|
||||
max_sequence = other_pick_type and other_pick_type.sequence or 0
|
||||
manu_type = picking_type_obj.create({
|
||||
'name': _('Manufacturing'),
|
||||
|
||||
@@ -188,8 +188,8 @@ class Warehouse(models.Model):
|
||||
|
||||
# choose the next available color for the operation types of this warehouse
|
||||
all_used_colors = [res['color'] for res in PickingType.search_read([('warehouse_id', '!=', False), ('color', '!=', False)], ['color'], order='color')]
|
||||
available_colors = [zef for zef in [0, 3, 4, 5, 6, 7, 8, 1, 2] if zef not in all_used_colors]
|
||||
color = available_colors and available_colors[0] or 1
|
||||
available_colors = [zef for zef in [1, 3, 4, 5, 6, 7, 8, 0, 2] if zef not in all_used_colors]
|
||||
color = available_colors[0] if available_colors else 1
|
||||
|
||||
# suit for each warehouse: reception, internal, pick, pack, ship
|
||||
max_sequence = PickingType.search_read([('sequence', '!=', False)], ['sequence'], limit=1, order='sequence desc')
|
||||
|
||||
Reference in New Issue
Block a user