changeset 3c6123efde15 in sao:default
details: https://hg.tryton.org/sao?cmd=changeset;node=3c6123efde15
description:
        Always use search_context for creation from Many2One

        and remove unused context from Many2Many WinForm as it is only for tree 
view.

        issue9023
        review282871003
diffstat:

 src/view/form.js |  14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diffs (46 lines):

diff -r 7e3abe856f67 -r 3c6123efde15 src/view/form.js
--- a/src/view/form.js  Mon Feb 17 23:15:55 2020 +0100
+++ b/src/view/form.js  Wed Feb 19 22:54:21 2020 +0100
@@ -2210,9 +2210,14 @@
             this.el.change(this.focus_out.bind(this));
             this._readonly = false;
         },
-        get_screen: function() {
+        get_screen: function(search) {
             var domain = this.field.get_domain(this.record);
-            var context = this.field.get_context(this.record);
+            var context;
+            if (search) {
+                context = this.field.get_search_context(this.record);
+            } else {
+                context = this.field.get_context(this.record);
+            }
             var view_ids = (this.attributes.view_ids || '').split(',');
             if (!jQuery.isEmptyObject(view_ids)) {
                 // Remove the first tree view as mode is form only
@@ -2447,7 +2452,7 @@
             if (!model || ! Sao.common.MODELACCESS.get(model).create) {
                 return;
             }
-            var screen = this.get_screen();
+            var screen = this.get_screen(true);
             var callback = function(result) {
                 if (result) {
                     var rec_name_prm = screen.current_record.rec_name();
@@ -3145,8 +3150,6 @@
             }.bind(this));
         },
         new_single: function() {
-            var context = jQuery.extend({},
-                    this.field.get_context(this.record));
             var sequence = this._sequence();
             var update_sequence = function() {
                 if (sequence) {
@@ -3165,7 +3168,6 @@
                 var win = new Sao.Window.Form(this.screen, update_sequence, {
                     new_: true,
                     many: field_size,
-                    context: context,
                     title: this.attributes.string
                 });
             }

Reply via email to