diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
| commit | 3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch) | |
| tree | a44932296ef4a9b71d5f010906253d8c53727726 /addons/hr_timesheet/static/src/js/task_with_hours.js | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/hr_timesheet/static/src/js/task_with_hours.js')
| -rw-r--r-- | addons/hr_timesheet/static/src/js/task_with_hours.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/addons/hr_timesheet/static/src/js/task_with_hours.js b/addons/hr_timesheet/static/src/js/task_with_hours.js new file mode 100644 index 00000000..d2ed5a64 --- /dev/null +++ b/addons/hr_timesheet/static/src/js/task_with_hours.js @@ -0,0 +1,36 @@ +odoo.define('hr_timesheet.task_with_hours', function (require) { +"use strict"; + +var field_registry = require('web.field_registry'); +var relational_fields = require('web.relational_fields'); +var FieldMany2One = relational_fields.FieldMany2One; + +var TaskWithHours = FieldMany2One.extend({ + /** + * @override + */ + init: function () { + this._super.apply(this, arguments); + this.additionalContext.hr_timesheet_display_remaining_hours = true; + }, + /** + * @override + */ + _getDisplayNameWithoutHours: function (value) { + return value.split(' ‒ ')[0]; + }, + /** + * @override + * @private + */ + _renderEdit: function (){ + this.m2o_value = this._getDisplayNameWithoutHours(this.m2o_value); + this._super.apply(this, arguments); + }, +}); + +field_registry.add('task_with_hours', TaskWithHours); + +return TaskWithHours; + +});
\ No newline at end of file |
