Different behavior between web and non web client just after the package/pip install procedure


(Franck Delahaye) #1

Howdy everybody,
… and first of all, as it is my first post in this forum, let me just begin by saying “great !” as it was my first reaction after having installed Tryton and a first look at it.
Yet I face the following issue (illustrated by the screenshot below) : when I create a new Party with the web client, the name and code fields are readonly and the active field is not checked by default (and readonly too) ; but when I create a new Party with the non web client I don’t have this issue (both client access the same totaly new database).
Screenshot of this issue :

To install tryton, I have executed the “packages” install procedure documented here :
http://www.tryton.org/download#packages

With the following main modules :
sale, account, stock, product, carrier, party

Any ideas ? and sorry in advance if it’s a dummy post :wink:


(Cédric Krier) #2

There is probably an error in the JavaScript console. You should provide it to allow us to help you.


(Franck Delahaye) #3

Thank’s for this quick feedback !>
yeah : the js error below occured in the web console just when I clicked on the “new” icon to display the party creation form :

TypeError: a is null tryton-sao.min.js:9:8508

Here is the full screenshot of the web console :

BTW, I also identified a small mistake in this doc to install the modules :
How to setup a database — trytond 5.1 documentation :

trytond-admin -c <config file> -d <database name> -u <module name --activate-dependencies

it is :

trytond-admin -c <config file> -d <database name> -u <module name> --install-dependencies

…well I suppose it’s the correct fix as the 2nd command worked ok for me…


(Cédric Krier) #4

I suspect it is related to Issue 8188: One2Many display fails if field is null - Tryton issue tracker
Next time, could you copy/paste (and quote) the text of the console. It is more readable and allow searching.


(Franck Delahaye) #5

oh yes sorry : below are the error trace and the minified js line 9 with this “a is null” error.
According to my check of this js line : the 8508 position in this line does correspond to the “a.field_get_client(…)” in this chunk of js code :

this.prm.done(
function(){
if(void 0===b)return this.screen.new_group(),
this.screen.set_current_record(null),
this.screen.group.parent=null,
void this.screen.display();
var c=a.field_get_client(this.field_name);
c!=this.screen.group&&(this.screen.set_group©,“tree”==this.screen.current_view.view_type&&this.screen.current_view.editable&&this.screen.set_current_record(null));
var d=,e=null;
a&&(d=b.get_domain(a),e=a.expr_eval(this.attributes.size)),
this._readonly&&(e=null===e?this.screen.group.length:Math.min(e,this.screen.group.length)),
Sao.common.compare(this.screen.domain,d)||(this.screen.domain=d),
this.screen.size_limit=e,
this.screen.attributes.readonly=this._readonly,this.screen.display()
}.bind(this))},

The expanded error trace in the web console :

TypeError: a is null[Learn More]
tryton-sao.min.js:9:8508
display/<
http://localhost:8000/dist/tryton-sao.min.js:9:8508
<anonymous> self-hosted:977:17 i
http://localhost:8000/bower_components/jquery/dist/jquery.min.js:2:27146
add
http://localhost:8000/bower_components/jquery/dist/jquery.min.js:2:27450
display
http://localhost:8000/dist/tryton-sao.min.js:9:8340
g/</<
http://localhost:8000/dist/tryton-sao.min.js:8:798
i
http://localhost:8000/bower_components/jquery/dist/jquery.min.js:2:27146
add
http://localhost:8000/bower_components/jquery/dist/jquery.min.js:2:27450
g/<
http://localhost:8000/dist/tryton-sao.min.js:8:780
forEach self-hosted:261:13 display
http://localhost:8000/dist/tryton-sao.min.js:8:906
display
http://localhost:8000/dist/tryton-sao.min.js:7:13572
switch_view/c<
http://localhost:8000/dist/tryton-sao.min.js:7:9965
<anonymous> self-hosted:975:17 switch_view/c</b<
http://localhost:8000/dist/tryton-sao.min.js:7:9625
<anonymous> self-hosted:977:17 then/</</<
http://localhost:8000/bower_components/jquery/dist/jquery.min.js:2:28467
i
http://localhost:8000/bower_components/jquery/dist/jquery.min.js:2:27146
fireWith
http://localhost:8000/bower_components/jquery/dist/jquery.min.js:2:27914
then/</</<
http://localhost:8000/bower_components/jquery/dist/jquery.min.js:2:28580
i
http://localhost:8000/bower_components/jquery/dist/jquery.min.js:2:27146
fireWith
http://localhost:8000/bower_components/jquery/dist/jquery.min.js:2:27914
Deferred/</e[f[0]]
http://localhost:8000/bower_components/jquery/dist/jquery.min.js:2:28879
g
http://localhost:8000/dist/tryton-sao.min.js:4:12593
i
http://localhost:8000/bower_components/jquery/dist/jquery.min.js:2:27146
fireWith
http://localhost:8000/bower_components/jquery/dist/jquery.min.js:2:27914
z
http://localhost:8000/bower_components/jquery/dist/jquery.min.js:4:12057
c/<
http://localhost:8000/bower_components/jquery/dist/jquery.min.js:4:15619

The the begining of the minified js line 9 (as text size is limited):

},h=new Sao.common.DomainParser;new Sao.Window.Search(a,g.bind(this),{sel_multi:!1,context:f,domain:e,view_ids:(this.attributes.view_ids||"").split(","),views_preload:this.attributes.views||{},new_:this.create_access(),search_filter:h.quote(d),title:this.attributes.string})}}}},_set_completion:function(){var a=this.el.find(".action-search");this.read_access()?a.removeClass("disabled"):a.addClass("disabled");var b=this.el.find(".action-create");this.create_access()?b.removeClass("disabled"):b.addClass("disabled")},_update_completion:function(a){var b=this.record();if(b){var c=this.field(),d=c.get(b);if(this.has_target(d)){var e=this.id_from_value(d);if(void 0!==e&&e>=0)return jQuery.when()}var f=this.get_model();return Sao.common.update_completion(this.entry,b,c,f)}},_completion_match_selected:function(a){this.record().field_set_client(this.field_name,this.value_from_id(a.id,a.rec_name),!0)},_completion_action_activated:function(a){"search"==a?this.edit():"create"==a&&this.new_()}}),Sao.View.Form.One2One=Sao.class_(Sao.View.Form.Many2One,{class_:"form-one2one"}),Sao.View.Form.Reference=Sao.class_(Sao.View.Form.Many2One,{class_:"form-reference",init:function(a,b,c){Sao.View.Form.Reference._super.init.call(this,a,b,c),this.el.addClass("form-inline"),this.select=jQuery("<select/>",{class:"form-control input-sm","aria-label":c.string}),this.el.prepend(jQuery("<span/>").text("-")),this.el.prepend(this.select),this.select.change(this.select_changed.bind(this)),Sao.common.selection_mixin.init.call(this),this.init_selection()},init_selection:function(a){Sao.common.selection_mixin.init_selection.call(this,a,this.set_selection.bind(this))},update_selection:function(a,b,c){Sao.common.selection_mixin.update_selection.call(this,a,b,function(a){this.set_selection(a),c&&c()}.bind(this))},set_selection:function(a){var b=this.select;b.empty(),a.forEach(function(a){b.append(jQuery("<option/>",{value:a[0],text:a[1]}))})},id_from_value:function(a){return parseInt(a.split(",")[1],10)},value_from_id:function(a,b){return b||(b=""),[this.get_model(),[a,b]]},get_text:function(){var a=this.record();return a?a.field_get_client(this.field_name)[1]:""},get_model:function(){return this.select.val()},has_target:function(a){if(null===a)return!1;var b=a.split(",")[0];return a=a.split(",")[1],jQuery.isEmptyObject(a)?a=null:(a=parseInt(a,10),isNaN(a)&&(a=null)),b==this.get_model()&&a>=0},_set_button_sensitive:function(){Sao.View.Form.Reference._super._set_button_sensitive.call(this),this.select.prop("disabled",this.entry.prop("readonly"))},select_changed:function(){this.entry.val("");var a,b=this.get_model();a=b?[b,[-1,""]]:["",""],this.record().field_set_client(this.field_name,a)},set_value:function(a,b){var c;if(this.get_model()){c=b.get_client(a,this.field_name);var d,e;c instanceof Array?(d=c[0],e=c[1]):(d="",e=""),d==this.get_model()&&e==this.entry.val()||(b.set_client(a,null),this.entry.val(""))}else c=this.entry.val(),jQuery.isEmptyObject(c)?b.set_client(a,null):b.set_client(a,["",c])},set_text:function(a){var b;a?(b=a[0],a=a[1]):(b=null,a=null),Sao.View.Form.Reference._super.set_text.call(this,a),b?this.select.val(b):this.select.val("")},display:function(a,b){this.update_selection(a,b,function(){Sao.View.Form.Reference._super.display.call(this,a,b)}.bind(this))},set_readonly:function(a){Sao.View.Form.Reference._super.set_readonly.call(this,a),this.select.prop("disabled",a)}}),Sao.View.Form.One2Many=Sao.class_(Sao.View.Form.Widget,{class_:"form-one2many",init:function(a,b,c){Sao.View.Form.One2Many._super.init.call(this,a,b,c),this._readonly=!0,this._required=!1,this.el=jQuery("<div/>",{class:this.class_+" panel panel-default"}),this.menu=jQuery("<div/>",{class:this.class_+"-menu panel-heading"}),this.el.append(this.menu),this.title=jQuery("<label/>",{class:this.class_+"-string",text:c.string}),this.menu.append(this.title),this.title.uniqueId(),this.el.uniqueId(),this.el.attr("aria-labelledby",this.title.attr("id")),this.title.attr("for",this.el.attr("id"));var d=jQuery("<div/>",{class:this.class_+"-toolbar"});this.menu.append(d);var e=jQuery("<div/>",{class:"input-group input-group-sm"}).appendTo(d);this.wid_text=jQuery("<input/>",{type:"text",class:"form-control input-sm"}).appendTo(e),this.wid_text.hide();var f=jQuery("<div/>",{class:"input-group-btn"}).appendTo(e);c.add_remove&&(this.wid_text.show(),this.but_add=jQuery("<button/>",{class:"btn btn-default btn-sm",type:"button","aria-label":Sao.i18n.gettext("Add")}).append(jQuery("<span/>",{class:"glyphicon glyphicon-plus"})).appendTo(f),this.but_add.click(this.add.bind(this)),this.but_remove=jQuery("<button/>",{class:"btn btn-default btn-sm",type:"button","aria-label":Sao.i18n.gettext("Remove")}).append(jQuery("<span/>",{class:"glyphicon glyphicon-minus"})).appendTo(f),this.but_remove.click(this.remove.bind(this))),this.but_new=jQuery("<button/>",{class:"btn btn-default btn-sm",type:"button","aria-label":Sao.i18n.gettext("New")}).append(jQuery("<span/>",{class:"glyphicon glyphicon-edit"})).appendTo(f),this.but_new.click(this.new_.bind(this)),this.but_open=jQuery("<button/>",{class:"btn btn-default btn-sm",type:"button","aria-label":Sao.i18n.gettext("Open")}).append(jQuery("<span/>",{class:"glyphicon glyphicon-folder-open"})).appendTo(f),this.but_open.click(this.open.bind(this)),this.but_del=jQuery("<button/>",{class:"btn btn-default btn-sm",type:"button","aria-label":Sao.i18n.gettext("Delete")}).append(jQuery("<span/>",{class:"glyphicon glyphicon-trash"})).appendTo(f),this.but_del.click(this.delete_.bind(this)),this.but_undel=jQuery("<button/>",{class:"btn btn-default btn-sm",type:"button","aria-label":Sao.i18n.gettext("Undelete")}).append(jQuery("<span/>",{class:"glyphicon glyphicon-repeat"})).appendTo(f),this.but_undel.click(this.undelete.bind(this)),this.but_previous=jQuery("<button/>",{class:"btn btn-default btn-sm",type:"button","aria-label":Sao.i18n.gettext("Previous")}).append(jQuery("<span/>",{class:"glyphicon glyphicon-chevron-left"})).appendTo(f),this.but_previous.click(this.previous.bind(this)),this.label=jQuery("<span/>",{class:"btn"}).appendTo(f),this.label.text("(0, 0)"),this.but_next=jQuery("<button/>",{class:"btn btn-default btn-sm",type:"button","aria-label":Sao.i18n.gettext("Next")}).append(jQuery("<span/>",{class:"glyphicon glyphicon-chevron-right"})).appendTo(f),this.but_next.click(this.next.bind(this)),this.but_switch=jQuery("<button/>",{class:"btn btn-default btn-sm",type:"button","aria-label":Sao.i18n.gettext("Switch")}).append(jQuery("<span/>",{class:"glyphicon glyphicon-list-alt"})).appendTo(f),this.but_switch.click(this.switch_.bind(this)),this.content=jQuery("<div/>",{class:this.class_+"-content panel-body"}),this.el.append(this.content);var g=(c.mode||"tree,form").split(",");this.screen=new Sao.Screen(c.relation,{mode:g,view_ids:(c.view_ids||"").split(","),views_preload:c.views||{},row_activate:this.activate.bind(this),exclude_field:c.relation_field||null,pre_validate:c.pre_validate}),this.screen.pre_validate=1==c.pre_validate,this.prm=this.screen.switch_view(g[0]).done(function(){this.content.append(this.screen.screen_container.el)}.bind(this)),this.but_switch.prop("disabled",this.screen.number_of_views()<=0)},set_readonly:function(a){this._readonly=a,this._set_button_sensitive(),this._set_label_state()},set_required:function(a){this._required=a,this._set_label_state()},_set_label_state:function(){Sao.common.apply_label_attributes(this.title,this._readonly,this._required)},_set_button_sensitive:function(){var a,b,c=Sao.common.MODELACCESS.get(this.screen.model_name),d=this.record(),e=this.field();if(d&&e){var f=d.expr_eval(this.attributes.size);b=e.get_eval(d).length,a=void 0!==f&&null!==f&&b>=f&&f>=0}else b=null,a=!1;var g=this.attributes.create;void 0===g&&(g=!0),this.but_new.prop("disabled",this._readonly||!g||a||!c.create);var h=this.attributes.delete;void 0===h&&(h=!0),this.but_del.prop("disabled",this._readonly||!h||!c.delete),this.but_undel.prop("disabled",this._readonly||a),this.but_open.prop("disabled",!c.read),this.attributes.add_remove&&(this.wid_text.prop("disabled",this._readonly),this.but_add.prop("disabled",this._readonly||a||!c.write||!c.read),this.but_remove.prop("disabled",this._readonly||!c.write||!c.read))},display:function(a,b){Sao.View.Form.One2Many._super.display.call(this,a,b),this._set_button_sensitive(),this.prm.done(function(){if(void 0===b)return this.screen.new_group(),this.screen.set_current_record(null),this.screen.group.parent=null,void this.screen.display();var c=a.field_get_client(this.field_name);c!=this.screen.group&&(this.screen.set_group(c),"tree"==this.screen.current_view.view_type&&this.screen.current_view.editable&&this.screen.set_current_record(null));var d=[],e=null;a&&(d=b.get_domain(a),e=a.expr_eval(this.attributes.size)),this._readonly&&(e=null===e?this.screen.group.length:Math.min(e,this.screen.group.length)),Sao.common.compare(this.screen.domain,d)||(this.screen.domain=d),this.screen.size_limit=e,this.screen.attributes.readonly=this._readonly,this.screen.display()}.bind(this))},focus:function(){this.wid_text.is(":visible")&&this.wid_text.focus()},activate:function(a){this.edit()},add:function(a){var b=Sao.common.MODELACCESS.get(this.screen.model_name);if(b.write&&b.read){this.view.set_value();var c=this.field().get_domain(this.record()),d=this.field().get_context(this.record());c=[c,this.record().expr_eval(this.attributes.add_remove)];c=["OR",c,["id","in",this.field().get_removed_ids(this.record())]];var e=this.wid_text.val(),f=function(a){var b=jQuery.when();if(!jQuery.isEmptyObject(a)){var c,d,e=[];for(c=0,d=a.length;c<d;c++)e.push(a[c][0]);this.screen.group.load(e,!0),b=this.screen.display()}b.done(function(){this.screen.set_cursor()}.bind(this)),this.wid_text.val("")}.bind(this),g=new Sao.common.DomainParser;new Sao.Window.Search(this.attributes.relation,f,{sel_multi:!0,context:d,domain:c,view_ids:(this.attributes.view_ids||"").split(","),views_preload:this.attributes.views||{},new_:!this.but_new.prop("disabled"),search_filter:g.quote(e),title:this.attributes.string})}},remove:function(a){var b=Sao.common.MODELACCESS.get(this.screen.model_name);b.write&&b.read&&this.screen.remove(!1,!0,!1)},new_:function(a){Sao.common.MODELACCESS.get(this.screen.model_name).create&&this.validate().done(function(){this.attributes.product?this.new_product():this.new_single()}.bind(this))},new_single:function(){var a=jQuery.extend({},this.field().get_context(this.record()));if("form"==this.screen.current_view.type||this.screen.current_view.editable)this.screen.new_(),this.screen.current_view.el.prop("disabled",!1);else{var b=this.record(),c=b.expr_eval(this.attributes.size)||-1;c-=this.field().get_eval(b);new Sao.Window.Form(this.screen,function(){},{new_:!0,many:c,context:a,title:this.attributes.string})}},new_product:function(){var a=this.attributes.product.split(","),b={},c=this.screen;c.new_(!1).then(function(d){d.default_get().then(function(e){d.set_default(e);var f=function(){if(jQuery.isEmptyObject(a))return g();var e=c.model.fields[a.pop()],h=e.description.relation;h||f();var i=e.get_domain(d),j=e.get_context(d),k=function(a){jQuery.isEmptyObject(a)||(b[e.name]=a),f()};new Sao.Window.Search(h,k,{sel_multi:!0,context:j,domain:i,search_filter:"",title:this.attributes.string})}.bind(this),g=function(){if(c.group.remove(d,!0),!jQuery.isEmptyObject(b)){var a=Object.keys(b),f=a.map(function(a){return b[a]});Sao.common.product(f).forEach(function(b){c.new_(!1).then(function(c){var d=jQuery.extend({},e);a.forEach(function(a,c){d[a]=b[c][0],d[a+".rec_name"]=b[c][1]}),c.set_default(d)})})}};f()}.bind(this))}.bind(this))},open:function(a){this.edit()},delete_:function(a){Sao.common.MODELACCESS.get(this.screen.model_name).delete&&this.screen.remove(!1,!1,!1)},undelete:function(a){this.screen.unremove()},previous:function(a){this.validate().done(function(){this.screen.display_previous()}.bind(this))},next:function(a){this.validate().done(function(){this.screen.display_next()}.bind(this))},switch_:function(a){this.screen.switch_view()},edit:function(){Sao.common.MODELACCESS.get(this.screen.model_name).read&&this.validate().done(function(){this.screen.current_record&&new Sao.Window.Form(this.screen,function(){},{title:this.attributes.string})}.bind(this))},validate:function(){var a=jQuery.Deferred();this.view.set_value();var b=this.screen.current_record;if(b){var c=this.screen.current_view.get_fields();...

(Franck Delahaye) #6

Upgrading to 5.0 version of tryton-sao fixed the issue as one can see on the screenshot below : thank’s a lot for your support !

BTW, grunt didn’t work at all after npm install, I had to manualy install the following packages (on my debian stretch vm) :

    sudo npm install findup-sync -g
    sudo npm link findup-sync
    sudo npm install resolve -g
    sudo npm link resolve
    sudo npm install nopt -g
    sudo npm link nopt
    sudo npm install grunt-known-options -g
    sudo npm link grunt-known-options

(Cédric Krier) split this topic #7

A post was split to a new topic: Can not save sale with sao