Tryton - Issues

 

Issue7072

Title Rationalize context usage in client
Priority feature Status resolved
Superseder Nosy List ced, pokoli, reviewbot, roundup-bot
Type feature request Components sao, tryton
Assigned To ced Keywords review
Reviews 40981002,43041002,44741002
View: 40981002, 43041002, 44741002

Created on 2018-01-20.20:10:37 by ced, last changed by roundup-bot.

Messages
New changeset 21a4c2280183 by Cédric Krier in branch 'default':
Use group context to retrieve the TimeDelta converter
http://hg.tryton.org/tryton/rev/21a4c2280183
review44741002 updated at https://codereview.tryton.org/44741002/#ps1
msg38965 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-03-13.13:59:11
It should be fixed with review44741002
msg38964 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2018-03-13.12:51:31
I reopen it because it broke the timedelta field. When opening the product form I get the following traceback:


ERROR:tryton.common.common:Traceback (most recent call last):
  File "/home/sergi/projectes/nclone/tryton/tryton/gui/window/form.py", line 298, in sig_new
    self.screen.new()
  File "/home/sergi/projectes/nclone/tryton/tryton/gui/window/view_form/screen/screen.py", line 548, in new
    self.switch_view('form')
  File "/home/sergi/projectes/nclone/tryton/tryton/gui/window/view_form/screen/screen.py", line 488, in switch_view
    self.display()
  File "/home/sergi/projectes/nclone/tryton/tryton/gui/window/view_form/screen/screen.py", line 858, in display
    view.display()
  File "/home/sergi/projectes/nclone/tryton/tryton/gui/window/view_form/view/form.py", line 518, in display
    widget.display(record, field)
  File "/home/sergi/projectes/nclone/tryton/tryton/gui/window/view_form/view/form_gtk/timedelta.py", line 44, in display
    value = field.get_client(record)
  File "/home/sergi/projectes/nclone/tryton/tryton/gui/window/view_form/model/field.py", line 287, in get_client
    return common.timedelta.format(value, self.converter(record.group))
  File "/home/sergi/projectes/nclone/tryton/tryton/gui/window/view_form/model/field.py", line 277, in converter
    return self.get_context().get(self.attrs.get('converter'))
TypeError: get_context() takes exactly 2 arguments (1 given)
New changeset 4392ca20106e by Cédric Krier in branch 'default':
Rationalize context usage
http://hg.tryton.org/sao/rev/4392ca20106e
New changeset 4c80f5b14952 by Cédric Krier in branch 'default':
Rationalize context usage
http://hg.tryton.org/tryton/rev/4c80f5b14952
review40981002 updated at https://codereview.tryton.org/40981002/#ps40001
review43041002 updated at https://codereview.tryton.org/43041002/#ps40001
review40981002 updated at https://codereview.tryton.org/40981002/#ps20001
review43041002 updated at https://codereview.tryton.org/43041002/#ps20001
review43041002 updated at https://codereview.tryton.org/43041002/#ps1
review40981002 updated at https://codereview.tryton.org/40981002/#ps1
msg37703 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-01-20.20:10:36
The construction of the context inside the client is not rationalized. Sometimes, we add the rpc.CONTEXT, we use the screen static context (in sao) or we update multiple times the parent context etc.
I think we should rationalize by always use the context of the group as reference and to always add the rpc context.
Also the expr_eval uses the context as base which is mixed with the fields. Instead we should enforce to always use explicitly the 'context' keyword. And the '_user' key is added which does not seem to be used anywhere, so it could be removed. If someone need it, he could add to the user context.
History
Date User Action Args
2018-03-14 00:08:26roundup-botsetstatus: testing -> resolved
messages: + msg38979
2018-03-13 14:13:09reviewbotsetmessages: + msg38970
2018-03-13 13:59:11cedsetstatus: in-progress -> testing
reviews: 40981002,43041002 -> 40981002,43041002,44741002
messages: + msg38965
2018-03-13 12:51:31pokolisetstatus: resolved -> in-progress
nosy: + pokoli
messages: + msg38964
2018-03-09 19:11:13roundup-botsetmessages: + msg38914
2018-03-09 19:10:25roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg38913
2018-02-23 18:49:27reviewbotsetmessages: + msg38586
2018-02-23 18:49:23reviewbotsetmessages: + msg38585
2018-02-23 18:13:16cedlinkissue7157 superseder
2018-02-07 00:55:55reviewbotsetmessages: + msg38264

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