소스 검색

commit inicial

Rodney Elpidio Enciso Arias 6 년 전
커밋
38f5918fb1
10개의 변경된 파일261개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      __init__.py
  2. BIN
      __init__.pyc
  3. 20 0
      __openerp__.py
  4. 26 0
      static/src/css/pos.css
  5. 18 0
      static/src/js/db.js
  6. 6 0
      static/src/js/main.js
  7. 35 0
      static/src/js/models.js
  8. 92 0
      static/src/js/widget.js
  9. 44 0
      static/src/xml/view.xml
  10. 19 0
      template.xml

+ 1 - 0
__init__.py

@@ -0,0 +1 @@
+# -*- coding: utf-8 -*-

BIN
__init__.pyc


+ 20 - 0
__openerp__.py

@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+
+{
+    "name": "POS - Customize Product Pack",
+    "version": "1.0",
+    "website": "https://www.eiru.com.py",
+    "author": "Eiru",
+    "license": "AGPL-3",
+    "installable": True,
+    "depends": [
+        "pos_restaurant",
+        "product_pack",
+    ],
+    "data": [
+        "template.xml",
+    ],
+    "qweb": [
+        "static/src/xml/view.xml",
+    ],
+}

+ 26 - 0
static/src/css/pos.css

@@ -0,0 +1,26 @@
+.pos .clientlist-screen .button.select-table {
+    left: 50%;
+    margin-left: 190px;
+}
+
+.pos .popup .floor-button {
+    height: 39px;
+    display: block;
+    width: 100%;
+    margin: 0px -6px 4px -2px;
+    font-weight: bold;
+    vertical-align: middle;
+    color: #555555;
+    font-size: 14px;
+}
+
+.pos .popup .table-button {
+    height: 39px;
+    display: block;
+    width: 100%;
+    margin: 0px -6px 4px -2px;
+    font-weight: bold;
+    vertical-align: middle;
+    color: #555555;
+    font-size: 14px;
+}

+ 18 - 0
static/src/js/db.js

@@ -0,0 +1,18 @@
+function pos_customize_product_pack_db(instance, module){
+    var QWeb = instance.web.qweb;
+    _t = instance.web._t;
+
+    module.PosDB = module.PosDB.extend({
+        
+        init: function(options){
+            this.product_pack_lines_by_id = {}
+            this._super(options);
+        },
+        
+        get_product_pack_lines_by_id: function(id){
+            return this.product_pack_lines_by_id[id];
+        },
+
+    });
+};
+

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

@@ -0,0 +1,6 @@
+openerp.pos_customize_product_pack = function(instance) {
+    var module = instance.point_of_sale;
+    pos_customize_product_pack_db(instance, module);
+    pos_customize_product_pack_models(instance, module);
+    pos_customize_product_pack_widget(instance, module);
+};

+ 35 - 0
static/src/js/models.js

@@ -0,0 +1,35 @@
+function pos_customize_product_pack_models(instance, module){
+    var QWeb = instance.web.qweb;
+    _t = instance.web._t;
+
+    var PosModelSuper = module.PosModel;
+    module.PosModel = module.PosModel.extend({
+        load_server_data: function(){
+            var self = this;
+            var loaded = PosModelSuper.prototype.load_server_data.call(this);
+            loaded = loaded.then(function(){
+                return self.fetch(
+                    'product.product',
+                    ['pack_line_ids'],
+                    [['sale_ok','=',true],['available_in_pos','=',true]],
+                    {}
+                );
+            }).then(function(products){
+                $.each(products, function(){
+                    $.extend(self.db.get_product_by_id(this.id) || {}, this);
+                });
+                return $.when();
+            });
+            return loaded;
+        },
+    });
+
+    module.PosModel.prototype.models.push({
+        model: "product.pack.line",
+        fields: ['parent_product_id', 'product_id'],
+        loaded: function(self, product_pack_lines){
+            self.product_pack_lines = product_pack_lines;
+        },
+    });
+};
+

+ 92 - 0
static/src/js/widget.js

@@ -0,0 +1,92 @@
+function pos_customize_product_pack_widget(instance, module){
+    var QWeb = instance.web.qweb;
+    _t = instance.web._t;
+
+    module.PosWidget.include({
+        build_widgets: function() {         
+            var self = this;
+            this._super();
+            this.pack_popup = new module.PackPopUp(this,{});
+            this.pack_popup.appendTo(this.$el);
+            this.pack_popup.hide();
+            this.screen_selector.popup_set['PackList'] = this.pack_popup;
+        }
+    });
+
+    module.ClientListScreenWidget.include({
+        show: function(){
+            var self = this;        
+            this._super();
+            
+            this.$('.select-table').click(function(){
+                self.pos_widget.screen_selector.show_popup('PackList');
+                $('#floor-cancel').click(function(){
+                    self.pos_widget.screen_selector.set_current_screen('clientlist');
+                });
+            });                
+        }
+    });  
+    
+    module.PackPopUp = module.PopUpWidget.extend({
+        template:'PackPopupWidget',
+            
+        start: function(){
+            this._super();
+            var self = this;
+            this.floor_list_widget = new module.PackListScreenWidget(this,{});
+        },
+
+        show: function(){
+            this._super();
+            var self = this; 
+            this.floor_list_widget.replace($('.placeholder-PackListScreenWidget'));       
+        },
+
+    }); 
+
+    module.PackListScreenWidget = module.ScreenWidget.extend({
+        template:'PackListScreenWidget',
+
+        init: function(parent, options) {
+            this._super(parent,options);
+        },
+
+        start: function() {
+            this._super();
+            var self = this;
+        },
+
+        renderElement: function() {
+            this._super();
+            var self = this;
+            var pack_lines = this.pos.product_pack_lines || [];
+            for(var i = 0; i < pack_lines.length;  i++ ){
+                var data = [];
+                data.push({
+                    id:pack_lines[i].id,
+                    name:pack_lines[i].product_id[1],
+                });
+                data = data.shift();
+                var product = new module.PackListWidget(this, {
+                    model_floor: data,
+                });
+                product.appendTo(this.$('.product_list'));
+            }
+        },
+    }),
+    
+    module.PackListWidget = module.PosBaseWidget.extend({
+        template: 'PackListWidget',
+        
+        init: function(parent, options){
+            this._super(parent, options);
+            this.model_floor = options.model_floor;
+        },
+
+        renderElement: function(){
+            var self = this;
+            this._super();
+
+        }
+    });
+};

+ 44 - 0
static/src/xml/view.xml

@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<templates id="template" xml:space="preserve">
+
+    <t t-extend="ClientListScreenWidget">
+        <t t-jquery="span.new-customer" t-operation="after">
+            <span class="button select-table">
+                Elegir
+            </span>
+        </t>
+    </t>
+
+    <t t-name="PackPopupWidget">
+        <div class="modal-dialog custom-dialog">
+            <div class="popup popup-select-floors" >
+                <div class="floor-header">
+                    <div class="floor-heading">
+                        Quitar elemento
+                    </div>
+                    <div class=" button" id="floor-cancel">
+                        Cancelar
+                    </div>
+                </div>
+                <div class="floor-data" >
+                    <span class="placeholder-PackListScreenWidget" />
+                </div> 
+            </div>
+        </div>
+    </t>
+
+    <t t-name="PackListScreenWidget">
+        <div class="floor_list_class">
+            <ol  class="product_list">
+            </ol>
+        </div>
+    </t>
+
+    <t t-name="PackListWidget">
+        <span class='floor_list_widget' t-att-data-floor-id="widget.model_floor.id">
+            <button class="floor-button">
+                <t t-esc="widget.model_floor.name"/>
+            </button>
+        </span>
+    </t>  
+</templates>

+ 19 - 0
template.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <template id="indexs" inherit_id='point_of_sale.index' name="POS Header">
+            <xpath expr="//link[@id='pos-stylesheet']" position="after">
+                <link rel="stylesheet" href="/pos_customize_product_pack/static/src/css/pos.css" />
+            </xpath>
+        </template>
+            
+        <template id="assets_backends_js" name="pos_customize_product_pack assests" inherit_id="web.assets_backend">
+            <xpath expr="." position="inside">
+               <script type="text/javascript" src="/pos_customize_product_pack/static/src/js/db.js"></script>  
+               <script type="text/javascript" src="/pos_customize_product_pack/static/src/js/main.js"></script>  
+               <script type="text/javascript" src="/pos_customize_product_pack/static/src/js/models.js"></script>
+               <script type="text/javascript" src="/pos_customize_product_pack/static/src/js/widget.js"></script>               
+            </xpath>
+        </template>
+    </data>
+</openerp>