Browse Source

commit inicial

Rodney Elpidio Enciso Arias 7 years ago
parent
commit
47d304c825
6 changed files with 121 additions and 0 deletions
  1. 3 0
      __openerp__.py
  2. 34 0
      static/src/js/customer.js
  3. 4 0
      static/src/js/main.js
  4. 14 0
      static/src/js/models.js
  5. 53 0
      static/src/xml/pos.xml
  6. 13 0
      template.xml

+ 3 - 0
__openerp__.py

@@ -10,6 +10,9 @@
                 'base',
                 'point_of_sale',
                 ],
+    "data": [
+        "template.xml",
+    ],
     'qweb': [
         'static/src/xml/pos_receipt.xml',
     ],

+ 34 - 0
static/src/js/customer.js

@@ -0,0 +1,34 @@
+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'],
+                );
+
+            }).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);
+    };
+})();

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

@@ -0,0 +1,4 @@
+openerp.eiru_legal_ticket = function(instance) {
+    var module = instance.point_of_sale;
+    pos_company_models(instance, module);
+};

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

@@ -0,0 +1,14 @@
+function pos_company_models(instance, module){
+    var QWeb = instance.web.qweb;
+    _t = instance.web._t;
+
+    module.PosModel.prototype.models.push({
+        model: "res.company",
+        fields: ['currency_id', 'email', 'website', 'company_registry', 'vat', 'name', 'phone', 'partner_id' , 'country_id', 'tax_calculation_rounding_method','street', 'city'],
+        ids:    function(self){ return [self.user.company_id[0]] },
+        loaded: function(self, companies){
+            self.companies = companies[0];
+        },
+    });
+};
+

+ 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>

+ 13 - 0
template.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+            
+        <template id="assets_backends_js" name="eiru_legal_ticket assests" inherit_id="web.assets_backend">
+            <xpath expr="." position="inside">
+               <script type="text/javascript" src="/eiru_legal_ticket/static/src/js/main.js"></script>  
+               <script type="text/javascript" src="/eiru_legal_ticket/static/src/js/models.js"></script>
+               <script type="text/javascript" src="/eiru_legal_ticket/static/src/js/customer.js"></script>               
+            </xpath>
+        </template>
+    </data>
+</openerp>