[FIX] Minor change for render shortcut and improved indentation.
bzr revid: jra@tinyerp.com-20110929094806-jvf391ahuc8918ke
This commit is contained in:
parent
7f30804c9b
commit
3fba4c077a
|
@ -103,8 +103,7 @@ openerp.web_mobile.Login = openerp.web.Widget.extend({
|
|||
if(!$('#oe_menu').html().length){
|
||||
this.menu = new openerp.web_mobile.Menu(this, "oe_menu", "oe_secondary_menu");
|
||||
this.menu.start();
|
||||
}
|
||||
else{
|
||||
}else{
|
||||
$.mobile.changePage("#oe_menu", "slide", false, true);
|
||||
}
|
||||
},
|
||||
|
@ -145,13 +144,14 @@ openerp.web_mobile.Footer = openerp.web.Widget.extend({
|
|||
openerp.web_mobile.Shortcuts = openerp.web.Widget.extend({
|
||||
|
||||
template: "Shortcuts",
|
||||
|
||||
init: function(session, element_id) {
|
||||
this._super(session, element_id);
|
||||
},
|
||||
start: function() {
|
||||
var self = this;
|
||||
this.rpc('/web/session/sc_list',{} ,function(res){
|
||||
self.$element.html(this.render({'sc' : res}))
|
||||
self.$element.html(self.render({'sc' : res}))
|
||||
self.$element.find("[data-role=header]").find('h1').html('Favourite');
|
||||
self.$element.find("[data-role=header]").find('#home').click(function(){
|
||||
$.mobile.changePage("#oe_menu", "slide", false, true);
|
||||
|
@ -161,8 +161,7 @@ openerp.web_mobile.Shortcuts = openerp.web.Widget.extend({
|
|||
if(!$('#oe_options').html().length){
|
||||
this.options = new openerp.web_mobile.Options(self, "oe_options");
|
||||
this.options.start();
|
||||
}
|
||||
else{
|
||||
}else{
|
||||
$.mobile.changePage("#oe_options", "slide", false, true);
|
||||
}
|
||||
});
|
||||
|
@ -215,8 +214,7 @@ openerp.web_mobile.Menu = openerp.web.Widget.extend({
|
|||
if(!$('#oe_shortcuts').html().length){
|
||||
this.shortcuts = new openerp.web_mobile.Shortcuts(self, "oe_shortcuts");
|
||||
this.shortcuts.start();
|
||||
}
|
||||
else{
|
||||
}else{
|
||||
$.mobile.changePage($("#oe_shortcuts"), "slide", false, true);
|
||||
}
|
||||
});
|
||||
|
@ -224,8 +222,7 @@ openerp.web_mobile.Menu = openerp.web.Widget.extend({
|
|||
if(!$('#oe_options').html().length){
|
||||
this.options = new openerp.web_mobile.Options(self, "oe_options");
|
||||
this.options.start();
|
||||
}
|
||||
else{
|
||||
}else{
|
||||
$.mobile.changePage("#oe_options", "slide", false, true);
|
||||
}
|
||||
});
|
||||
|
@ -273,8 +270,7 @@ openerp.web_mobile.Secondary = openerp.web.Widget.extend({
|
|||
if(!$('#oe_shortcuts').html().length){
|
||||
this.shortcuts = new openerp.web_mobile.Shortcuts(self, "oe_shortcuts");
|
||||
this.shortcuts.start();
|
||||
}
|
||||
else{
|
||||
}else{
|
||||
$.mobile.changePage("#oe_shortcuts", "slide", false, true);
|
||||
}
|
||||
});
|
||||
|
@ -282,8 +278,7 @@ openerp.web_mobile.Secondary = openerp.web.Widget.extend({
|
|||
if(!$('#oe_options').html().length){
|
||||
this.options = new openerp.web_mobile.Options(self, "oe_options");
|
||||
this.options.start();
|
||||
}
|
||||
else{
|
||||
}else{
|
||||
$.mobile.changePage("#oe_options", "slide", false, true);
|
||||
}
|
||||
});
|
||||
|
@ -317,8 +312,7 @@ openerp.web_mobile.Secondary = openerp.web.Widget.extend({
|
|||
}else{
|
||||
$.mobile.changePage('#oe_sec_menu_'+id, "slide", false, true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
}else {
|
||||
if(!$('[id^="oe_list_'+id+'"]').html()){
|
||||
$('<div id="oe_list_'+id+'" data-role="page" data-url="oe_list_'+id+'"> </div>').appendTo('#moe');
|
||||
this.listview = new openerp.web_mobile.ListView(this, "oe_list_"+id, id);
|
||||
|
@ -343,8 +337,7 @@ openerp.web_mobile.Options = openerp.web.Widget.extend({
|
|||
if(!$('#oe_shortcuts').html().length){
|
||||
this.shortcuts = new openerp.web_mobile.Shortcuts(self, "oe_shortcuts");
|
||||
this.shortcuts.start();
|
||||
}
|
||||
else{
|
||||
}else{
|
||||
$.mobile.changePage("#oe_shortcuts", "slide", false, true);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -37,215 +37,214 @@ openerp.web_mobile.FormView = openerp.web.Widget.extend({
|
|||
});
|
||||
},
|
||||
on_loaded: function(result) {
|
||||
var self = this;
|
||||
var fields = result.fields;
|
||||
var view_fields = result.arch.children;
|
||||
var get_fields = this.get_fields(view_fields);
|
||||
|
||||
for (var j = 0; j < view_fields.length; j++) {
|
||||
if (view_fields[j].tag == 'notebook') {
|
||||
var notebooks = view_fields[j];
|
||||
var self = this;
|
||||
var fields = result.fields;
|
||||
var view_fields = result.arch.children;
|
||||
var get_fields = this.get_fields(view_fields);
|
||||
for (var j = 0; j < view_fields.length; j++) {
|
||||
if (view_fields[j].tag == 'notebook') {
|
||||
var notebooks = view_fields[j];
|
||||
}
|
||||
}
|
||||
self.$element.html(self.render({'get_fields': get_fields, 'notebooks': notebooks || false, 'fields' : fields, 'values' : self.datarecord ,'temp_flag':'1'}));
|
||||
for(var i=0;i<get_fields.length;i++) {
|
||||
if (get_fields[i].attrs.widget=="progressbar") {
|
||||
$("#progress").progressbar({value:self.datarecord[get_fields[i].attrs.name]})
|
||||
}
|
||||
}
|
||||
self.$element.find("[data-role=header]").find('h1').html(self.head_title);
|
||||
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('#formbutton').click(function(){
|
||||
var head = $(this).prev().find('select').find("option:selected").text();
|
||||
var selected_id = $(this).prev().find('select').val();
|
||||
var select_model = $(this).prev().find('select').attr('for');
|
||||
if(selected_id!="false"){
|
||||
if(!$('[id^="oe_form_'+selected_id+select_model+'"]').html()){
|
||||
$('<div id="oe_form_'+selected_id+select_model+'" data-role="page" data-url="oe_form_'+selected_id+select_model+'"> </div>').appendTo('#moe');
|
||||
this.formview = new openerp.web_mobile.FormView(self, "oe_form_"+selected_id+select_model, selected_id, '', head, select_model, false);
|
||||
this.formview.start();
|
||||
}else{
|
||||
$.mobile.changePage('#oe_form_'+selected_id+select_model, "slide", false, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
self.$element.find('[data-role=collapsible-set]').find('[data-role=collapsible]').each(function(i){
|
||||
for (var k = 0; k < notebooks.children.length; k++) {
|
||||
if (notebooks.children[k].attrs.string == $(this).attr('id')) {
|
||||
get_fields = self.get_fields(notebooks.children[k].children);
|
||||
for (var i = 0; i < get_fields.length; i++) {
|
||||
if (fields[get_fields[i].attrs.name].type == 'one2many'){
|
||||
self.relational_fields = get_fields[i].attrs.name;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self.$element.html(self.render({'get_fields': get_fields, 'notebooks': notebooks || false, 'fields' : fields, 'values' : self.datarecord ,'temp_flag':'1'}));
|
||||
for(var i=0;i<get_fields.length;i++) {
|
||||
if (get_fields[i].attrs.widget=="progressbar") {
|
||||
$("#progress").progressbar({value:self.datarecord[get_fields[i].attrs.name]})
|
||||
}
|
||||
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.$element.find("[data-role=header]").find('h1').html(self.head_title);
|
||||
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('#formbutton').click(function(){
|
||||
$(this).find('div#page_content').find('#formbutton').click(function(){
|
||||
var head = $(this).prev().find('select').find("option:selected").text();
|
||||
var selected_id = $(this).prev().find('select').val();
|
||||
var select_model = $(this).prev().find('select').attr('for');
|
||||
if(selected_id!="false"){
|
||||
if(!$('[id^="oe_form_'+selected_id+select_model+'"]').html()){
|
||||
$('<div id="oe_form_'+selected_id+select_model+'" data-role="page" data-url="oe_form_'+selected_id+select_model+'"> </div>').appendTo('#moe');
|
||||
this.formview = new openerp.web_mobile.FormView(self, "oe_form_"+selected_id+select_model, selected_id, '', head, select_model, false);
|
||||
this.formview.start();
|
||||
this.formview = new openerp.web_mobile.FormView(self, "oe_form_"+selected_id+select_model, selected_id, '', head, select_model, false);
|
||||
this.formview.start();
|
||||
}else{
|
||||
$.mobile.changePage('#oe_form_'+selected_id+select_model, "slide", false, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
self.$element.find('[data-role=collapsible-set]').find('[data-role=collapsible]').each(function(i){
|
||||
for (var k = 0; k < notebooks.children.length; k++) {
|
||||
if (notebooks.children[k].attrs.string == $(this).attr('id')) {
|
||||
get_fields = self.get_fields(notebooks.children[k].children);
|
||||
for (var i = 0; i < get_fields.length; i++) {
|
||||
if (fields[get_fields[i].attrs.name].type == 'one2many'){
|
||||
self.relational_fields = get_fields[i].attrs.name;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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}));
|
||||
}
|
||||
$(this).find('div#page_content').find('#formbutton').click(function(){
|
||||
var head = $(this).prev().find('select').find("option:selected").text();
|
||||
var selected_id = $(this).prev().find('select').val();
|
||||
var select_model = $(this).prev().find('select').attr('for');
|
||||
if(selected_id!="false"){
|
||||
if(!$('[id^="oe_form_'+selected_id+select_model+'"]').html()){
|
||||
$('<div id="oe_form_'+selected_id+select_model+'" data-role="page" data-url="oe_form_'+selected_id+select_model+'"> </div>').appendTo('#moe');
|
||||
this.formview = new openerp.web_mobile.FormView(self, "oe_form_"+selected_id+select_model, selected_id, '', head, select_model, false);
|
||||
this.formview.start();
|
||||
}else{
|
||||
$.mobile.changePage('#oe_form_'+selected_id+select_model, "slide", false, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
self.$element.find('[data-role=collapsible-set]').find('[data-role=collapsible]').find('div#page_content').find('[data-role=content]').find('ul').find('li').click(function(ev){
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
var latid,lastid;
|
||||
$(this).parents().each(function(){
|
||||
latid = $(this).attr('id');
|
||||
self.$element.find('[data-role=collapsible-set]').find('[data-role=collapsible]').each(function(){
|
||||
if(latid==$(this).attr('id')){
|
||||
lastid = $(this).attr('id');
|
||||
}
|
||||
});
|
||||
self.$element.find('[data-role=collapsible-set]').find('[data-role=collapsible]').find('div#page_content').find('[data-role=content]').find('ul').find('li').click(function(ev){
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
var latid,lastid;
|
||||
$(this).parents().each(function(){
|
||||
latid = $(this).attr('id');
|
||||
self.$element.find('[data-role=collapsible-set]').find('[data-role=collapsible]').each(function(){
|
||||
if(latid==$(this).attr('id')){
|
||||
lastid = $(this).attr('id');
|
||||
});
|
||||
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);
|
||||
dataset.domain=[['id', 'in', self.datarecord[relational]]];
|
||||
dataset.name_search('', dataset.domain, 'in',false ,function(res){
|
||||
for(var i=0;i<res.length;i++){
|
||||
var splited_data = res[i][1].split(',');
|
||||
res[i][1] = splited_data[0];
|
||||
}
|
||||
if(!$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').html()){
|
||||
$('<div id="oe_list_'+relational+'_'+self.element_id+'" data-role="page" data-url="oe_list_'+relational+'_'+self.element_id+'"> </div>').appendTo('#moe');
|
||||
$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').html(openerp.web.qweb.render("ListView", {'records' : res}));
|
||||
$('[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);
|
||||
});
|
||||
$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').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 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);
|
||||
dataset.domain=[['id', 'in', self.datarecord[relational]]];
|
||||
dataset.name_search('', dataset.domain, 'in',false ,function(res){
|
||||
for(var i=0;i<res.length;i++){
|
||||
var splited_data = res[i][1].split(',');
|
||||
res[i][1] = splited_data[0];
|
||||
$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').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);
|
||||
}
|
||||
if(!$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').html()){
|
||||
$('<div id="oe_list_'+relational+'_'+self.element_id+'" data-role="page" data-url="oe_list_'+relational+'_'+self.element_id+'"> </div>').appendTo('#moe');
|
||||
$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').html(openerp.web.qweb.render("ListView", {'records' : res}));
|
||||
$('[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);
|
||||
});
|
||||
$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').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);
|
||||
});
|
||||
$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("a#list-id").click(function(ev){
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
var head_title = $(this).text();
|
||||
var listid = $(ev.currentTarget).data('id');
|
||||
dataset = new openerp.web.DataSetSearch(self, dataset.model, null, null);
|
||||
dataset.read_slice([],{}, function (result_relational) {
|
||||
for (var i = 0; i < result_relational.length; i++) {
|
||||
if (result_relational[i].id == listid) {
|
||||
var data_relational = result_relational[i];
|
||||
}
|
||||
});
|
||||
$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').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);
|
||||
}
|
||||
});
|
||||
$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("a#list-id").click(function(ev){
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
var head_title = $(this).text();
|
||||
var listid = $(ev.currentTarget).data('id');
|
||||
dataset = new openerp.web.DataSetSearch(self, dataset.model, null, null);
|
||||
dataset.read_slice([],{}, function (result_relational) {
|
||||
for (var i = 0; i < result_relational.length; i++) {
|
||||
if (result_relational[i].id == listid) {
|
||||
var data_relational = result_relational[i];
|
||||
}
|
||||
if(!$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').html()){
|
||||
$('<div id="oe_form_'+listid+result.fields[relational].relation+'" data-role="page" data-url="oe_form_'+listid+result.fields[relational].relation+'"> </div>').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);
|
||||
for (var i = 0; i < get_fields.length; i++) {
|
||||
if (fields[get_fields[i].attrs.name].type == 'one2many'){
|
||||
self.relational_fields = get_fields[i].attrs.name;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').html()){
|
||||
$('<div id="oe_form_'+listid+result.fields[relational].relation+'" data-role="page" data-url="oe_form_'+listid+result.fields[relational].relation+'"> </div>').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);
|
||||
for (var i = 0; i < get_fields.length; i++) {
|
||||
if (fields[get_fields[i].attrs.name].type == 'one2many'){
|
||||
self.relational_fields = get_fields[i].attrs.name;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$('[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' }));
|
||||
$('[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);
|
||||
});
|
||||
$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').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);
|
||||
}
|
||||
});
|
||||
$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').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);
|
||||
}
|
||||
});
|
||||
$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').find('#formbutton').click(function(){
|
||||
var head = $(this).prev().find('select').find("option:selected").text();
|
||||
var selected_id = $(this).prev().find('select').val();
|
||||
var select_model = $(this).prev().find('select').attr('for');
|
||||
if(selected_id!="false"){
|
||||
if(!$('[id^="oe_form_'+selected_id+select_model+'"]').html()){
|
||||
$('<div id="oe_form_'+selected_id+select_model+'" data-role="page" data-url="oe_form_'+selected_id+select_model+'"> </div>').appendTo('#moe');
|
||||
this.formview = new openerp.web_mobile.FormView(self, "oe_form_"+selected_id+select_model, selected_id, '', head, select_model, false);
|
||||
this.formview.start();
|
||||
}else{
|
||||
$.mobile.changePage('#oe_form_'+selected_id+select_model, "slide", false, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
$.mobile.changePage('#oe_form_'+listid+result.fields[relational].relation, "slide", false, true);
|
||||
}
|
||||
$('[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' }));
|
||||
$('[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);
|
||||
});
|
||||
$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').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_form_'+listid+result.fields[relational].relation, "slide", false, true);
|
||||
$.mobile.changePage("#oe_shortcuts", "slide", false, true);
|
||||
}
|
||||
});
|
||||
});
|
||||
$.mobile.changePage("#oe_list_"+relational+"_"+self.element_id, "slide", false, true);
|
||||
}else{
|
||||
$.mobile.changePage("#oe_list_"+relational+"_"+self.element_id, "slide", false, true);
|
||||
}
|
||||
$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').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);
|
||||
}
|
||||
});
|
||||
$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').find('#formbutton').click(function(){
|
||||
var head = $(this).prev().find('select').find("option:selected").text();
|
||||
var selected_id = $(this).prev().find('select').val();
|
||||
var select_model = $(this).prev().find('select').attr('for');
|
||||
if(selected_id!="false"){
|
||||
if(!$('[id^="oe_form_'+selected_id+select_model+'"]').html()){
|
||||
$('<div id="oe_form_'+selected_id+select_model+'" data-role="page" data-url="oe_form_'+selected_id+select_model+'"> </div>').appendTo('#moe');
|
||||
this.formview = new openerp.web_mobile.FormView(self, "oe_form_"+selected_id+select_model, selected_id, '', head, select_model, false);
|
||||
this.formview.start();
|
||||
}else{
|
||||
$.mobile.changePage('#oe_form_'+selected_id+select_model, "slide", false, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
$.mobile.changePage('#oe_form_'+listid+result.fields[relational].relation, "slide", false, true);
|
||||
}else{
|
||||
$.mobile.changePage('#oe_form_'+listid+result.fields[relational].relation, "slide", false, true);
|
||||
}
|
||||
});
|
||||
});
|
||||
$.mobile.changePage("#oe_list_"+relational+"_"+self.element_id, "slide", false, true);
|
||||
}else{
|
||||
$.mobile.changePage("#oe_list_"+relational+"_"+self.element_id, "slide", false, true);
|
||||
}
|
||||
});
|
||||
$.mobile.changePage("#"+self.element_id, "slide", false, true);
|
||||
}
|
||||
});
|
||||
$.mobile.changePage("#"+self.element_id, "slide", false, true);
|
||||
},
|
||||
get_fields: function(view_fields, fields) {
|
||||
this.fields = fields || [];
|
||||
|
|
Loading…
Reference in New Issue