From 7234ef203cf0283939f86175509acf27c3fbc898 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 1 Oct 2012 16:55:16 +0200 Subject: [PATCH] Added sync with o2m bzr revid: nicolas.vanhoren@openerp.com-20121001145516-x2bidvidn0fswi4u --- .../static/src/js/timesheet.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/addons/hr_timesheet_sheet/static/src/js/timesheet.js b/addons/hr_timesheet_sheet/static/src/js/timesheet.js index 125cea17c8f..1cde7a80a90 100644 --- a/addons/hr_timesheet_sheet/static/src/js/timesheet.js +++ b/addons/hr_timesheet_sheet/static/src/js/timesheet.js @@ -123,6 +123,7 @@ openerp.hr_timesheet_sheet = function(instance) { } else { 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.sync(); } }); }); @@ -151,6 +152,24 @@ openerp.hr_timesheet_sheet = function(instance) { }); 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');