view_ids is not always used for Many2Many fields
For Many2Many fields, the client seems to ignore the view_ids attribute for
form views.
The attached module [test_module.tar.gz] allows to reproduce the behaviour.
The TestA model has a One2Many and a Many2Many with the same model [base.png]
In the form view, the One2Many field ("foo") uses a tree view which displays
two fields, and a form view which only displays one.
The Many2Many field ("foo_bis") uses a tree view with only one field, and the
same form view than that of the One2Many, with two fields.
When I double-click an item in the O2M, the view with only one field is showed.
[o2m.png]
When I double-click an item in the M2M, I got the other view (the one which
is never referenced anywhere, juste declared somewhere), with both fields.
[m2m.png]
From what I debugged, it looks like when opening the form view, a new Screen is
created, which has not yet loaded the list view. So when we try to load the form
view, the view which is actually loaded is the first one in the list [1], which
usually is the tree view.
So finally, the client calls fields_view_get without a view_id since the one it
poped is not a form but a list [2], which get us the default view, that is the
first declared view.
[1] : http://hg.tryton.org/tryton/file/a932e70c5c4f/tryton/gui/window/view_form/screen/screen.py#l411
[2] : http://hg.tryton.org/tryton/file/a932e70c5c4f/tryton/gui/window/view_form/screen/screen.py#l424
Files
Download | Creator | Timestamp | Type |
---|---|---|---|
test_module.tar.gz | @jcavallo | 2016-03-09 10:28:37.433000 UTC | application/gzip |
base.png | @jcavallo | 2016-03-09 10:28:53.147000 UTC | image/png |
o2m.png | @jcavallo | 2016-03-09 10:29:04.183000 UTC | image/png |
m2m.png | @jcavallo | 2016-03-09 10:29:12.934000 UTC | image/png |