Issue 11536

Title
Recursive UserWarning when create
Priority
bug
Status
closed
Superseder
Support warning keys of newly created record (issue 10591)
Nosy list
ced, resteve
Assigned to
Keywords

Created on 2022-06-01.15:36:08 by resteve, last changed 3 months ago by ced.

Messages

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-06-01.15:41:29

Duplicate issue10591

Author: [hidden] (resteve)
Date: 2022-06-01.15:36:08

The code is a simpe "super()" and UserWarning:

    @classmethod
    def create(cls, vlist):
        Warning = Pool().get('res.user.warning')

        parties = super(Party, cls).create(vlist)
        print('create')
        print(parties)
        for party in parties:
            key = 'task_party_without_travel.%s' % party.id
            if Warning.check(key):
                raise UserWarning(key, gettext(
                        'nantic.party_without_travel', party=party.rec_name))
        return parties

When create a party, is a recursive loop of UserWarning that party id is diferent.

Logs:

24395 140059064698624 [2022-06-01 13:32:08,960] INFO trytond.wsgi <JSONRequest 44@127.0.0.1 '<http://localhost:38020/nan60nan/>' [POST] model.party.party.create>
create
[Pool().get('party.party')(10690)]
24395 140059064698624 [2022-06-01 13:32:09,201] INFO werkzeug 127.0.0.1 - - [01/Jun/2022 13:32:09] "POST /nan60nan/ HTTP/1.1" 200 -
24395 140059064698624 [2022-06-01 13:32:10,053] INFO trytond.wsgi <JSONRequest 44@127.0.0.1 '<http://localhost:38020/nan60nan/>' [POST] model.res.user.warning.create>
24395 140059064698624 [2022-06-01 13:32:10,093] INFO werkzeug 127.0.0.1 - - [01/Jun/2022 13:32:10] "POST /nan60nan/ HTTP/1.1" 200 -
24395 140059064698624 [2022-06-01 13:32:10,118] INFO trytond.wsgi <JSONRequest 44@127.0.0.1 '<http://localhost:38020/nan60nan/>' [POST] model.party.party.create>
create
[Pool().get('party.party')(10691)]
24395 140059064698624 [2022-06-01 13:32:10,418] INFO werkzeug 127.0.0.1 - - [01/Jun/2022 13:32:10] "POST /nan60nan/ HTTP/1.1" 200 -
24395 140059064698624 [2022-06-01 13:32:12,505] INFO trytond.wsgi <JSONRequest 44@127.0.0.1 '<http://localhost:38020/nan60nan/>' [POST] model.res.user.warning.create>
24395 140059064698624 [2022-06-01 13:32:12,563] INFO werkzeug 127.0.0.1 - - [01/Jun/2022 13:32:12] "POST /nan60nan/ HTTP/1.1" 200 -
24395 140059064698624 [2022-06-01 13:32:12,585] INFO trytond.wsgi <JSONRequest 44@127.0.0.1 '<http://localhost:38020/nan60nan/>' [POST] model.party.party.create>
create
[Pool().get('party.party')(10692)]
....

Detected v6.0

History
Date User Action Args
2022-06-01 15:41:29cedsetmessages: + msg76888
nosy: + ced
status: chatting -> closed
superseder: + Support warning keys of newly created record
2022-06-01 15:36:08restevecreate

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