Browse Source

[ADD] Agregado ventanas modales para mostrar cuentas a cobrar y a pagar, tambien fue eliminado dependecia de la terminal de punto de ventas

Rodney Elpidio Enciso Arias 6 năm trước cách đây
mục cha
commit
03515f0c7c

BIN
__init__.pyc


+ 1 - 1
__openerp__.py

@@ -5,7 +5,7 @@
     'website': "http://www.yourcompany.com",
     'category': 'Uncategorized',
     'version': '0.1',
-    'depends': ['base','eiru_assets','currency_utility','purchase','point_of_sale'],
+    'depends': ['base','eiru_assets','currency_utility','purchase'],
     'data': [
         'views/chart_config.xml',
         'views/res_users.xml',

BIN
models/__init__.pyc


BIN
models/chart_config.pyc


+ 95 - 3
static/src/js/widgets/widget_account_receivable.js

@@ -2,14 +2,17 @@ function widget_account_receivable(widget) {
     "use strict";
 
     var model = openerp;
+    var Qweb = openerp.web.qweb;
 
     widget.WidgetAccountReceivableWidget = widget.Base.extend({
         template: 'WidgetAccountReceivable',
+        modelId: [],
 
         events: {
             'click .today': 'showToday',
             'click .thisWeek': 'showThisWeek',
             'click .expire': 'showExpire',
+            'click .number': 'showModal', 
         },
 
         init: function (parent) {
@@ -58,6 +61,9 @@ function widget_account_receivable(widget) {
                 return self.fetchResCurrency();
             }).then(function(ResCurrency) {
                 self.ResCurrency = ResCurrency;
+                return self.fetchGetModelId();
+            }).then(function(modelId) {
+                self.modelId= modelId;
                 return self.showExpire();
             });
         },
@@ -153,6 +159,20 @@ function widget_account_receivable(widget) {
             return defer;
         },
 
+        // getModelId
+        fetchGetModelId: function() {
+            var self = this;
+            var defer = $.Deferred();
+            var irModelData = new model.web.Model('ir.model.data');
+            var getObtjectReference = irModelData.get_func('get_object_reference');
+
+            this.alive(getObtjectReference('account', 'invoice_form')).then(function(results) {
+                defer.resolve(results);
+            });
+
+            return defer;
+        },
+
         getResCurrency: function (id) {
             var self = this;
             return _.filter(self.ResCurrency,function (item) {
@@ -197,7 +217,7 @@ function widget_account_receivable(widget) {
                 });
             }
             self.$el.find('.widget-content.widget-loading').css('display','none');
-            self.$el.find('.widget-content').find('a').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
+            self.$el.find('.widget-content').find('.number').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
         },
 
         showThisWeek: function () {
@@ -214,7 +234,7 @@ function widget_account_receivable(widget) {
                 });
             }
             self.$el.find('.widget-content.widget-loading').css('display','none');
-            self.$el.find('.widget-content').find('a').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
+            self.$el.find('.widget-content').find('.number').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
         },
 
         showExpire: function () {
@@ -231,7 +251,79 @@ function widget_account_receivable(widget) {
                 });
             }
             self.$el.find('.widget-content.widget-loading').css('display','none');
-            self.$el.find('.widget-content').find('a').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
+            self.$el.find('.widget-content').find('.number').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
+        },
+
+        showModal: function (e) {
+            var self = this;
+            if (self.AccountMoveLine <=0) {
+                model.web.notification.do_warn("Atención","Sin datos");
+                return
+            }
+
+            var moneda = self.ResCurrency.shift();
+            var newmoveLine = self.AccountMoveLine;
+            var titleData = [
+                {
+                    title: "Cuentas a Cobrar"
+                }
+            ];
+            var headerModal = [
+                {
+                    title: "Cliente"
+                },
+                {
+                    title: "Numero de Factura"
+                },
+                {
+                    title: "Vencimiento"
+                },
+                {
+                    title: "Monto "
+                }
+            ];
+
+            var modal = Qweb.render('ExpiredAccountCountersModal', {
+                data: newmoveLine,
+                dataThead: headerModal,
+                modalTitle: titleData
+            });
+
+            $('.openerp_webclient_container').after(modal);
+            $('.expired-account-modal').modal()
+            $('.expired-account-modal').on('hidden.bs.modal', function (e) {
+                self.removeModal(e);
+            })
+
+            var contenido = $('.expired-account-modal').find('.table-tbody');
+            contenido.click(function (e) {
+                $(contenido).find('tr').removeClass('table-row-select');
+                $(e.target).closest('tr').addClass('table-row-select');
+                var chirdren_id =$(e.target).closest('tr').children()[0].textContent;
+                self.renderForm(chirdren_id);
+            });
+        },
+
+        removeModal: function (e) {
+            $('.expired-account-modal').remove();
+            $('.modal-backdrop').remove();
         },
+
+        renderForm: function(id){
+            var self = this;
+            id = parseInt(id);
+
+            this.do_action({
+                type: "ir.actions.act_window",
+                res_model: "account.invoice",
+                views: [[self.modelId[1], 'form']],
+                target: 'current',
+                domain: [['id', '=', id]],
+                context: {},
+                res_id: id,
+            }).then(function() {
+                self.removeModal();
+            });
+        }
     });
 }

+ 96 - 3
static/src/js/widgets/widget_account_to_pay.js

@@ -2,6 +2,7 @@ function widget_account_to_pay(widget) {
     "use strict";
 
     var model = openerp;
+    var Qweb = openerp.web.qweb;
 
     widget.WidgetAccountToPayWidget = widget.Base.extend({
         template: 'WidgetAccountToPay',
@@ -10,6 +11,7 @@ function widget_account_to_pay(widget) {
             'click .today': 'showToday',
             'click .thisWeek': 'showThisWeek',
             'click .expire': 'showExpire',
+            'click .number': 'showModal',
         },
 
         init: function (parent) {
@@ -58,6 +60,9 @@ function widget_account_to_pay(widget) {
                 return self.fetchResCurrecy();
             }).then(function(ResCurrecy) {
                 self.ResCurrecy = ResCurrecy;
+                return self.fetchGetModelId();
+            }).then(function(modelId) {
+                self.modelId= modelId;
                 return self.showExpire();
             });
         },
@@ -153,6 +158,20 @@ function widget_account_to_pay(widget) {
             return defer;
         },
 
+        // getModelId
+        fetchGetModelId: function() {
+            var self = this;
+            var defer = $.Deferred();
+            var irModelData = new model.web.Model('ir.model.data');
+            var getObtjectReference = irModelData.get_func('get_object_reference');
+
+            this.alive(getObtjectReference('account', 'invoice_form')).then(function(results) {
+                defer.resolve(results);
+            });
+
+            return defer;
+        },
+
         getResCurrency: function (id) {
             var self = this;
             return _.filter(self.ResCurrecy,function (item) {
@@ -197,7 +216,7 @@ function widget_account_to_pay(widget) {
                 });
             }
             self.$el.find('.widget-content.widget-loading').css('display','none');
-            self.$el.find('.widget-content').find('a').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
+            self.$el.find('.widget-content').find('.number').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
         },
 
         showThisWeek: function () {
@@ -214,7 +233,7 @@ function widget_account_to_pay(widget) {
                 });
             }
             self.$el.find('.widget-content.widget-loading').css('display','none');
-            self.$el.find('.widget-content').find('a').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
+            self.$el.find('.widget-content').find('.number').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
         },
 
         showExpire: function () {
@@ -231,7 +250,81 @@ function widget_account_to_pay(widget) {
                 });
             }
             self.$el.find('.widget-content.widget-loading').css('display','none');
-            self.$el.find('.widget-content').find('a').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
+            self.$el.find('.widget-content').find('.number').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
+        },
+
+        showModal: function (e) {
+            var self = this;
+            if (self.AccountMoveLine <=0) {
+                model.web.notification.do_warn("Atención","Sin datos");
+                return
+            }
+
+            var moneda = self.ResCurrency;
+            var newmoveLine = self.AccountMoveLine;
+            var titleData = [
+                {
+                    title: "Cuentas a Pagar"
+                }
+            ];
+            var headerModal = [
+                {
+                    title: "Proveedor"
+                },
+                {
+                    title: "Numero de Factura"
+                },
+                {
+                    title: "Vencimiento"
+                },
+                {
+                    title: "Monto "
+                }
+            ];
+
+            var modal = Qweb.render('ExpiredAccountCountersModal', {
+                data: newmoveLine,
+                dataThead: headerModal,
+                modalTitle: titleData
+            });
+
+            $('.openerp_webclient_container').after(modal);
+            $('.expired-account-modal').modal()
+            $('.expired-account-modal').on('hidden.bs.modal', function (e) {
+                self.removeModal(e);
+            })
+
+            var contenido = $('.expired-account-modal').find('.table-tbody');
+            contenido.click(function (e) {
+                $(contenido).find('tr').removeClass('table-row-select');
+                $(e.target).closest('tr').addClass('table-row-select');
+                var chirdren_id =$(e.target).closest('tr').children()[0].textContent;
+                self.renderForm(chirdren_id);
+            });
+        },
+
+        // Remover <Modal></Modal>
+        removeModal: function (e) {
+            $('.expired-account-modal').remove();
+            $('.modal-backdrop').remove();
         },
+
+        // Llamar form
+        renderForm: function(id){
+            var self = this;
+            id = parseInt(id);
+
+            this.do_action({
+                type: "ir.actions.act_window",
+                res_model: "account.invoice",
+                views: [[self.modelId[1], 'form']],
+                target: 'current',
+                domain: [['id', '=', id]],
+                context: {},
+                res_id: id,
+            }).then(function() {
+                self.removeModal();
+            });
+        }
     });
 }

+ 3 - 3
static/src/xml/widgets/eiru_dashboard_modal.xml

@@ -29,7 +29,7 @@
                             <table class="oe_list_content">
                                 <tbody class="table-tbody">
                                     <tr t-foreach="data" t-as="field">
-                                        <td><t t-esc="field_value.invoice[0]"/></td>
+                                        <td style="display:none;"><t t-esc="field_value.invoice[0]"/></td>
                                         <td><t t-esc="field_value.partner_id[1]"/></td>
                                         <td><t t-esc="field_value.ref"/></td>
                                         <td>
@@ -51,9 +51,9 @@
                         </div>
                     </div>
                     <div class="modal-footer">
-                        <button type="button" class="btn btn-default " data-dismiss="modal">Cerrar</button>
+                        <!-- <button type="button" class="btn btn-default " data-dismiss="modal">Cerrar</button> -->
                     </div>
-                </div>
+                </div> 
             </div>
         </div>
     </t>

+ 3 - 3
static/src/xml/widgets/widget_account_receivable.xml

@@ -12,10 +12,10 @@
                         <div class="col-xs-6">
                             <div class="col-xs-6 col-xs-offset-9">
                                 <div class="btn-group btn-group-xs">
-                                    <a type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+                                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                     <span class="caret"></span>
                                     <span class="sr-only">Toggle Dropdown</span>
-                                    </a>
+                                    </button>
                                     <ul class="dropdown-menu dropdown-menu-right">
                                         <li><a class="today">Hoy</a></li>
                                         <li><a class="thisWeek">Esta Semana</a></li>
@@ -27,7 +27,7 @@
                     </div>
                 </h2>
                 <div class="widget-content">
-                    <a></a>
+                    <a class="number"></a>
                 </div>
                 <div class="widget-content widget-loading">
                     <i class='fa fa-cog fa-spin fa-3x fa-fw'></i>

+ 3 - 3
static/src/xml/widgets/widget_account_to_pay.xml

@@ -12,10 +12,10 @@
                         <div class="col-xs-6">
                             <div class="col-xs-6 col-xs-offset-9">
                                 <div class="btn-group btn-group-xs">
-                                    <a type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+                                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                     <span class="caret"></span>
                                     <span class="sr-only">Toggle Dropdown</span>
-                                    </a>
+                                    </button>
                                     <ul class="dropdown-menu dropdown-menu-right">
                                         <li><a class="today">Hoy</a></li>
                                         <li><a class="thisWeek">Esta Semana</a></li>
@@ -27,7 +27,7 @@
                     </div>
                 </h2>
                 <div class="widget-content">
-                    <a></a>
+                    <a class="number"></a>
                 </div>
                 <div class="widget-content widget-loading">
                     <i class='fa fa-cog fa-spin fa-3x fa-fw'></i>

+ 3 - 29
views/actions.xml

@@ -14,38 +14,12 @@
             <field name="type">ir.actions.act_window</field>
             <field name="res_model">res.partner</field>
             <field name="view_type">form</field>
-            <field name="view_mode">tree,form</field>
+            <field name="view_mode">tree,kanban,form</field>
             <field name="view_id" ref="base.view_partner_tree"/>
             <field name="domain">[('active', '=', True),('customer', '=', True)]</field>
             <field name="search_view_id" ref="base.view_res_partner_filter"/>
         </record>
 
-        <!-- Session -->
-        
-         <record id="eiru_reporting_dashboard_pos_session_action" model="ir.actions.act_window">
-            <field name="name">Todas las Sesiones</field>
-            <field name="type">ir.actions.act_window</field>
-            <field name="res_model">pos.session</field>
-            <field name="view_type">form</field>
-            <field name="view_mode">tree,form</field>
-            <field name="view_id" ref="point_of_sale.view_pos_session_tree"/>
-            <field name="domain">[]</field>
-            <field name="search_view_id" ref="point_of_sale.view_pos_session_search"/>
-        </record>
-
-        <!-- Pos Order -->
-        
-         <record id="eiru_reporting_dashboard_pos_order_action" model="ir.actions.act_window">
-            <field name="name">Todas los pedidos</field>
-            <field name="type">ir.actions.act_window</field>
-            <field name="res_model">pos.order</field>
-            <field name="view_type">form</field>
-            <field name="view_mode">tree,form</field>
-            <field name="view_id" ref="point_of_sale.view_pos_order_tree"/>
-            <field name="domain">[]</field>
-            <field name="search_view_id" ref="point_of_sale.view_pos_order_filter"/>
-        </record>
-
         <!-- Proveedores -->
         
          <record id="eiru_reporting_dashboard_supplier_action" model="ir.actions.act_window">
@@ -53,7 +27,7 @@
             <field name="type">ir.actions.act_window</field>
             <field name="res_model">res.partner</field>
             <field name="view_type">form</field>
-            <field name="view_mode">tree,form</field>
+            <field name="view_mode">tree,kanban,form</field>
             <field name="view_id" ref="base.view_partner_tree"/>
             <field name="domain">[('active', '=', True),('supplier', '=', True)]</field>
             <field name="search_view_id" ref="base.view_res_partner_filter"/>
@@ -79,7 +53,7 @@
             <field name="type">ir.actions.act_window</field>
             <field name="res_model">product.template</field>
             <field name="view_type">form</field>
-            <field name="view_mode">tree,form</field>
+            <field name="view_mode">tree,kanban,form</field>
             <field name="view_id" ref="product.product_template_tree_view"/>
             <field name="domain">[('active', '=', True)]</field>
             <field name="search_view_id" ref="product.product_template_search_view"/>

+ 1 - 11
views/menus.xml

@@ -16,17 +16,7 @@
 	    	parent="report_reporting_dashboard_sale_menu" 
 	    	name="Clientes" 
 	    	action="eiru_reporting_dashboard_customer_action" />
-
-	    	<menuitem id="report_dashboard_session_submenu" 
-	    	parent="report_reporting_dashboard_sale_menu" 
-	    	name="Todas las sesiones" 
-	    	action="eiru_reporting_dashboard_pos_session_action" />
-
-	    	<menuitem id="report_dashboard_pos_order_submenu" 
-	    	parent="report_reporting_dashboard_sale_menu" 
-	    	name="Pedidos" 
-	    	action="eiru_reporting_dashboard_pos_order_action" />
-
+	    	
 	   	<!-- Compras -->
 	    <menuitem id="report_reporting_dashboard_purchase_menu" name="Compras" parent="eiru_report_main_menu" sequence="2"/>