[IMP] factorize view/load part2 addons

bzr revid: al@openerp.com-20110906230859-qip1rc83y50w5g3j
master
Antony Lesuisse 11 years ago
parent 02792660b8
commit d57d2fcc0d
  1. 1
      addons/web_calendar/__init__.py
  2. 1
      addons/web_calendar/controllers/__init__.py
  3. 11
      addons/web_calendar/controllers/main.py
  4. 6
      addons/web_calendar/static/src/js/calendar.js
  5. 1
      addons/web_gantt/__init__.py
  6. 1
      addons/web_gantt/controllers/__init__.py
  7. 11
      addons/web_gantt/controllers/main.py
  8. 5
      addons/web_gantt/static/src/js/gantt.js
  9. 1
      addons/web_kanban/__init__.py
  10. 1
      addons/web_kanban/controllers/__init__.py
  11. 11
      addons/web_kanban/controllers/main.py
  12. 5
      addons/web_kanban/static/src/js/kanban.js

@ -1,2 +1 @@
#!/usr/bin/python
import controllers

@ -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 = {};
},
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() {
scheduler.clearAll();
},
on_loaded: function(data) {
this.fields_view = data;
this.calendar_fields = {};
this.ids = this.dataset.ids;
this.color_values = [];
this.info_fields = [];
this.fields_view = data.fields_view;
this.name = this.fields_view.name || this.fields_view.arch.attrs.string;
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.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.add_toolbar(data.fields_view.toolbar);
this.sidebar.add_toolbar(this.fields_view.toolbar);
this.set_common_sidebar_sections(this.sidebar);
this.sidebar.do_unfold();
this.sidebar.do_fold.add_last(this.refresh_scheduler);

@ -1,2 +1 @@
#!/usr/bin/python
import controllers

@ -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() {
this.rpc("/web_gantt/ganttview/load",
{"model": this.model, "view_id": this.view_id}, this.on_loaded);
this.rpc("/web/view/load", {"model": this.model, "view_id": this.view_id, "view_type": "gantt"}, this.on_loaded);
},
on_loaded: function(data) {
var self = this;
this.fields_view = data.fields_view;
this.fields_view = data;
this.name = this.fields_view.arch.attrs.string;
this.view_id = this.fields_view.view_id;

@ -1 +0,0 @@
import controllers

@ -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();
},
start: function() {
return this.rpc("/web_kanban/kanbanview/load",
{"model": this.model, "view_id": this.view_id}, this.on_loaded);
return this.rpc("/web/view/load", {"model": this.model, "view_id": this.view_id, "view_type": "kanban"}, this.on_loaded);
},
on_loaded: function(data) {
var self = this;
this.fields_view = data.fields_view;
this.fields_view = data;
this.add_qweb_template();
if (this.qweb.has_template('kanban-box')) {
self.dataset.read_slice(_.keys(self.fields_view.fields), {

Loading…
Cancel
Save