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');