changeset 5b1cb6b0f3db in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset;node=5b1cb6b0f3db
description:
        Add permission groups on export

        By default an export is only available for his creator and 
administrators.
        We add a list of groups that are allowed to read and a second subset of 
groups
        that are allowed to modify it.

        issue8695
        review252331002
diffstat:

 tryton/gui/window/win_export.py |  23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diffs (39 lines):

diff -r daa0e5eb6631 -r 5b1cb6b0f3db tryton/gui/window/win_export.py
--- a/tryton/gui/window/win_export.py   Fri Oct 11 11:48:24 2019 +0200
+++ b/tryton/gui/window/win_export.py   Mon Oct 14 00:09:32 2019 +0200
@@ -205,23 +205,24 @@
             if not override:
                 return
         try:
-            new_id, = RPCExecute('model', 'ir.export', 'create', [{
-                    'name': name,
-                    'resource': self.model,
-                    'export_fields': [('create', [{
-                                        'name': x,
-                                        } for x in fields])],
-                    }], context=self.context)
-            if pref_id:
-                RPCExecute('model', 'ir.export', 'delete', [pref_id],
+            if not pref_id:
+                pref_id, = RPCExecute('model', 'ir.export', 'create', [{
+                        'name': name,
+                        'resource': self.model,
+                        'export_fields': [('create', [{
+                                            'name': x,
+                                            } for x in fields])],
+                        }], context=self.context)
+            else:
+                RPCExecute('model', 'ir.export', 'update', [pref_id], fields,
                     context=self.context)
         except RPCException:
             return
         clear_cache('model.%s.view_toolbar_get' % self.model)
         if iter_ is None:
-            self.predef_model.append((new_id, fields, name))
+            self.predef_model.append((pref_id, fields, name))
         else:
-            model.set_value(iter_, 0, new_id)
+            model.set_value(iter_, 0, pref_id)
             model.set_value(iter_, 1, fields)
 
     def remove_predef(self, widget):

Reply via email to