changeset 01ef5885b0e1 in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset;node=01ef5885b0e1
description:
        Use existing context for get_preferences

        So we present to the user his current contextual values.
        But we clear the context after modification.

        issue9327
        review301611002
diffstat:

 CHANGELOG                       |  1 +
 tryton/common/common.py         |  8 +++-----
 tryton/gui/window/preference.py |  1 +
 3 files changed, 5 insertions(+), 5 deletions(-)

diffs (37 lines):

diff -r 4bd07621b616 -r 01ef5885b0e1 CHANGELOG
--- a/CHANGELOG Thu May 21 09:10:46 2020 +0200
+++ b/CHANGELOG Sat Jun 06 14:02:22 2020 +0200
@@ -1,3 +1,4 @@
+* Use existing context for get_preferences
 * Add context to export URL
 
 Version 5.6.0 - 2020-05-04
diff -r 4bd07621b616 -r 01ef5885b0e1 tryton/common/common.py
--- a/tryton/common/common.py   Thu May 21 09:10:46 2020 +0200
+++ b/tryton/common/common.py   Sat Jun 06 14:02:22 2020 +0200
@@ -1081,11 +1081,9 @@
             pass
         if callback:
             callback()
-    # Use RPCProgress to not send rpc.CONTEXT
-    context = RPCProgress(
-        'execute',
-        ('model', 'res.user', 'get_preferences', True, {})).run(
-            True, update if callback else None)
+    context = RPCExecute(
+        'model', 'res.user', 'get_preferences', True,
+        callback=update if callback else None)
     if not callback:
         rpc.context_reset()
         rpc.CONTEXT.update(context)
diff -r 4bd07621b616 -r 01ef5885b0e1 tryton/gui/window/preference.py
--- a/tryton/gui/window/preference.py   Thu May 21 09:10:46 2020 +0200
+++ b/tryton/gui/window/preference.py   Sat Jun 06 14:02:22 2020 +0200
@@ -101,6 +101,7 @@
                     RPCExecute('model', 'res.user', 'set_preferences', vals)
                 except RPCException:
                     return
+                rpc.context_reset()
         self.parent.present()
         self.destroy()
         self.callback()

Reply via email to