wip
bzr revid: nicolas.vanhoren@openerp.com-20120928150815-1lm5bezg4uhj0stk
This commit is contained in:
@@ -7,8 +7,18 @@ openerp.hr_timesheet_sheet = function(instance) {
|
||||
template: "hr_timesheet_sheet.WeeklyTimesheet",
|
||||
init: function() {
|
||||
this._super.apply(this, arguments);
|
||||
this.set({sheets: []});
|
||||
this.set({
|
||||
sheets: [],
|
||||
date_to: false,
|
||||
date_from: false,
|
||||
});
|
||||
this.field_manager.on("field_changed:timesheet_ids", this, this.query_sheets);
|
||||
this.field_manager.on("field_changed:date_from", this, function() {
|
||||
this.set({"date_from": instance.web.str_to_date(this.field_manager.get_field_value("date_from"))});
|
||||
});
|
||||
this.field_manager.on("field_changed:date_to", this, function() {
|
||||
this.set({"date_to": instance.web.str_to_date(this.field_manager.get_field_value("date_to"))});
|
||||
});
|
||||
this.on("change:sheets", this, this.update_sheets);
|
||||
this.res_o2m_drop = new instance.web.DropMisordered();
|
||||
},
|
||||
@@ -34,7 +44,24 @@ openerp.hr_timesheet_sheet = function(instance) {
|
||||
});
|
||||
},
|
||||
start: function() {
|
||||
|
||||
this.on("change:sheets", this, this.render);
|
||||
this.on("change:date_to", this, this.render);
|
||||
this.on("change:date_from", this, this.render);
|
||||
this.render();
|
||||
},
|
||||
render: function() {
|
||||
var self = this;
|
||||
if (self.setting)
|
||||
return;
|
||||
// don't render anything until we have date_to and date_from
|
||||
if (!self.get("date_to") || !self.get("date_from"))
|
||||
return;
|
||||
// group by account
|
||||
var accounts = _.groupBy(this.get("sheets"), function(el) { return !!el.account_id ? el.account_id[0] : false });
|
||||
// group by days
|
||||
accounts = _.map(accounts, function(el) {
|
||||
//var tmp = _.groupBy(el
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user