Tryton - Issues

 

Issue7456

Title Sao doesn't update after on_change to one2many fields
Priority bug Status resolved
Superseder Nosy List ced, iehoshia, reviewbot, roundup-bot
Type behavior Components sao
Assigned To ced Keywords review
Reviews 66261002
View: 66261002

Created on 2018-05-23.00:14:16 by iehoshia, last changed by roundup-bot.

Messages
New changeset 626fd11f85d2 by Cédric Krier in branch '4.8':
Wait promises when setting on_change values
https://hg.tryton.org/sao/rev/626fd11f85d2

New changeset 37d4948bba0d by Cédric Krier in branch '4.6':
Wait promises when setting on_change values
https://hg.tryton.org/sao/rev/37d4948bba0d

New changeset 79be70a03e19 by Cédric Krier in branch '4.4':
Wait promises when setting on_change values
https://hg.tryton.org/sao/rev/79be70a03e19

New changeset bae7576281b1 by Cédric Krier in branch '4.2':
Wait promises when setting on_change values
https://hg.tryton.org/sao/rev/bae7576281b1

New changeset 5a96bc99524c by Cédric Krier in branch '4.0':
Wait promises when setting on_change values
https://hg.tryton.org/sao/rev/5a96bc99524c
New changeset 1929094b45f9 by Cédric Krier in branch 'default':
Wait promises when setting on_change values
https://hg.tryton.org/sao/rev/1929094b45f9
msg41790 (view) Author: [hidden] (iehoshia) Date: 2018-06-26.19:37:15
Yes, I tried it again today and it works as expected. Thanks for the help.
msg41646 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-06-25.18:53:27
I could reproduce your issue by artificially making fields_get call slower and I get the same behavior.
Now with review66261002, on this scenario it works as expected.
So are you really sure that you have correctly applied the patch and that you are running the right javascript?
msg41641 (view) Author: [hidden] (iehoshia) Date: 2018-06-25.18:11:14
I tested it but doesn't work with sao 4.8 with trytond 4.8, didn't test on 4.6.
review66261002 updated at https://codereview.tryton.org/66261002/#ps1
msg41635 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-06-25.12:38:49
Here is review66261002 which should fix it but as I could not reproduce locally, please test it.
msg41634 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-06-25.12:13:07
Indeed the value of the One2Many is correctly set, it is just that the screen is not refreshed. I suspect it is because the screen is re-displayed before the set_on_change of One2Many is finished (asynchronous RPC call). So I guess we will need to wait some promises when setting on_change values.
msg41631 (view) Author: [hidden] (iehoshia) Date: 2018-06-25.02:50:36
I have traced the javascript console but nothing about this fail. 

I recorded 2 videos about this, first on sao 4.8 with trytond 4.8 [1] and after with tryton 4.8 and trytond 4.8 [2].

I have a relation one2many (Payment Lines) and another many2many (Payment Moves). The many2many works fine on sao and tryton, but one2many doesn't work. 

I don't know how to trace this error on the javascript console. 

[1] https://drive.google.com/file/d/1VUyeviGb0EB6y1JHCeS9SjBC65vyHYbz/view?usp=sharing

[2] https://drive.google.com/file/d/1OpLL6qwkCCaPT2UMyUBLyS-PtZcvZy9N/view?usp=sharing
msg41600 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-06-22.18:38:13
Do you have a traceback in the javascript console?
msg41599 (view) Author: [hidden] (iehoshia) Date: 2018-06-22.17:49:16
This doesn't work on trytond 4.6 with sao 4.6, but work with trytond 4.6 and tryton 4.6. 

On trytond 4.8 and sao 4.8 doesn't work, but work with trytond 4.8 and tryton 4.8.

I think is one javascript error on the on_change method.
msg41598 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-06-22.17:44:47
Again, I'm confused because you say it works with tryton 4.8 and not.
msg41597 (view) Author: [hidden] (iehoshia) Date: 2018-06-22.17:25:45
This doesn't work on trytond 4.6 and sao 4.6 niether tryton 4.8 with sao 4.8. 

It works fine with tryton 4.6 and tryton 4.8.
msg41569 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-06-21.11:21:12
I'm confused, you say that it works with sao 4.4 so when does it not work?
msg40949 (view) Author: [hidden] (iehoshia) Date: 2018-05-23.00:14:15
I was trying to use on_change method on one2many fields on sao, but it doesn't be updated. 

I tried to update one2many on tryton and it works fine, it works on trytond 4.4 and sao 4.4 too. 

lines = fields.One2Many('report.line',
        'report','Lines',
        )

def on_change_district(self):
    pool = Pool() 
    Group = pool.get('disc.group')

    if self.district:
        district_id = self.district.id 
        groups = Group.search([('district', '=', district_id)])
        lines  = []
        if groups: 
            for group in groups:
                Line = pool.get('report.line')
                line = Line() 
                line.group = group.id 
                line.quantity = 0 
                lines.append(line)
            self.lines = lines 
    else:
        self.lineas = []
History
Date User Action Args
2018-07-18 20:17:39roundup-botsetmessages: + msg42195
2018-07-02 23:21:22roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg42025
2018-06-26 19:37:15iehoshiasetmessages: + msg41790
2018-06-25 18:53:28cedsetmessages: + msg41646
2018-06-25 18:11:14iehoshiasetmessages: + msg41641
2018-06-25 12:56:56reviewbotsetnosy: + reviewbot
messages: + msg41637
2018-06-25 12:38:49cedsetstatus: chatting -> testing
reviews: 66261002
messages: + msg41635
keyword: + review
assignedto: ced
2018-06-25 12:13:07cedsetstatus: need-eg -> chatting
messages: + msg41634
2018-06-25 02:50:37iehoshiasetmessages: + msg41631
2018-06-22 18:38:13cedsetmessages: + msg41600

Showing 10 items. Show all history (warning: this could be VERY long)