Issue 9298

Title
strange behavior on o2m fields with many2many widget
Priority
bug
Status
resolved
Nosy list
ced, mrichez, oqueralto, pokoli, reviewbot, roundup-bot
Assigned to
ced
Keywords
review

Created on 2020-05-05.14:46:17 by oqueralto, last changed 2 months ago by roundup-bot.

Messages

New changeset 093ffe5b68d7 by Cédric Krier in branch '5.6':
Keep record added/modified after cancel from popup window
https://hg.tryton.org/tryton/rev/093ffe5b68d7

New changeset 259af7dae8ce by Cédric Krier in branch '5.6':
Do not rely on current record from screen
https://hg.tryton.org/tryton/rev/259af7dae8ce

New changeset 1199157062ba by Cédric Krier in branch '5.4':
Keep record added/modified after cancel from popup window
https://hg.tryton.org/tryton/rev/1199157062ba

New changeset 1a15769d9448 by Cédric Krier in branch '5.4':
Do not rely on current record from screen
https://hg.tryton.org/tryton/rev/1a15769d9448

New changeset 843f49dfc8cc by Cédric Krier in branch '5.0':
Keep record added/modified after cancel from popup window
https://hg.tryton.org/tryton/rev/843f49dfc8cc

New changeset fb6a580b6735 by Cédric Krier in branch '5.0':
Do not rely on current record from screen
https://hg.tryton.org/tryton/rev/fb6a580b6735
New changeset 6c153ebf5927 by Cédric Krier in branch '5.6':
Keep record added/modified after cancel from popup window
https://hg.tryton.org/sao/rev/6c153ebf5927

New changeset 20d974bc4aaf by Cédric Krier in branch '5.6':
Do not rely on current record from screen
https://hg.tryton.org/sao/rev/20d974bc4aaf

New changeset c7239649bb22 by Cédric Krier in branch '5.4':
Keep record added/modified after cancel from popup window
https://hg.tryton.org/sao/rev/c7239649bb22

New changeset 145f1a7253ca by Cédric Krier in branch '5.4':
Do not rely on current record from screen
https://hg.tryton.org/sao/rev/145f1a7253ca

New changeset 0ff66dc4987c by Cédric Krier in branch '5.0':
Keep record added/modified after cancel from popup window
https://hg.tryton.org/sao/rev/0ff66dc4987c

New changeset 5c2d10012907 by Cédric Krier in branch '5.0':
Do not rely on current record from screen
https://hg.tryton.org/sao/rev/5c2d10012907
New changeset 68946de0a8c9 by Cédric Krier in branch 'default':
Do not rely on current record from screen
https://hg.tryton.org/tryton-env/rev/68946de0a8c9
New changeset 0110eb3f3ddd by Cédric Krier in branch 'default':
Do not rely on current record from screen
https://hg.tryton.org/tryton/rev/0110eb3f3ddd
New changeset c1ce7d0bb57f by Cédric Krier in branch 'default':
Do not rely on current record from screen
https://hg.tryton.org/sao/rev/c1ce7d0bb57f
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2020-10-25.11:42:23

I re-open it because when canceling a window with a new record, we got the error:

AttributeError: 'NoneType' object has no attribute 'modified_fields'
New changeset 37c3df0a3007 by Cédric Krier in branch 'default':
Keep record added/modified after cancel from popup window
https://hg.tryton.org/tryton-env/rev/37c3df0a3007
New changeset f813fb56a83d by Cédric Krier in branch 'default':
Keep record added/modified after cancel from popup window
https://hg.tryton.org/tryton/rev/f813fb56a83d
New changeset e474e7cddb63 by Cédric Krier in branch 'default':
Keep record added/modified after cancel from popup window
https://hg.tryton.org/sao/rev/e474e7cddb63
Author: [hidden] (mrichez)
Date: 2020-10-21.14:31:41

So it's ok for me.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2020-10-21.14:28:55

This is the expected behavior because you edit a saved record so canceling makes it be reloaded from the database.
This is needed to correctly detect the user modification only (otherwise we will resent to the server all the fields because they were restored). The button names could be improved see issue9710.

Author: [hidden] (mrichez)
Date: 2020-10-21.14:08:30

There's still something strange. I did my tests using stock_lot. So i add an incoming move (without lot number).
Then i double-click on this line to set a lot number, then OK. there is now a lot number displayed in the treeview.
Then i double-click again on this line and Cancel -> lot number which was displayed on the form view disappear in the tree view.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2020-10-17.00:38:23
Here is review296601002 which keep the record being added on save.
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2020-05-05.16:28:11
I think it is linked to issue3325.
Author: [hidden] (oqueralto)
Date: 2020-05-05.16:20:09
It's happening on both.
Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2020-05-05.16:05:02
Are you using tryton, sao or both?
Author: [hidden] (oqueralto)
Date: 2020-05-05.14:46:16
It happens on any o2m field with the many2one widget, but I will explain how to reproduce it on a concrete one:

1. Create a new Supplier shipment. 
2. Add an existing incoming move to the shipment.
3. Open the move form. 
4. Press cancel button or 'Esc' key.
5. Save the shipment or receive it.

If you follow the steps, the move disappears, but for me the expected behavior is to keep it.

I'm using 5.2 version but it's also happening in 5.6.
History
Date User Action Args
2020-10-30 19:59:44roundup-botsetmessages: + msg61571
2020-10-30 19:59:00roundup-botsetkeyword: - backport
messages: + msg61564
2020-10-28 00:03:18roundup-botsetmessages: + msg61463
2020-10-28 00:03:13roundup-botsetmessages: + msg61462
2020-10-28 00:03:11roundup-botsetmessages: + msg61461
status: testing -> resolved
2020-10-25 11:48:18reviewbotsetmessages: + msg61397
2020-10-25 11:44:35cedsetreviews: 296601002 -> 296601002,314651002
status: in-progress -> testing
2020-10-25 11:42:23cedsetmessages: + msg61395
status: resolved -> in-progress
2020-10-24 13:15:19roundup-botsetmessages: + msg61201
2020-10-24 13:15:16roundup-botsetmessages: + msg61200
2020-10-24 13:15:14roundup-botsetmessages: + msg61199
nosy: + roundup-bot
status: testing -> resolved
2020-10-21 14:31:41mrichezsetmessages: + msg61098
2020-10-21 14:28:55cedsetmessages: + msg61097
2020-10-21 14:08:30mrichezsetmessages: + msg61096
nosy: + mrichez
2020-10-17 02:05:41cedlinkissue9600 superseder
2020-10-17 00:40:03reviewbotsetnosy: + reviewbot
messages: + msg61019
2020-10-17 00:38:23cedsetstatus: chatting -> testing
reviews: 296601002
messages: + msg61018
keyword: + backport, review
assignedto: ced
2020-05-05 16:28:12cedsetnosy: + ced
messages: + msg57841
2020-05-05 16:25:27pokolisetcomponent: + tryton, sao
2020-05-05 16:20:09oqueraltosetmessages: + msg57840
2020-05-05 16:05:03pokolisetstatus: unread -> chatting
nosy: + pokoli
messages: + msg57839
2020-05-05 14:46:17oqueraltocreate