Is there a way to define minTime/maxTime/slotDuration of fullCalendar in odoo System Parameters and then java will get those values and set Calendar to it? i.e. Set 3 system parameters (StartTime, StopTime and SlotDuration) and call those values.
I have this: (thanks to @Jigar Patel)
odoo.define('anser_ricardo', function(require){
"use strict";
var CalendarModel = require('web.CalendarModel');
CalendarModel.include({
_getFullCalendarOptions: function(){
var res = this._super.apply(this, arguments);
return _.extend(res, {
minTime: '08:00:00',
maxTime: '22:00:00',
slotDuration: '00:10:00',
});
},
});
});
And i've created 3 system parameters:
<record id='start_time_key' model='ir.config_parameter'>
<field name='key'>start_time_key</field>
<field name='value'>08:00:00</field>
</record>
<record id='stop_time_key' model='ir.config_parameter'>
<field name='key'>stop_time_key</field>
<field name='value'>22:00:00</field>
</record>
<record id='slotDuration_time_key' model='ir.config_parameter'>
<field name='key'>slotDuration_time_key</field>
<field name='value'>00:10:00</field>
</record>
I need to get values for minTime/maxTime/slotDuration and not to define like this.
Something like this:
return _.extend(res, {
minTime: get.start_time_key,
maxTime: get.stop_time_key,
slotDuration: get.slotDuration_time_key,
Can anyone help? Thanks!
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
1
Trả lời
6847
Lượt xem
Hello Rick,
I have not tested it. But it may work and help you a lot.
If you want to get performance then you can make one python method rather then RPC batch in js.
odoo.define('anser_ricardo', function (require) {
"use strict";
var CalendarModel = require('web.CalendarModel');
CalendarModel.include({
_getFullCalendarOptions: function () {
var res = this._super.apply(this, arguments);
return _.extend(res, {
minTime: this.custom_fc_options.start_time_key,
maxTime: this.custom_fc_options.stop_time_key,
slotDuration: this.custom_fc_options.slotDuration_time_key,
});
},
_loadCalendar: function () {
var self = this;
var args = arguments;
var sup = this._super;
var defs = [];
this.custom_fc_options = {};
_.each(['start_time_key', 'stop_time_key', 'slotDuration_time_key], function (param) {
var def = self._rpc({
model: 'ir.config_parameter',
method: 'get_param',
args: [param]
}).then(function (res) {
self.custom_fc_options[param] = res;
});
defs.push(def);
});
return $.when.apply($, defs).then(function () {
return sup.apply(self, args);
});
},
});
});
it works perfectly! Thank you so much!
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
1
thg 7 19
|
3866 | ||
|
1
thg 5 21
|
2529 | ||
|
1
thg 7 20
|
4927 | ||
|
1
thg 9 22
|
10376 | ||
|
0
thg 8 19
|
2922 |