Added sync with o2m
bzr revid: nicolas.vanhoren@openerp.com-20121001145516-x2bidvidn0fswi4u
This commit is contained in:
parent
5441985399
commit
7234ef203c
|
@ -123,6 +123,7 @@ openerp.hr_timesheet_sheet = function(instance) {
|
||||||
} else {
|
} else {
|
||||||
account.days[day_count].lines[0].unit_amount += num - self.sum_case(account, day_count);
|
account.days[day_count].lines[0].unit_amount += num - self.sum_case(account, day_count);
|
||||||
self.get_total(account).html(self.sum_total(account));
|
self.get_total(account).html(self.sum_total(account));
|
||||||
|
self.sync();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -151,6 +152,24 @@ openerp.hr_timesheet_sheet = function(instance) {
|
||||||
});
|
});
|
||||||
return total;
|
return total;
|
||||||
},
|
},
|
||||||
|
sync: function() {
|
||||||
|
var self = this;
|
||||||
|
var lst = [];
|
||||||
|
_.each(self.accounts, function(account) {
|
||||||
|
_.each(account.days, function(day) {
|
||||||
|
_.each(day.lines, function(line) {
|
||||||
|
if (line.unit_amount != 0) {
|
||||||
|
var tmp = _.clone(line);
|
||||||
|
line.id = undefined;
|
||||||
|
lst.push(tmp);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
self.setting = true;
|
||||||
|
self.set({sheets: lst});
|
||||||
|
self.setting = false;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
instance.web.form.custom_widgets.add('weekly_timesheet', 'instance.hr_timesheet_sheet.WeeklyTimesheet');
|
instance.web.form.custom_widgets.add('weekly_timesheet', 'instance.hr_timesheet_sheet.WeeklyTimesheet');
|
||||||
|
|
Loading…
Reference in New Issue