changeset 59ec3b45a481 in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset;node=59ec3b45a481
description:
        Display record name on the concurrency comparison tab

        issue8803
        review282351002
diffstat:

 tryton/common/common.py |  28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

diffs (57 lines):

diff -r 6c7740440f84 -r 59ec3b45a481 tryton/common/common.py
--- a/tryton/common/common.py   Mon Nov 25 21:55:22 2019 +0100
+++ b/tryton/common/common.py   Tue Nov 26 22:34:49 2019 +0100
@@ -694,7 +694,7 @@
 
 class ConcurrencyDialog(UniqueDialog):
 
-    def build_dialog(self, parent, resource, obj_id, context):
+    def build_dialog(self, parent):
         tooltips = Tooltips()
         dialog = Gtk.MessageDialog(
             transient_for=parent, modal=True, destroy_with_parent=True,
@@ -714,19 +714,24 @@
         dialog.set_default_response(Gtk.ResponseType.CANCEL)
         return dialog
 
-    def __call__(self, resource, obj_id, context):
-        res = super(ConcurrencyDialog, self).__call__(resource, obj_id,
-            context)
+    def __call__(self, model, id_, context):
+        res = super(ConcurrencyDialog, self).__call__()
 
         if res == Gtk.ResponseType.OK:
             return True
         if res == Gtk.ResponseType.APPLY:
             from tryton.gui.window import Window
-            Window.create(resource,
-                res_id=obj_id,
-                domain=[('id', '=', obj_id)],
-                context=context,
-                mode=['form', 'tree'])
+            name = RPCExecute(
+                'model', model, 'read', [id_], ['rec_name'],
+                context=context)[0]['rec_name']
+            with Window(allow_similar=True):
+                Window.create(
+                    model,
+                    res_id=id_,
+                    name=_("Compare: %s", name),
+                    domain=[('id', '=', id_)],
+                    context=context,
+                    mode=['form'])
         return False
 
 
@@ -872,7 +877,10 @@
                     description += '\n' + domain_parser.string(domain)
             warning(description, msg)
         elif exception.faultCode == 'ConcurrencyException':
-            if len(args) >= 6:
+            if (len(args) >= 6
+                    and args[0] == 'model'
+                    and args[2] in {'write', 'delete'}
+                    and len(args[3]) == 1):
                 if concurrency(args[1], args[3][0], args[5]):
                     if '_timestamp' in args[5]:
                         del args[5]['_timestamp']

Reply via email to