[IMP] base: Order user's type groups by id

Purpose
=======

Traceback when following these steps:
- Install MRP
- Load French translations
- Set language to French
- Activate 'work orders' on MRP configuration

Error: The field 'sel_groups_9_10_1' doesn't exist.

This is because the only selection groups field on the res_users view
that doesn't have a transitive closure (the user's type Internal/Portal/Public)
is ordered by name.

1: Internal User
9: Portal
10: Public

becomes

9: Portail
10: Public
1: Utilisateur Interne

which lead to the traceback.

We should retrieve these groups ordered by 'id' to avoid the issue.
This commit is contained in:
Yannick Tivisse
2018-09-20 16:19:24 +02:00
parent 8a1030e162
commit b3fef6a72a
+1 -1
View File
@@ -920,7 +920,7 @@ class GroupsView(models.Model):
def linearize(app, gs):
# 'User Type' is an exception
if app.xml_id == 'base.module_category_user_type':
return (app, 'selection', gs)
return (app, 'selection', gs.sorted('id'))
# determine sequence order: a group appears after its implied groups
order = {g: len(g.trans_implied_ids & gs) for g in gs}
# check whether order is total, i.e., sequence orders are distinct