diff --git a/addons/web_mobile/static/src/js/chrome_mobile.js b/addons/web_mobile/static/src/js/chrome_mobile.js index 99b9651fa7b..516de784adc 100644 --- a/addons/web_mobile/static/src/js/chrome_mobile.js +++ b/addons/web_mobile/static/src/js/chrome_mobile.js @@ -20,13 +20,10 @@ openerp.web_mobile.MobileWebClient = openerp.web.Widget.extend({ openerp.web.qweb.add_template("xml/web_mobile.xml"); var params = {}; this.$element.html(this.render()); - this.session = new openerp.web.Session("oe_errors"); this.crashmanager = new openerp.web.CrashManager(this); this.login = new openerp.web_mobile.Login(this, "oe_login"); -// this.session.on_session_invalid.add(this.login.do_ask_login); }, start: function() { - this.session.start(); this.login.start(); } }); diff --git a/addons/web_mobile/static/src/js/form_mobile.js b/addons/web_mobile/static/src/js/form_mobile.js index 1cb1dfb494e..598f3c29739 100644 --- a/addons/web_mobile/static/src/js/form_mobile.js +++ b/addons/web_mobile/static/src/js/form_mobile.js @@ -96,10 +96,6 @@ openerp.web_mobile.FormView = openerp.web.Widget.extend({ } } } - } - if(notebook){ - $(this).find('div#page_content').html(self.render({'get_fields': get_fields,'fields' : result.fields, 'values' : self.datarecord,'til': notebook.attrs.string })); - }else{ $(this).find('div#page_content').html(self.render({'get_fields': get_fields,'fields' : result.fields, 'values' : self.datarecord})); } self.formatdata(get_fields, fields, result, self.datarecord,'page_content','element'); @@ -135,16 +131,19 @@ openerp.web_mobile.FormView = openerp.web.Widget.extend({ var relational = $(this).attr('for'); if(result.fields[relational]){ var head = $.trim($(this).text()); - var dataset = new openerp.web.DataSetStatic(self, result.fields[relational].relation, result.fields[relational].context); + var dataset = new openerp.web.DataSetSearch(self, result.fields[relational].relation, result.fields[relational].context); dataset.domain=[['id', 'in', self.datarecord[relational]]]; - dataset.name_search('', dataset.domain, 'in',false ,function(res){ - for(var i=0;i ').appendTo('#moe'); - $('[id^="oe_list_'+relational+'_'+self.element_id+'"]').html(openerp.web.qweb.render("ListView", {'records' : res})); + $('[id^="oe_list_'+relational+'_'+self.element_id+'"]').html(openerp.web.qweb.render("ListView", {'records' : res,'data': additional})); $('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("[data-role=header]").find('h1').html(head); $('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("[data-role=header]").find('#home').click(function(){ $.mobile.changePage("#oe_menu", "slide", false, true); @@ -179,6 +178,7 @@ openerp.web_mobile.FormView = openerp.web.Widget.extend({ } if(!$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').html()){ $('
').appendTo('#moe'); + for (var k = 0; k < notebooks.children.length; k++) { if (notebooks.children[k].attrs.string == lastid) { get_fields = self.get_fields(notebooks.children[k].children); @@ -194,7 +194,11 @@ openerp.web_mobile.FormView = openerp.web.Widget.extend({ } } } - $('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').html(self.render({'get_fields': get_fields_test, 'notebooks': false, 'fields' : fields_test, 'values' : data_relational, 'temp_flag':'1' })); + if(notebook){ + $('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').html(self.render({'get_fields': get_fields_test, 'notebooks': false, 'fields' : fields_test, 'values' : data_relational, 'temp_flag':'1' })); + }else{ + $('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').html(self.render({'get_fields': get_fields_test, 'notebooks': false, 'fields' : fields, 'values' : data_relational, 'temp_flag':'1' })); + } $('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').find("[data-role=header]").find('h1').html(head_title); $('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').find("[data-role=header]").find('#home').click(function(){ $.mobile.changePage("#oe_menu", "slide", false, true); @@ -229,7 +233,11 @@ openerp.web_mobile.FormView = openerp.web.Widget.extend({ } } }); - self.formatdata(get_fields_test, fields_test, result, data_relational,'oe_form_'+listid+result.fields[relational].relation,'element'); + if(notebook){ + self.formatdata(get_fields_test, fields_test, result, data_relational,'oe_form_'+listid+result.fields[relational].relation,'element'); + }else{ + self.formatdata(get_fields_test, fields, result, data_relational,'oe_form_'+listid+result.fields[relational].relation,'element'); + } $.mobile.changePage('#oe_form_'+listid+result.fields[relational].relation, "slide", false, true); self.formatdata('', '', '', '','oe_form_'+listid+result.fields[relational].relation,'slider'); }else{ @@ -241,7 +249,8 @@ openerp.web_mobile.FormView = openerp.web.Widget.extend({ }else{ $.mobile.changePage("#oe_list_"+relational+"_"+self.element_id, "slide", false, true); } - }); + }); + }); } }); $.mobile.changePage("#"+self.element_id, "slide", false, true); @@ -256,6 +265,12 @@ openerp.web_mobile.FormView = openerp.web.Widget.extend({ if (view_fields[i].tag == 'group') { this.get_fields(view_fields[i].children, this.fields); } + if (view_fields[i].tag == 'level') { + this.get_fields(view_fields[i].children, this.fields); + } + if (view_fields[i].tag == 'page') { + this.get_fields(view_fields[i].children, this.fields); + } } return this.fields; }, @@ -280,6 +295,18 @@ openerp.web_mobile.FormView = openerp.web.Widget.extend({ $(this).val(dateresult); } } + $('[id^="'+id+'"]').find('#website').each(function(){ + $(this).css('display','inline-block'); + $(this).css('width','60%'); + }); + $('[id^="'+id+'"]').find('#email').each(function(){ + $(this).css('display','inline-block'); + $(this).css('width','60%'); + }); + $('[id^="'+id+'"]').find('#email_from').each(function(){ + $(this).css('display','inline-block'); + $(this).css('width','60%'); + }); }); // Temp: Selection set as disabled $('[id^="'+id+'"]').find('select').each(function() { @@ -297,6 +324,16 @@ openerp.web_mobile.FormView = openerp.web.Widget.extend({ $(this).css('left', '-9999px'); }); }); + // image displayed with m2o field + $('[id^="'+id+'"]').find('div[class=ui-select]').each(function(){ + $(this).next().each(function(){ + if($(this).attr('id')=="formbutton"){ + $(this).prev().css('display','inline-table'); + $(this).prev().find('a').find('.ui-btn-inner').removeClass('ui-btn-inner'); + $(this).prev().find('a').find('span:first').css('padding-right','150px'); + } + }); + }); } } }); diff --git a/addons/web_mobile/static/src/js/list_mobile.js b/addons/web_mobile/static/src/js/list_mobile.js index ec6de48e941..7e9fff16262 100644 --- a/addons/web_mobile/static/src/js/list_mobile.js +++ b/addons/web_mobile/static/src/js/list_mobile.js @@ -19,36 +19,52 @@ openerp.web_mobile.ListView = openerp.web.Widget.extend({ var self = this; if (data.action.length) { this.action = data.action[0][2]; - this.on_search_data(); + return this.rpc('/web/listview/load', { + model: this.action.res_model, + view_id: this.action.views[0][0], + view_type: "tree", + context: this.action.context, + toolbar: false + }, this.on_search_data); } }, on_search_data: function(ev){ var self = this; - var dataset = new openerp.web.DataSetStatic(this, this.action.res_model, this.action.context); - dataset.name_search('', this.action.domain, 'ilike', false, function(result){ - self.$element.html(self.render({'records' : result})); - self.$element.find("[data-role=header]").find('h1').html(self.action.name); - self.$element.find("[data-role=header]").find('#home').click(function(){ - $.mobile.changePage("#oe_menu", "slide", false, true); - }); - self.$element.find("[data-role=footer]").find('#shrotcuts').click(function(){ - if (!$('#oe_shortcuts').html().length) { - this.shortcuts = new openerp.web_mobile.Shortcuts(self, "oe_shortcuts"); - this.shortcuts.start(); - }else{ - $.mobile.changePage("#oe_shortcuts", "slide", false, true); + var dataset = new openerp.web.DataSetSearch(this, this.action.res_model,this.action.context); + dataset.domain = self.action.domain; + dataset.read_slice([], {}, function(result,ids){ + _.extend(self.action.context,{"html_name_get" : true}); + + var dataset1 = new openerp.web.DataSet(self, self.action.res_model,self.action.context); + dataset1.name_get(dataset.ids,function(res){ + var additional = ""; + if(res['html_name_get']){ + additional = res['display']; } + self.$element.html(self.render({'records': res, 'data': additional })); + self.$element.find("[data-role=header]").find('h1').html(self.action.name); + self.$element.find("[data-role=header]").find('#home').click(function(){ + $.mobile.changePage("#oe_menu", "slide", false, true); + }); + self.$element.find("[data-role=footer]").find('#shrotcuts').click(function(){ + if (!$('#oe_shortcuts').html().length) { + this.shortcuts = new openerp.web_mobile.Shortcuts(self, "oe_shortcuts"); + this.shortcuts.start(); + }else{ + $.mobile.changePage("#oe_shortcuts", "slide", false, true); + } + }); + self.$element.find("[data-role=footer]").find('#preference').click(function(){ + if(!$('#oe_options').html().length){ + this.options = new openerp.web_mobile.Options(self, "oe_options"); + this.options.start(); + }else{ + $.mobile.changePage("#oe_options", "slide", false, true); + } + }); + self.$element.find("a#list-id").click(self.on_list_click); + $.mobile.changePage("#"+self.element_id, "slide", false, true); }); - self.$element.find("[data-role=footer]").find('#preference').click(function(){ - if(!$('#oe_options').html().length){ - this.options = new openerp.web_mobile.Options(self, "oe_options"); - this.options.start(); - }else{ - $.mobile.changePage("#oe_options", "slide", false, true); - } - }); - self.$element.find("a#list-id").click(self.on_list_click); - $.mobile.changePage("#"+self.element_id, "slide", false, true); }); }, on_list_click: function(ev) { diff --git a/addons/web_mobile/static/src/xml/web_mobile.xml b/addons/web_mobile/static/src/xml/web_mobile.xml index 775ac90c66c..8299d40c171 100644 --- a/addons/web_mobile/static/src/xml/web_mobile.xml +++ b/addons/web_mobile/static/src/xml/web_mobile.xml @@ -132,13 +132,32 @@
- + + No one record is created + + +
    +
  • + + + + + + + +

    + + + + + +

    + + + +
  • +
+
@@ -148,12 +167,11 @@
-
- +
- - - -
@@ -325,4 +347,4 @@
- + \ No newline at end of file