changeset c5e4173dfd24 in sao:default
details: https://hg.tryton.org/sao?cmd=changeset;node=c5e4173dfd24
description:
        Manage exclude field from search window

        When creating a new record from search window, we should include the 
relation
        field as excluded like it is done for direct creation.

        issue9024
        review274811009
diffstat:

 src/view/form.js |  12 ++++++++----
 src/window.js    |   2 ++
 2 files changed, 10 insertions(+), 4 deletions(-)

diffs (62 lines):

diff -r 57e788408a19 -r c5e4173dfd24 src/view/form.js
--- a/src/view/form.js  Mon Feb 10 23:40:51 2020 +0100
+++ b/src/view/form.js  Wed Feb 12 00:11:55 2020 +0100
@@ -2224,7 +2224,8 @@
                 'mode': ['form'],
                 'view_ids': view_ids,
                 'views_preload': this.attributes.views,
-                'readonly': this._readonly
+                'readonly': this._readonly,
+                exclude_field: this.attributes.relation_field,
             });
         },
         set_text: function(value) {
@@ -2435,7 +2436,8 @@
                             views_preload: (this.attributes.views || {}),
                             new_: this.create_access,
                             search_filter: parser.quote(text),
-                            title: this.attributes.string
+                            title: this.attributes.string,
+                            exclude_field: this.attributes.relation_field,
                         });
                 return;
             }
@@ -2545,7 +2547,8 @@
                                     {}),
                                 new_: this.create_access,
                                 search_filter: parser.quote(text),
-                                title: this.attributes.string
+                                title: this.attributes.string,
+                                exclude_field: this.attributes.relation_field,
                             });
                 }
             }
@@ -3118,7 +3121,8 @@
                         views_preload: this.attributes.views || {},
                         new_: !this.but_new.prop('disabled'),
                         search_filter: parser.quote(text),
-                        title: this.attributes.string
+                        title: this.attributes.string,
+                        exclude_field: this.attributes.relation_field,
                     });
         },
         remove: function(event_) {
diff -r 57e788408a19 -r c5e4173dfd24 src/window.js
--- a/src/window.js     Mon Feb 10 23:40:51 2020 +0100
+++ b/src/window.js     Wed Feb 12 00:11:55 2020 +0100
@@ -591,6 +591,7 @@
             this.sel_multi = kwargs.sel_multi;
             this.callback = callback;
             this.title = kwargs.title || '';
+            this.exclude_field = kwargs.exclude_field || null;
             var dialog = new Sao.Dialog(Sao.i18n.gettext(
                 'Search %1', this.title), '', 'lg');
             this.el = dialog.modal;
@@ -679,6 +680,7 @@
                     mode: ['form'],
                     view_ids: view_ids,
                     views_preload: this.views_preload,
+                    exclude_field: this.exclude_field,
                 });
 
                 var callback = function(result) {

Reply via email to