12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- (function() {
- openerp.widgetInstanceInterestInvoiceVerifyState = null;
- openerp.parentInstanceInterestInvoiceVerifyState = {};
- var QWeb = openerp.web.qweb;
- var instanceWeb = openerp.web;
- openerp.VerifyInterestInvoiceVerifyState = openerp.Widget.extend({
- template: 'verifyInterestInvoice.Status',
- buttons: undefined,
- accountInvoice: [],
- insteresConfig: [],
- /* init */
- init: function(parent) {
- this._super(parent);
- this.buttons = parent.$buttons;
- },
- start: function () {
- var self = this;
- this.$el.click(function(){
- self.fetchInitial();
- });
- },
- /* Reload Page*/
- reloadPage: function() {
- openerp.parentInstanceInterestInvoiceVerifyState.reload();
- },
- // /* Método inicial */
- fetchInitial: function() {
- var self = this;
- self.verifyInvoiceState().then(function(accountInvoice){
- return accountInvoice;
- }).then(function(accountInvoice) {
- self.accountInvoice = accountInvoice;
- instanceWeb.notification.do_warn("Atencion","Verificación Terminada.");
- return self.reloadPage();
- });
- },
- /* Verificar Estado de las factura */
- verifyInvoiceState: function() {
- var invoice = new instanceWeb.Model('account.invoice');
- return invoice.call('eiru_invoice_verify_status',{
- context: new instanceWeb.CompoundContext()
- });
- }
- });
- if (openerp.web && openerp.web.FormView) {
- openerp.web.FormView.include({
- load_record: function(record) {
- this._super.apply(this, arguments);
- if (this.model !== 'account.interest.config')
- return;
- openerp.parentInstanceInterestInvoiceVerifyState = this;
- if (openerp.widgetInstanceInterestInvoiceVerifyState) {
- if (this.$el.find('.button-invoice-state').length !== 0)
- return;
- }
- if (this.$el.find('.button-invoice-state').length !== 0)
- return;
- openerp.widgetInstanceInterestInvoiceVerifyState = new openerp.VerifyInterestInvoiceVerifyState(this);
- var element =this.$el.find('.oe_form').find('.verify-interest-invoice-state');
- openerp.widgetInstanceInterestInvoiceVerifyState.appendTo(element[0]);
- }
- });
- }
- })();
|