update module with inherit mode
This commit is contained in:
parent
fb547f0f4d
commit
5e59ad27ae
|
@ -5,9 +5,9 @@
|
|||
'author': 'SunArc Technologies',
|
||||
'website': 'www.sunarctechnologies.com',
|
||||
'license': 'LGPL-3',
|
||||
'depends': ['base','web'],
|
||||
'depends': ['base','web' ,'hr_timesheet'],
|
||||
'data': [
|
||||
'views/templates.xml'
|
||||
'views/templates.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
odoo.define('month_filter.ModeExtension', function (require) {
|
||||
"use strict";
|
||||
const components = {
|
||||
ControlPanelModelExtension: require("web/static/src/js/control_panel/control_panel_model_extension.js"),
|
||||
};
|
||||
const { patch } = require("web.utils");
|
||||
const Domain = require('web.Domain');
|
||||
const pyUtils = require('web.py_utils');
|
||||
|
||||
const { DEFAULT_INTERVAL, DEFAULT_PERIOD,
|
||||
getComparisonOptions, getIntervalOptions, getPeriodOptions,
|
||||
constructDateDomain, rankInterval, yearSelected } = require('month_filter.searchUtils');
|
||||
|
||||
patch(
|
||||
components.ControlPanelModelExtension,
|
||||
"month_filter/static/src/js/control_panel/control_panel_custom_extension.js",
|
||||
{
|
||||
toggleFilterWithOptions(filterId, optionId) {
|
||||
this.referenceMoment = moment();
|
||||
this.optionGenerators = getPeriodOptions(this.referenceMoment);
|
||||
return this._super(filterId, optionId);
|
||||
},
|
||||
_enrichFilterCopy(filter, filterQueryElements) {
|
||||
this.referenceMoment = moment();
|
||||
this.optionGenerators = getPeriodOptions(this.referenceMoment);
|
||||
return this._super(filter, filterQueryElements);
|
||||
},
|
||||
_getDateFilterDomain(filter, filterQueryElements, key = 'domain') {
|
||||
const { fieldName, fieldType } = filter;
|
||||
const selectedOptionIds = filterQueryElements.map(queryElem => queryElem.optionId);
|
||||
|
||||
const dateFilterRange = constructDateDomain(
|
||||
this.referenceMoment, fieldName, fieldType, selectedOptionIds,
|
||||
);
|
||||
return dateFilterRange[key];
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
|
@ -1,4 +1,4 @@
|
|||
odoo.define('web.searchUtils', function (require) {
|
||||
odoo.define('month_filter.searchUtils', function (require) {
|
||||
"use strict";
|
||||
|
||||
const { _lt, _t } = require('web.core');
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<template id="filter_extend_assets" inherit_id="web.assets_backend">
|
||||
<xpath expr="." position="inside">
|
||||
<script type="text/javascript" src="/month_filter/static/src/js/control_panel/custom_search_utils.js"/>
|
||||
<script type="text/javascript" src="/month_filter/static/src/js/control_panel/control_panel_custom_extension.js"/>
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
Loading…
Reference in New Issue