summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorMartin Trigaux <mat@openerp.com>2014-06-26 15:31:55 +0200
committerMartin Trigaux <mat@openerp.com>2014-06-26 15:31:55 +0200
commit9404ab4cfbfdb0cfdfe7ef8eb18d968e4cc7210d (patch)
tree43ad202d37d823352a30fb04a40ad52bc9422c8a /addons
parent22e99755bb1dc75a50c15248b4784f2f7116d836 (diff)
[FIX] hr_timesheet_sheet: accept custom fields in timesheets
When creating hr.analytic.timesheet do not filter the list of fields to accept but set the list of fields to remove.
Diffstat (limited to 'addons')
-rw-r--r--addons/hr_timesheet_sheet/static/src/js/timesheet.js16
1 files changed, 6 insertions, 10 deletions
diff --git a/addons/hr_timesheet_sheet/static/src/js/timesheet.js b/addons/hr_timesheet_sheet/static/src/js/timesheet.js
index c7afd62c8ab..ef1e2f17145 100644
--- a/addons/hr_timesheet_sheet/static/src/js/timesheet.js
+++ b/addons/hr_timesheet_sheet/static/src/js/timesheet.js
@@ -7,6 +7,9 @@ openerp.hr_timesheet_sheet = function(instance) {
events: {
"click .oe_timesheet_weekly_account a": "go_to",
},
+ ignore_fields: function() {
+ return ['line_id'];
+ },
init: function() {
this._super.apply(this, arguments);
var self = this;
@@ -323,11 +326,8 @@ openerp.hr_timesheet_sheet = function(instance) {
generate_o2m_value: function() {
var self = this;
var ops = [];
-
+ var ignored_fields = self.ignore_fields();
_.each(self.accounts, function(account) {
- var auth_keys = _.extend(_.clone(account.account_defaults), {
- name: true, amount:true, unit_amount: true, date: true, account_id:true,
- });
_.each(account.days, function(day) {
_.each(day.lines, function(line) {
if (line.unit_amount !== 0) {
@@ -338,12 +338,8 @@ openerp.hr_timesheet_sheet = function(instance) {
tmp[k] = v[0];
}
});
- // we have to remove some keys, because analytic lines are shitty
- _.each(_.keys(tmp), function(key) {
- if (auth_keys[key] === undefined) {
- tmp[key] = undefined;
- }
- });
+ // we remove line_id as the reference to the _inherits field will no longer exists
+ tmp = _.omit(tmp, ignored_fields);
ops.push(tmp);
}
});