Bläddra i källkod

[FIX] correccion en las lineas del pedido

Rodney Elpidio Enciso Arias 6 år sedan
förälder
incheckning
05e0bf2aee
3 ändrade filer med 37 tillägg och 22 borttagningar
  1. 2 2
      static/src/css/pos.css
  2. 26 7
      static/src/js/widget.js
  3. 9 13
      static/src/xml/view.xml

+ 2 - 2
static/src/css/pos.css

@@ -1,5 +1,5 @@
 .pos .popup .product-button {
-    height: 35px;
+    height: 2em;
     display: block;
     width: 50%;
     margin: 0px -6px 4px -2px;
@@ -12,7 +12,7 @@
     margin-left:0;
     margin-top:0;
     left:5%;
-    width: 90%;
+    width: 70%;
     top:5%;
     height:85%;
 }

+ 26 - 7
static/src/js/widget.js

@@ -44,7 +44,6 @@ function pos_customize_product_pack_widget(instance, module){
             var self = this;
             this.product_list_widget.replace($('.placeholder-PackListScreenWidget'));           
         },
-
     }); 
 
     module.PackListScreenWidget = module.ScreenWidget.extend({
@@ -124,17 +123,40 @@ function pos_customize_product_pack_widget(instance, module){
                 if(product.description == false){
                     var ProductPackList = [];
                     ProductPackList.push({
+                        order : selectedline.order.uid,
+                        line_id : selectedline.id,
                         product_parent_id : product.id,
                         product_id : self.model_product.id,
-                        product_name : ' ■ Sin ' + self.model_product.name,
+                        product_name : ' ■ Sin ---> ' + self.model_product.name,
                     });
                 }else{
+
+                    // function eliminarObjetosDuplicados(arr, prop) {
+                    //     var nuevoArray = [];
+                    //     var lookup  = {};
+                     
+                    //     for (var i in arr) {
+                    //         lookup[arr[i][prop]] = arr[i];
+                    //     }
+                     
+                    //     for (i in lookup) {
+                    //         nuevoArray.push(lookup[i]);
+                    //     }
+                     
+                    //     return nuevoArray;
+                    // }
+
                     var ProductPackList = product.description;
                     ProductPackList.push({
+                        order : selectedline.order.uid,
+                        line_id : selectedline.id,
                         product_parent_id : product.id,
                         product_id : self.model_product.id,
-                        product_name : ' ■ Sin ' + self.model_product.name,
+                        product_name : ' ■ Sin ---> ' + self.model_product.name,
                     });
+                    
+                    // ProductPackList = eliminarObjetosDuplicados(ProductPackList, 'product_id');
+
                 }
                 product.description = ProductPackList; 
                 self.pos_widget.screen_selector.set_current_screen('products');
@@ -146,7 +168,6 @@ function pos_customize_product_pack_widget(instance, module){
 
     // **************************************************************************
 
-    var OrderWidgetSuper = module.OrderWidget;
     module.OrderWidget = module.PosBaseWidget.extend({
         template:'OrderWidget',
         init: function(parent, options) {
@@ -230,9 +251,7 @@ function pos_customize_product_pack_widget(instance, module){
                     },this);
         },
         render_orderline: function(orderline){
-            console.log(orderline);
-            var prueba = [{id:'algo',name:'algo1'}];
-            var el_str  = openerp.qweb.render('Orderline',{widget:this, line:orderline, list:prueba});
+            var el_str  = openerp.qweb.render('Orderline',{widget:this, line:orderline});
             var el_node = document.createElement('div');
                 el_node.innerHTML = _.str.trim(el_str);
                 el_node = el_node.childNodes[0];

+ 9 - 13
static/src/xml/view.xml

@@ -70,21 +70,17 @@
                         <table>
                             <tbody>
                                 <t t-foreach="line.get_product().description" t-as="item">
-                                    <tr>
-                                        <td>
-                                            <t t-esc="item.product_name"/>        
-                                        </td>
-                                    </tr>
+                                    <t t-if="line.order.uid == item.order and line.id == item.line_id">
+                                        <tr>
+                                            <td></td>
+                                            <td>
+                                                <t t-esc="item.product_name"/>
+                                            </td>
+                                        </tr>
+                                    </t>
                                 </t>
-                                <!-- <t t-foreach="list" t-as="item">
-                                    <tr>
-                                        <td>
-                                            <t t-esc="item.name"/>        
-                                        </td>
-                                    </tr>
-                                </t> -->
                             </tbody>
-                        </table>  
+                        </table>
                     </t>
                 </div>
             </ul>