|
@@ -2,21 +2,64 @@ openerp.eiru_quota_analysis = function (instance, local) {
|
|
|
local.widgetInstance = null;
|
|
|
local.parentInstance = null;
|
|
|
var model = openerp;
|
|
|
+
|
|
|
local.EiruQuotaAnalysisWidget = instance.Widget.extend({
|
|
|
template : "eiru_quota_analysis.EiruQuotaAnalysis",
|
|
|
- checkQuota: function(id) {
|
|
|
- var self = this;
|
|
|
- self.Initial();
|
|
|
+ id: undefined,
|
|
|
+
|
|
|
+ init: function(parent) {
|
|
|
+ this._super(parent);
|
|
|
+ this.buttons = parent.$buttons;
|
|
|
},
|
|
|
+
|
|
|
start: function () {
|
|
|
var self = this;
|
|
|
var table = $('#quota_table');
|
|
|
table.bootstrapTable({data : self.rowsData});
|
|
|
+
|
|
|
+ /* Click Imprimir */
|
|
|
+ bottomPrint = this.$el.find('.button-quota-print');
|
|
|
+ bottomPrint.click(function(){
|
|
|
+ console.log("Porrrra");
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /*
|
|
|
+ start: function() {
|
|
|
+ var self = this;
|
|
|
+
|
|
|
+ this.$el.click(function(){
|
|
|
+ self.fectchInitial()
|
|
|
+ });
|
|
|
+ self.buttons.click(function(e) {
|
|
|
+ E (Editar)
|
|
|
+ if (e.target.accessKey === 'E')
|
|
|
+ self.$el.css('display','none');
|
|
|
+ // S (Guarrdar)
|
|
|
+ if (e.target.accessKey === 'S')
|
|
|
+ self.$el.css('display','flex');
|
|
|
+ // D (Cancelar)
|
|
|
+ if (e.target.accessKey === 'D')
|
|
|
+ self.$el.css('display','flex');
|
|
|
+ // CREAR
|
|
|
+ if (e.target.accessKey === 'C')
|
|
|
+ self.$el.css('display','none');
|
|
|
+ });
|
|
|
+ },
|
|
|
+ */
|
|
|
+
|
|
|
+ /*
|
|
|
+ checkQuota: function(id) {
|
|
|
+ var self = this;
|
|
|
+ self.Initial();
|
|
|
},
|
|
|
+ */
|
|
|
+ /* */
|
|
|
updateId : function(id){
|
|
|
var self = this;
|
|
|
self.id = id;
|
|
|
+ self.Initial();
|
|
|
},
|
|
|
+
|
|
|
Initial: function(){
|
|
|
var self = this;
|
|
|
self.fetchAccountInvoice().then(function (AccountInvoice){
|
|
@@ -52,7 +95,6 @@ openerp.eiru_quota_analysis = function (instance, local) {
|
|
|
},
|
|
|
build: function(){
|
|
|
var self = this;
|
|
|
- console.log(self);
|
|
|
var data = [];
|
|
|
var state = '';
|
|
|
var date = '';
|
|
@@ -86,25 +128,33 @@ openerp.eiru_quota_analysis = function (instance, local) {
|
|
|
table.bootstrapTable('load', rowsTable);
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
if (instance.web && instance.web.FormView) {
|
|
|
instance.web.FormView.include({
|
|
|
load_record: function (record) {
|
|
|
this._super.apply(this, arguments);
|
|
|
+
|
|
|
if (this.model !== 'account.invoice')
|
|
|
return;
|
|
|
|
|
|
local.parentInstance = this;
|
|
|
+
|
|
|
if (local.widgetInstance) {
|
|
|
local.widgetInstance.updateId(record.id);
|
|
|
- local.widgetInstance.checkQuota(record.id);
|
|
|
- return;
|
|
|
+ if (this.$el.find('.eiru-quota-table').length !== 0){
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ if (this.$el.find('.eiru-quota-table').length !== 0){
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
local.widgetInstance = new local.EiruQuotaAnalysisWidget(this);
|
|
|
var elemento = this.$el.find('.oe_form_sheet.oe_form_sheet_width');
|
|
|
elemento = elemento.find('.quota_box');
|
|
|
local.widgetInstance.appendTo(elemento);
|
|
|
local.widgetInstance.updateId(record.id);
|
|
|
- local.widgetInstance.checkQuota(record.id);
|
|
|
}
|
|
|
});
|
|
|
}
|