[REF] Removing the quick create overriding for hr_holiday - that was a test/sample not used
bzr revid: jke@openerp.com-20140113174701-nmvtarylf19d63nx
This commit is contained in:
parent
c5791441c4
commit
5626a5a391
|
@ -42,7 +42,7 @@
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<calendar string="Leave Request" color="employee_id"
|
<calendar string="Leave Request" color="employee_id"
|
||||||
date_start="date_from" date_stop="date_to"
|
date_start="date_from" date_stop="date_to"
|
||||||
quick_add="False" avatar_model="hr.employee"> <!--quick_create_instance="hr_holidays.QuickCreate"> -->
|
quick_add="False" avatar_model="hr.employee">
|
||||||
<field name="employee_id"/>
|
<field name="employee_id"/>
|
||||||
<field name="holiday_status_id"/>
|
<field name="holiday_status_id"/>
|
||||||
</calendar>
|
</calendar>
|
||||||
|
|
|
@ -1,83 +0,0 @@
|
||||||
openerp.hr_holidays = function(instance) {
|
|
||||||
var _t = instance.web._t;
|
|
||||||
var QWeb = instance.web.qweb;
|
|
||||||
instance.hr_holidays = {}
|
|
||||||
/**
|
|
||||||
* Quick creation view.
|
|
||||||
*
|
|
||||||
* Triggers a single event "added" with a single parameter "name", which is the
|
|
||||||
* name entered by the user
|
|
||||||
*
|
|
||||||
* @class
|
|
||||||
* @type {*}
|
|
||||||
*/
|
|
||||||
instance.hr_holidays.QuickCreate = instance.web_calendar.QuickCreate.extend({
|
|
||||||
template: 'hr_holidays.QuickCreate',
|
|
||||||
|
|
||||||
/**
|
|
||||||
* close_btn: If true, the widget will display a "Close" button able to trigger
|
|
||||||
* a "close" event.
|
|
||||||
*/
|
|
||||||
init: function(parent, dataset, buttons, options, data_template) {
|
|
||||||
this._super(parent);
|
|
||||||
|
|
||||||
this.dataset = dataset;
|
|
||||||
this._buttons = buttons || false;
|
|
||||||
this.options = options;
|
|
||||||
|
|
||||||
//this.options.disable_quick_create = true;
|
|
||||||
|
|
||||||
// Can hold data pre-set from where you clicked on agenda
|
|
||||||
this.data_template = data_template || {};
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
start: function() {
|
|
||||||
var self=this;
|
|
||||||
this._super();
|
|
||||||
|
|
||||||
new instance.web.Model("hr.holidays.status").query(["name"]).filter([["active", "=",true]]).all().then(function(result) {
|
|
||||||
var holidays_status = {};
|
|
||||||
|
|
||||||
_.each(result, function(item) {
|
|
||||||
var filter_item = {
|
|
||||||
value: item.id,
|
|
||||||
label: item.name,
|
|
||||||
};
|
|
||||||
holidays_status[item.id] = filter_item;
|
|
||||||
});
|
|
||||||
|
|
||||||
var optionType = QWeb.render('hr_holidays.QuickCreate.select', { elements: holidays_status });
|
|
||||||
console.log(optionType);
|
|
||||||
$(".qc_type").html(optionType);
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
focus: function() {
|
|
||||||
this.$el.find('input').focus();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gathers data from the quick create dialog a launch quick_create(data) method
|
|
||||||
*/
|
|
||||||
quick_add: function() {
|
|
||||||
var name = this.$el.find(".qc_name").val();
|
|
||||||
var type = this.$el.find(".qc_type").val();
|
|
||||||
|
|
||||||
if (/^\s*$/.test(name)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return this.quick_create({'name': name,'holiday_status_id':parseInt(type)}).always(function() { return true; });
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
slow_add: function() {
|
|
||||||
var name = this.$el.find(".qc_name").val();
|
|
||||||
var type = this.$el.find(".qc_type").val();
|
|
||||||
this.slow_create({'name': name,'holiday_status_id':parseInt(type)});
|
|
||||||
},
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
|
|
@ -1,25 +0,0 @@
|
||||||
<template>
|
|
||||||
<div t-name="hr_holidays.QuickCreate" class="oe_calendar_quick_create openerp">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for='name' class=' control-label'>Description:</label>
|
|
||||||
<input name='name' class=" qc_name form-control"/>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for='holiday_status_id' class=' control-label'>Type:</label>
|
|
||||||
<select name='holiday_status_id' class="qc_type form-control"></select>
|
|
||||||
</div>
|
|
||||||
<t t-if="widget._buttons">
|
|
||||||
<div class="oe_calendar_quick_create_buttons">
|
|
||||||
<button class="oe_button oe_calendar_quick_create_add ">Add</button>
|
|
||||||
<button class="oe_button oe_link oe_calendar_quick_create_edit "><span>Edit</span></button>
|
|
||||||
</div>
|
|
||||||
</t>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<t t-name="hr_holidays.QuickCreate.select">
|
|
||||||
<div t-foreach="elements" class="oe_calendar_responsible" >
|
|
||||||
<option t-att-value="elements_value.value"> <t t-esc="elements_value.label" /> </option>
|
|
||||||
</div>
|
|
||||||
</t>
|
|
||||||
|
|
||||||
</template>
|
|
Loading…
Reference in New Issue