浏览代码

[ADD] Print Move Invoice

adrielso 5 年之前
父节点
当前提交
573ea08e69
共有 3 个文件被更改,包括 67 次插入14 次删除
  1. 2 1
      __openerp__.py
  2. 57 7
      static/src/js/main.js
  3. 8 6
      static/src/xml/view.xml

+ 2 - 1
__openerp__.py

@@ -4,10 +4,11 @@
     'version' : '1.0',
     'description' : """
     """,
-    'author' : 'Eiru',
+    'author' : 'Eiru / Adrielso kunert',
     'category' : 'account',
     'depends' : [
         'account',
+        'eiru_account_interest',
     ],
     'data' : [
         'views/template.xml',

+ 57 - 7
static/src/js/main.js

@@ -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);
             }
         });
     }

+ 8 - 6
static/src/xml/view.xml

@@ -1,13 +1,15 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <template xml:space="preserve">
     <t t-name="eiru_quota_analysis.EiruQuotaAnalysis">
-        <br/>
+        <!-- <br/> -->
         <div class="eiru-quota-table">
-            <table id="quota_table"
-                data-toggle="table"
-                data-classes="table table-condensed"
-                data-undefined-text=" "
-                >
+            <!-- Button -->
+            <button class="button-quota-print oe_stat_button btn btn_default">
+                <div class="stat_button_icon fa fa-tasks"></div>
+                <div class="add-button-task">Imprimir</div>
+            </button>
+            <!-- Table -->
+            <table id="quota_table" data-toggle="table" data-classes="table table-condensed" data-undefined-text=" ">
                 <thead style="background:none;">
                     <tr>
                         <th data-field="date" data-align="left">Fecha de vencimiento</th>