Procházet zdrojové kódy

[ADD] modificacion de vistas y se agrego total en letras

Rodney Elpidio Enciso Arias před 6 roky
rodič
revize
adc5d761a2
4 změnil soubory, kde provedl 51 přidání a 30 odebrání
  1. 1 0
      __openerp__.py
  2. 0 1
      static/src/js/main.js
  3. 6 4
      static/src/js/screen.js
  4. 44 25
      static/src/xml/pos_receipt.xml

+ 1 - 0
__openerp__.py

@@ -9,6 +9,7 @@
     'depends': [
                 'base',
                 'point_of_sale',
+                'eiru_num2word',
                 ],
     "data": [
         "template.xml",

+ 0 - 1
static/src/js/main.js

@@ -1,7 +1,6 @@
 openerp.eiru_nutty_bavarian_invoice = function(instance) {
     var module = instance.point_of_sale;
     pos_screens(instance, module);
-    // pos_company_models(instance, module);
     pos_customer(instance, module);
 
     instance.web.client_actions.add('pos.ui', 'instance.point_of_sale.PosWidget');

+ 6 - 4
static/src/js/screen.js

@@ -428,6 +428,8 @@ function pos_screens(instance, module){ //module is instance.point_of_sale
             var data = [];
 
             var order = this.pos.get('selectedOrder');
+            var total_in_letters = order.getTotalTaxIncluded()
+            total_in_letters = instance.web.num2word(total_in_letters);
 
             customer = order.get_client();
             var customer_id = '';
@@ -441,10 +443,9 @@ function pos_screens(instance, module){ //module is instance.point_of_sale
             }
 
             var sequence = order.get('sequence_ref');
-            sequence = sequence.split('/');
+            sequence = sequence.split('-');
 
             var orderLines = order.get('orderLines').models;
-            
             _.each(orderLines, function(item){
                 var exempt = 0;
                 var percent_10 = 0;
@@ -459,7 +460,7 @@ function pos_screens(instance, module){ //module is instance.point_of_sale
                     percent_5 = item.price / 1.05;
                 }
                 data.push({
-                    qty: item.quantityStr,
+                    qty: item.quantity,
                     name: item.product.display_name,
                     price: item.price,
                     exempt: exempt,
@@ -496,7 +497,7 @@ function pos_screens(instance, module){ //module is instance.point_of_sale
             $('.pos-receipt-container', this.$el).html(QWeb.render('PosTicket',{
                 widget:this,
                 order: order,
-                sequence: sequence[1],
+                sequence: sequence[2],
                 customer_id:customer_id,
                 customer_name:customer_name,
                 customer_ruc:customer_ruc,
@@ -506,6 +507,7 @@ function pos_screens(instance, module){ //module is instance.point_of_sale
                 total_percent_10: total_percent_10,
                 total_tax: total_tax,
                 orderlines: order.get('orderLines').models,
+                total_in_letters: 'GUARANIES ' + total_in_letters,
             }));
         },
         

+ 44 - 25
static/src/xml/pos_receipt.xml

@@ -11,13 +11,13 @@
                     <div>
 
                         <!-- Numero de factura -->
-                        <div style="padding-left:250px; padding-top:115px;">
+                        <div style="padding-left:250px; padding-top:90px;">
                             <t t-esc="sequence"/>
                         </div>
                         
                         <div class="row" style="column-count: 2;">
                             <!-- Fecha de Emision -->
-                            <div style="padding-left:130px; padding-top:12px;">
+                            <div style="padding-left:120px; padding-top:12px;">
                                 <t t-esc="new Date().toString(Date.CultureInfo.formatPatterns.shortDate)"/>
                             </div>
                             <!-- Conficion de venta -->
@@ -44,7 +44,7 @@
                         </div>
                         
                         <!-- lista de productos -->
-                        <div style="padding-left:20px; padding-top:45px; font-size: 9px;  height: 135px;">
+                        <div style="padding-left:10px; padding-top:45px; font-size: 9px;  height: 135px;">
                             <table class="table table-condensed">
                                 <tbody>
                                     <colgroup>
@@ -57,7 +57,12 @@
                                     </colgroup>
                                     <tr t-foreach="data" t-as="item">
                                         <td>
-                                            <t t-esc="item.qty"/>
+                                            <t t-set="monto" t-value="item.qty"/>
+                                            <t t-js="ctx">
+                                                ctx.monto = accounting.formatNumber(ctx.monto,0,'.',',');
+                                            </t>
+                                            <t t-esc="monto"/>
+                                            <!-- <t t-esc="item.qty"/> -->
                                         </td>
                                         <td>
                                             <t t-esc="item.name"/>
@@ -96,7 +101,7 @@
                         </div>
                         
                         <!-- Subtotales -->
-                        <div style="padding-left:20px; padding-top:45px; font-size: 9px;">
+                        <div style="padding-left:10px; padding-top:60px; font-size: 9px;">
                             <table class="table table-condensed">
                                 <tbody>
                                     <colgroup>
@@ -137,17 +142,24 @@
                             </table>
                         </div>
 
-                        <!-- Total a pagar -->
-                        <div style="padding-left:300px; padding-top:15px;">
-                            <t t-set="monto" t-value="order.getTotalTaxIncluded()"/>
-                            <t t-js="ctx">
-                                ctx.monto = accounting.formatNumber(ctx.monto,0,'.',',');
-                            </t>
-                            <t t-esc="monto"/>
+                        <div class="row" style="column-count: 2;">
+                            <!-- Total en letras -->
+                            <div style="padding-left:15px; padding-top:25px; font-size: 8px;">
+                                <t t-esc="total_in_letters"/>
+                            </div>
+
+                            <!-- Total a pagar -->
+                            <div style="padding-left:90px; padding-top:15px;">
+                                <t t-set="monto" t-value="order.getTotalTaxIncluded()"/>
+                                <t t-js="ctx">
+                                    ctx.monto = accounting.formatNumber(ctx.monto,0,'.',',');
+                                </t>
+                                <t t-esc="monto"/>
+                            </div>
                         </div>
                         
                         <!-- Total de IVA -->
-                        <div style="padding-left:320px; padding-top:15px; font-size: 9px;">
+                        <div style="padding-left:320px; padding-top:15px; font-size: 8px;">
                             <t t-set="monto" t-value="total_tax"/>
                             <t t-js="ctx">
                                 ctx.monto = accounting.formatNumber(ctx.monto,0,'.',',');
@@ -164,13 +176,13 @@
                     <div>
                         
                         <!-- Numero de factura -->
-                        <div style="padding-left:250px; padding-top:115px;">
+                        <div style="padding-left:250px; padding-top:90px;">
                             <t t-esc="sequence"/>
                         </div>
                         
                         <div class="row" style="column-count: 2;">
                             <!-- Fecha de Emision -->
-                            <div style="padding-left:130px; padding-top:12px;">
+                            <div style="padding-left:120px; padding-top:12px;">
                                 <t t-esc="new Date().toString(Date.CultureInfo.formatPatterns.shortDate)"/>
                             </div>
                             <!-- Conficion de venta -->
@@ -197,7 +209,7 @@
                         </div>
                         
                         <!-- lista de productos -->
-                        <div style="padding-left:20px; padding-top:45px; font-size: 9px;  height: 135px;">
+                        <div style="padding-left:10px; padding-top:45px; font-size: 9px;  height: 135px;">
                             <table class="table table-condensed">
                                 <tbody>
                                     <colgroup>
@@ -249,7 +261,7 @@
                         </div>
                         
                         <!-- Subtotales -->
-                        <div style="padding-left:20px; padding-top:45px; font-size: 9px;">
+                        <div style="padding-left:10px; padding-top:60px; font-size: 9px;">
                             <table class="table table-condensed">
                                 <tbody>
                                     <colgroup>
@@ -290,17 +302,24 @@
                             </table>
                         </div>
 
-                        <!-- Total a pagar -->
-                        <div style="padding-left:300px; padding-top:15px;">
-                            <t t-set="monto" t-value="order.getTotalTaxIncluded()"/>
-                            <t t-js="ctx">
-                                ctx.monto = accounting.formatNumber(ctx.monto,0,'.',',');
-                            </t>
-                            <t t-esc="monto"/>
+                        <div class="row" style="column-count: 2;">
+                            <!-- Total en letras -->
+                            <div style="padding-left:15px; padding-top:25px; font-size: 8px;">
+                                <t t-esc="total_in_letters"/>
+                            </div>
+
+                            <!-- Total a pagar -->
+                            <div style="padding-left:90px; padding-top:15px;">
+                                <t t-set="monto" t-value="order.getTotalTaxIncluded()"/>
+                                <t t-js="ctx">
+                                    ctx.monto = accounting.formatNumber(ctx.monto,0,'.',',');
+                                </t>
+                                <t t-esc="monto"/>
+                            </div>
                         </div>
                         
                         <!-- Total de IVA -->
-                        <div style="padding-left:320px; padding-top:15px; font-size: 9px;">
+                        <div style="padding-left:320px; padding-top:15px; font-size: 8px;">
                             <t t-set="monto" t-value="total_tax"/>
                             <t t-js="ctx">
                                 ctx.monto = accounting.formatNumber(ctx.monto,0,'.',',');