[IMP] factorize view/load part2 addons
bzr revid: al@openerp.com-20110906230859-qip1rc83y50w5g3j
This commit is contained in:
parent
02792660b8
commit
d57d2fcc0d
|
@ -1,2 +1 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import controllers
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
import main
|
|
|
@ -1,11 +0,0 @@
|
||||||
import web.common as openerpweb
|
|
||||||
|
|
||||||
from web.controllers.main import View
|
|
||||||
|
|
||||||
class CalendarView(View):
|
|
||||||
_cp_path = "/web_calendar/calendarview"
|
|
||||||
|
|
||||||
@openerpweb.jsonrequest
|
|
||||||
def load(self, req, model, view_id, toolbar=False):
|
|
||||||
fields_view = self.fields_view_get(req, model, view_id, 'calendar', toolbar=toolbar)
|
|
||||||
return {'fields_view': fields_view}
|
|
|
@ -29,18 +29,18 @@ openerp.web_calendar.CalendarView = openerp.web.View.extend({
|
||||||
this.color_map = {};
|
this.color_map = {};
|
||||||
},
|
},
|
||||||
start: function() {
|
start: function() {
|
||||||
this.rpc("/web_calendar/calendarview/load", {"model": this.model, "view_id": this.view_id, 'toolbar': true}, this.on_loaded);
|
this.rpc("/web/view/load", {"model": this.model, "view_id": this.view_id, "view_type":"calendar", 'toolbar': true}, this.on_loaded);
|
||||||
},
|
},
|
||||||
stop: function() {
|
stop: function() {
|
||||||
scheduler.clearAll();
|
scheduler.clearAll();
|
||||||
},
|
},
|
||||||
on_loaded: function(data) {
|
on_loaded: function(data) {
|
||||||
|
this.fields_view = data;
|
||||||
this.calendar_fields = {};
|
this.calendar_fields = {};
|
||||||
this.ids = this.dataset.ids;
|
this.ids = this.dataset.ids;
|
||||||
this.color_values = [];
|
this.color_values = [];
|
||||||
this.info_fields = [];
|
this.info_fields = [];
|
||||||
|
|
||||||
this.fields_view = data.fields_view;
|
|
||||||
this.name = this.fields_view.name || this.fields_view.arch.attrs.string;
|
this.name = this.fields_view.name || this.fields_view.arch.attrs.string;
|
||||||
this.view_id = this.fields_view.view_id;
|
this.view_id = this.fields_view.view_id;
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ openerp.web_calendar.CalendarView = openerp.web.View.extend({
|
||||||
this.sidebar.start();
|
this.sidebar.start();
|
||||||
this.sidebar.navigator = new openerp.web_calendar.SidebarNavigator(this.sidebar, this.sidebar.add_section('navigator', "Navigator"), this);
|
this.sidebar.navigator = new openerp.web_calendar.SidebarNavigator(this.sidebar, this.sidebar.add_section('navigator', "Navigator"), this);
|
||||||
this.sidebar.responsible = new openerp.web_calendar.SidebarResponsible(this.sidebar, this.sidebar.add_section('responsible', "Responsible"), this);
|
this.sidebar.responsible = new openerp.web_calendar.SidebarResponsible(this.sidebar, this.sidebar.add_section('responsible', "Responsible"), this);
|
||||||
this.sidebar.add_toolbar(data.fields_view.toolbar);
|
this.sidebar.add_toolbar(this.fields_view.toolbar);
|
||||||
this.set_common_sidebar_sections(this.sidebar);
|
this.set_common_sidebar_sections(this.sidebar);
|
||||||
this.sidebar.do_unfold();
|
this.sidebar.do_unfold();
|
||||||
this.sidebar.do_fold.add_last(this.refresh_scheduler);
|
this.sidebar.do_fold.add_last(this.refresh_scheduler);
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import controllers
|
|
|
@ -1 +0,0 @@
|
||||||
import main
|
|
|
@ -1,11 +0,0 @@
|
||||||
import web.common as openerpweb
|
|
||||||
from web.controllers.main import View
|
|
||||||
|
|
||||||
class GanttView(View):
|
|
||||||
_cp_path = "/web_gantt/ganttview"
|
|
||||||
|
|
||||||
@openerpweb.jsonrequest
|
|
||||||
def load(self, req, model, view_id):
|
|
||||||
fields_view = self.fields_view_get(req, model, view_id, 'gantt')
|
|
||||||
return {'fields_view':fields_view}
|
|
||||||
|
|
|
@ -31,14 +31,13 @@ init: function(parent, element_id, dataset, view_id) {
|
||||||
},
|
},
|
||||||
|
|
||||||
start: function() {
|
start: function() {
|
||||||
this.rpc("/web_gantt/ganttview/load",
|
this.rpc("/web/view/load", {"model": this.model, "view_id": this.view_id, "view_type": "gantt"}, this.on_loaded);
|
||||||
{"model": this.model, "view_id": this.view_id}, this.on_loaded);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
on_loaded: function(data) {
|
on_loaded: function(data) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
this.fields_view = data.fields_view;
|
this.fields_view = data;
|
||||||
|
|
||||||
this.name = this.fields_view.arch.attrs.string;
|
this.name = this.fields_view.arch.attrs.string;
|
||||||
this.view_id = this.fields_view.view_id;
|
this.view_id = this.fields_view.view_id;
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
import controllers
|
|
|
@ -1 +0,0 @@
|
||||||
import main
|
|
|
@ -1,11 +0,0 @@
|
||||||
import web.common as openerpweb
|
|
||||||
|
|
||||||
from web.controllers.main import View
|
|
||||||
|
|
||||||
class KanbanView(View):
|
|
||||||
_cp_path = "/web_kanban/kanbanview"
|
|
||||||
|
|
||||||
@openerpweb.jsonrequest
|
|
||||||
def load(self, req, model, view_id):
|
|
||||||
fields_view = self.fields_view_get(req, model, view_id, 'kanban')
|
|
||||||
return {'fields_view': fields_view}
|
|
|
@ -19,12 +19,11 @@ openerp.web_kanban.KanbanView = openerp.web.View.extend({
|
||||||
this.qweb = new QWeb2.Engine();
|
this.qweb = new QWeb2.Engine();
|
||||||
},
|
},
|
||||||
start: function() {
|
start: function() {
|
||||||
return this.rpc("/web_kanban/kanbanview/load",
|
return this.rpc("/web/view/load", {"model": this.model, "view_id": this.view_id, "view_type": "kanban"}, this.on_loaded);
|
||||||
{"model": this.model, "view_id": this.view_id}, this.on_loaded);
|
|
||||||
},
|
},
|
||||||
on_loaded: function(data) {
|
on_loaded: function(data) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.fields_view = data.fields_view;
|
this.fields_view = data;
|
||||||
this.add_qweb_template();
|
this.add_qweb_template();
|
||||||
if (this.qweb.has_template('kanban-box')) {
|
if (this.qweb.has_template('kanban-box')) {
|
||||||
self.dataset.read_slice(_.keys(self.fields_view.fields), {
|
self.dataset.read_slice(_.keys(self.fields_view.fields), {
|
||||||
|
|
Loading…
Reference in New Issue