Browse Source

commit inicial

Rodney Elpidio Enciso Arias 7 years ago
commit
247d49b590
6 changed files with 115 additions and 0 deletions
  1. 0 0
      __init__.py
  2. BIN
      __init__.pyc
  3. 17 0
      __openerp__.py
  4. 10 0
      data.xml
  5. 35 0
      static/src/js/pos.js
  6. 53 0
      static/src/xml/pos.xml

+ 0 - 0
__init__.py


BIN
__init__.pyc


+ 17 - 0
__openerp__.py

@@ -0,0 +1,17 @@
+# -*- coding: utf-8 -*-
+{
+    'name': 'Pos Customer extra Fields',
+    'version': '1.0.2',
+    'author': 'IT-Projects LLC, Ivan Yelizariev, Eiru',
+    'license': 'GPL-3',
+    'category': 'Point Of Sale',
+    'website': 'https://twitter.com/yelizariev',
+    'depends': ['point_of_sale', 'stock'],
+    'data': [
+        'data.xml',
+    ],
+    'qweb': [
+        'static/src/xml/pos.xml',
+    ],
+    'installable': True,
+}

+ 10 - 0
data.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <template id="assets_backend" name="pos assets" inherit_id="point_of_sale.assets_backend">
+            <xpath expr="." position="inside">
+                <script type="text/javascript" src="/pos_customer_extra_fields/static/src/js/pos.js"></script>
+            </xpath>
+        </template>
+    </data>
+</openerp>

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

@@ -0,0 +1,35 @@
+function pos_customer_extra_field(instance, module){
+
+    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(
+                    'res.partner',
+                    ['ruc'],
+                    [['active','=',true],['customer','=',true]],
+                );
+
+            }).then(function(partners){
+                $.each(partners, function(){
+                    $.extend(self.db.get_partner_by_id(this.id) || {}, this);
+                });
+                return $.when();
+            });
+            return loaded;
+        },
+    });
+}
+
+(function(){
+    var _super = window.openerp.point_of_sale;
+    window.openerp.point_of_sale = function(instance){
+        _super(instance);
+        var module = instance.point_of_sale;
+
+        pos_customer_extra_field(instance, module);
+    };
+})();

+ 53 - 0
static/src/xml/pos.xml

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<templates id="template" xml:space="preserve">
+    
+    <!-- Cabecera -->
+    <!-- <t t-extend="ClientListScreenWidget">
+        <t t-jquery="div.subwindow-container" t-operation="replace">
+            <div class='subwindow-container-fix touch-scrollable scrollable-y'>
+                <table class='client-list'>
+                    <thead>
+                        <tr>
+                            <th>Name</th>
+                            <th>RUC-DNI</th>
+                            <th>Address</th>
+                            <th>Phone</th>
+                        </tr>
+                    </thead>
+                    <tbody class='client-list-contents'>
+                    </tbody>
+                </table>
+            </div>
+        </t>
+    </t> -->
+
+    <!-- Lineas -->
+    <!-- <t t-extend="ClientLine">
+        <t t-jquery="tr.client-line" t-operation="replace">           
+            <td><t t-esc='partner.name' /></td>
+            <td><t t-esc='partner.ruc' /></td>
+            <td><t t-esc='partner.address' /></td>
+            <td><t t-esc='partner.phone or partner.mobile or ""' /></td>            
+        </t>
+    </t> -->
+
+    <!-- Mostrar Formulario -->
+    <t t-extend="ClientDetails">
+        <t t-jquery="div.client-details-left>div:first-child" t-operation="before">
+            <div class='client-detail'>
+                <span class='label'>RUC-DNI</span>
+                <span class='detail client-ruc'><t t-esc='partner.ruc' /></span>
+            </div>
+        </t>
+    </t>
+
+    <!-- Editar Formulario -->
+    <t t-extend="ClientDetailsEdit">
+        <t t-jquery="div.client-details-left>div:first-child" t-operation="before"> 
+            <div class='client-detail'>
+                <span class='label'>RUC</span>
+                <input class='detail client-ruc' name='ruc'       t-att-value='partner.ruc' placeholder='RUC-DNI'></input>
+            </div>   
+        </t>
+    </t>
+</templates>