diff --git a/addons/web_mobile/static/src/js/chrome_mobile.js b/addons/web_mobile/static/src/js/chrome_mobile.js index 15680eebfab..b3246024afc 100644 --- a/addons/web_mobile/static/src/js/chrome_mobile.js +++ b/addons/web_mobile/static/src/js/chrome_mobile.js @@ -74,8 +74,9 @@ openerp.web_mobile.Login = openerp.base.Widget.extend({ .removeClass("login_invalid") .addClass("login_valid"); //.hide(); - this.homepage = new openerp.web_mobile.HomePage(this, "oe_home"); - this.homepage.start(); + + this.menu = new openerp.web_mobile.Menu(this, "oe_menu", "oe_secondary_menu"); + this.menu.start(); }, do_ask_login: function(continuation) { this.on_login_invalid(); @@ -87,27 +88,6 @@ openerp.web_mobile.Login = openerp.base.Widget.extend({ } }); -openerp.web_mobile.HomePage = openerp.base.Widget.extend({ - init: function(session, element_id) { - this._super(session, element_id); - }, - start: function() { - this.$element.html(QWeb.render("HomePage", {})); -// this.header = new openerp.web_mobile.Header(this, "oe_header"); - this.shortcuts = new openerp.web_mobile.Shortcuts(this, "oe_shortcuts"); - this.menu = new openerp.web_mobile.Menu(this, "oe_menu", "oe_secondary_menu"); - this.options = new openerp.web_mobile.Options(this, "oe_options"); -// this.footer = new openerp.web_mobile.Footer(this, "oe_footer"); -// this.header.start(); - this.shortcuts.start(); - this.menu.start(); - this.options.start(); -// this.footer.start(); - this.$element.find("a").click(this.on_clicked); - $.mobile.changePage($("#oe_home"), "slide", true, true); - } -}); - openerp.web_mobile.Header = openerp.base.Widget.extend({ init: function(session, element_id) { this._super(session, element_id); @@ -136,8 +116,13 @@ openerp.web_mobile.Shortcuts = openerp.base.Widget.extend({ var self = this; this.rpc('/base/session/sc_list',{} ,function(res){ self.$element.html(QWeb.render("Shortcuts", {'sc' : res})) - self.$element.find("a").click(self.on_clicked); - }) + self.$element.find('#content').find("a").click(self.on_clicked); + self.$element.find("#footer").find('#preference').click(function(){ + this.options = new openerp.web_mobile.Options(self, "oe_options"); + this.options.start(); + }); + $.mobile.changePage($("#oe_shortcuts"), "slide", true, true); + }); }, on_clicked: function(ev) { $shortcut = $(ev.currentTarget); @@ -162,9 +147,20 @@ openerp.web_mobile.Menu = openerp.base.Widget.extend({ this.rpc("/base/menu/load", {}, this.on_loaded); }, on_loaded: function(data) { + var self = this; this.data = data; this.$element.html(QWeb.render("Menu", this.data)); - this.$element.add(this.$secondary_menu).find("a").click(this.on_menu_click); + + this.$element.find("#footer").find('#shrotcuts').click(function(){ + this.shortcuts = new openerp.web_mobile.Shortcuts(self, "oe_shortcuts"); + this.shortcuts.start(); + }); + this.$element.find("#footer").find('#preference').click(function(){ + this.options = new openerp.web_mobile.Options(self, "oe_options"); + this.options.start(); + }); + this.$element.add(this.$secondary_menu).find("#content").find('a').click(this.on_menu_click); + $.mobile.changePage($("#oe_menu"), "slide", true, true); }, on_menu_click: function(ev, id) { $menu = $(ev.currentTarget); @@ -182,46 +178,35 @@ openerp.web_mobile.Menu = openerp.base.Widget.extend({ this.secondary = new openerp.web_mobile.Secondary(this, "oe_sec_menu", this.children); // this.header.start(); this.secondary.start(); - jQuery("#oe_header").find("h1").html($menu.data('name')); } }); - openerp.web_mobile.Secondary = openerp.base.Widget.extend({ init: function(session, element_id, secondary_menu_id) { this._super(session, element_id); this.data = secondary_menu_id; }, start: function(ev, id) { + var self = this; var v = { menu : this.data }; this.$element.html(QWeb.render("Menu.secondary", v)); - this.$element.add(this.$secondary_menu).find("a").click(this.on_menu_click); + this.$element.find("#header").find("h1").html(this.data.name); + this.$element.add(this.$secondary_menu).find('#content').find("a").click(this.on_menu_click); + this.$element.find("#footer").find('#shrotcuts').click(function(){ + this.shortcuts = new openerp.web_mobile.Shortcuts(self, "oe_shortcuts"); + this.shortcuts.start(); + }); + this.$element.find("#footer").find('#preference').click(function(){ + this.options = new openerp.web_mobile.Options(self, "oe_options"); + this.options.start(); + }); $.mobile.changePage($("#oe_sec_menu"), "slide", true, true); }, on_menu_click: function(ev, id) { $menu = $(ev.currentTarget); id = $menu.data('menu'); - for (var i = 0; i < this.data.children.length; i++) { - if (this.data.children[i].id == id) { - this.children = this.data.children[i]; - } - } - var child_len = this.children.children.length; - if (child_len > 0) { - this.$element - .removeClass("secondary_menu") - .addClass("content_menu"); - //.hide(); -// this.header = new openerp.web_mobile.Header(this, "oe_header"); - this.secondary = new openerp.web_mobile.Secondary(this, "oe_sec_menu_new", this.children); -// this.header.start(); - this.secondary.start(); - $.mobile.changePage($("#oe_sec_menu_new"), "slide", true, true); - } - else { - if (id) { - this.listview = new openerp.web_mobile.ListView(this, "oe_list", id); - this.listview.start(); - } + if (id) { + this.listview = new openerp.web_mobile.ListView(this, "oe_list", id); + this.listview.start(); } jQuery("#oe_header").find("h1").html($menu.data('name')); } @@ -234,6 +219,11 @@ openerp.web_mobile.Options = openerp.base.Widget.extend({ start: function() { var self = this; this.$element.html(QWeb.render("Options", this)); + this.$element.find("#footer").find('#shrotcuts').click(function(){ + this.shortcuts = new openerp.web_mobile.Shortcuts(self, "oe_shortcuts"); + this.shortcuts.start(); + }); + $.mobile.changePage($("#oe_options"), "slide", true, true); } }); diff --git a/addons/web_mobile/static/src/js/form_mobile.js b/addons/web_mobile/static/src/js/form_mobile.js index 40e897299c3..7c66182263a 100644 --- a/addons/web_mobile/static/src/js/form_mobile.js +++ b/addons/web_mobile/static/src/js/form_mobile.js @@ -39,6 +39,8 @@ openerp.web_mobile.FormView = openerp.base.Widget.extend({ } } self.$element.html(QWeb.render("FormView", {'get_fields': get_fields, 'notebooks': notebooks || false, 'fields' : fields, 'values' : data })); + + self.$element.find("#header").find('h1').html(self.action.name); self.$element.find('select').change(function(ev){ selection.on_select_option(ev); }); @@ -68,9 +70,12 @@ openerp.web_mobile.FormView = openerp.base.Widget.extend({ if (!next.find('.detail').html().length) { for (var i = 0; i < get_fields.length; i++) { if (fields[get_fields[i].attrs.name].type == 'one2many'){ - var get_fields_test = self.get_fields(fields[get_fields[i].attrs.name].views.form.arch.children); - var fields_test = fields[get_fields[i].attrs.name]['views'].form.fields; - var notebook=fields[get_fields[i].attrs.name].views.form.arch; + if(fields[get_fields[i].attrs.name].views.form){ + var get_fields_test = self.get_fields(fields[get_fields[i].attrs.name].views.form.arch.children); + var fields_test = fields[get_fields[i].attrs.name]['views'].form.fields; + var notebook=fields[get_fields[i].attrs.name].views.form.arch; + } + var relational = get_fields[i].attrs.name; } } if(notebook){ @@ -79,18 +84,34 @@ openerp.web_mobile.FormView = openerp.base.Widget.extend({ next.find('.detail').append(QWeb.render("FormView", {'get_fields': get_fields,'fields' : result.fields_view.fields, 'values' : data })); } } - next.find('.detail').find('a').click(function(){ - if(next.find('.detail').find('a').next().find('.detail').html().length){ - if (next.find('.detail').find('a').next().hasClass(self.content_collapsed_class)) { - self.collapsed(next.find('.detail').find('a').next(),next.find('.detail').find('a').find('span .ui-icon')); - } - else if (next.find('.detail').find('a').next().hasClass(self.content_expanded_class)) { - self.expanded(next.find('.detail').find('a').next(),next.find('.detail').find('a').find('span .ui-icon')); - } - } - if(!next.find('.detail').find('a').next().find('.detail').html().length){ - next.find('.detail').find('a').next().find('.detail').append(QWeb.render("FormView", {'get_fields': get_fields_test,'fields' : fields_test, 'values' : data })); - self.collapsed(next.find('.detail').find('a').next(),next.find('.detail').find('a').find('span .ui-icon')); + + //$.mobile.changePage($("#oe_form"), "slide", true, true); + next.find('.detail').find('li').click(function(){ + if(data[relational]){ + var dataset = new openerp.base.DataSetStatic(self, result.fields_view.fields[relational].relation, result.fields_view.fields[relational].context); + dataset.domain=[['id', 'in', data[relational]]]; + dataset.name_search('', dataset.domain, 'in',false ,function(res){ + for(var i=0;i
+
+
+
@@ -41,17 +44,16 @@ -
+
-
-
-
+
-
-

Footer

+ @@ -69,61 +71,86 @@ -
+
+
-
-

OpenERP

+ +
+ +
    + +
  • + +
  • + +
  • + + + +
  • +
    +
    +
+
+ + + +
- -
-
-

Footer

-
-
- - +
+
-
-

OpenERP

- +
    @@ -151,13 +181,19 @@
-
-

Footer

+ -
+ +