Jelajahi Sumber

commit inicial

Rodney Elpidio Enciso Arias 6 tahun lalu
melakukan
5a0332f72a
6 mengubah file dengan 218 tambahan dan 0 penghapusan
  1. 1 0
      __init__.py
  2. TEMPAT SAMPAH
      __init__.pyc
  3. 19 0
      __openerp__.py
  4. 62 0
      static/src/js/main.js
  5. 126 0
      static/src/xml/pos.xml
  6. 10 0
      template.xml

+ 1 - 0
__init__.py

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

TEMPAT SAMPAH
__init__.pyc


+ 19 - 0
__openerp__.py

@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+{
+    'name': 'Pos ticket HomePro',
+    'category': 'Point Of Sale',
+    'version': '8.0.1.0.0',
+    'depends': [
+        'point_of_sale',
+    ],
+    'data': [
+        "template.xml",
+    ],
+    'qweb': [
+        'static/src/xml/pos.xml',
+    ],
+    'author': 'Eiru',
+    'website': 'https://www.eiru.com.py',
+    'license': 'AGPL-3',
+    'installable': True,
+}

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

@@ -0,0 +1,62 @@
+
+openerp.pos_ticket_homepro = function (instance) {
+	var module   = instance.point_of_sale;
+    var _t = instance.web._t,
+        _lt = instance.web._lt;
+    var QWeb = instance.web.qweb;
+
+    module.ReceiptScreenWidget = module.ScreenWidget.extend({
+        template: 'ReceiptScreenWidget',
+
+        show_numpad:     false,
+        show_leftpane:   false,
+
+        show: function(){
+            this._super();
+            var self = this;
+
+            var print_button = this.add_action_button({
+                    label: _t('Print'),
+                    icon: '/point_of_sale/static/src/img/icons/png48/printer.png',
+                    click: function(){ self.print(); },
+                });
+
+            var finish_button = this.add_action_button({
+                    label: _t('Next Order'),
+                    icon: '/point_of_sale/static/src/img/icons/png48/go-next.png',
+                    click: function() { self.finishOrder(); },
+                });
+
+            this.refresh();
+
+            // if (!this.pos.get('selectedOrder')._printed) {
+            //     this.print();
+            // }
+
+            finish_button.set_disabled(true);
+            setTimeout(function(){
+                finish_button.set_disabled(false);
+            }, 2000);
+        },
+        print: function() {
+            this.pos.get('selectedOrder')._printed = true;
+            window.print();
+        },
+        finishOrder: function() {
+            this.pos.get('selectedOrder').destroy();
+        },
+        refresh: function() {
+            var order = this.pos.get('selectedOrder');
+            $('.pos-receipt-container', this.$el).html(QWeb.render('PosTicket',{
+                    widget:this,
+                    order: order,
+                    orderlines: order.get('orderLines').models,
+                    paymentlines: order.get('paymentLines').models,
+                    logo: order.pos.company_logo_base64
+                }));
+        },
+        close: function(){
+            this._super();
+        }
+    });
+};

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

@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<templates>
+    <t t-extend="PosTicket">
+        <t t-jquery="div.pos-sale-ticket" t-operation="replace">
+            <div class="pos-sale-ticket" style='font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;font-size: 15px;'>
+                <div id="company_logo">
+                    <img t-att-src="logo" style="width:100%;"/>
+                </div>
+                <br/><br/>
+                <div class="pos-center-align"><t t-esc="new Date().toString(Date.CultureInfo.formatPatterns.shortDate + ' ' +
+                    Date.CultureInfo.formatPatterns.longTime)"/>
+                    <br/>
+                    <t t-esc="order.get('name')"/></div>
+                <br/>
+                <br />
+                <t t-if="widget.pos.config.receipt_header">
+                    <div style='text-align:center;font-size: 30px;'>
+                        <t t-esc="widget.pos.config.receipt_header" />
+                    </div>
+                    <br />
+                </t>
+                Phone: <t t-esc="widget.pos.company.phone || ''"/>
+                <br/>
+                User: <t t-esc="widget.pos.cashier ? widget.pos.cashier.name : widget.pos.user.name"/>
+                <t t-if="!order.attributes.client">
+                    Cliente: <br/>
+                    Teléfono: <br/>
+                    Dirección: <br/>
+                </t>
+                <p>========================</p>
+                <table class="table table-condensed" style="font-size: 12px;">
+                    <thead>
+                        <tr>
+                            <th class="text-right">Cant.</th>
+                            <th>Producto</th>
+                            <th class="text-right">Precio</th>
+                            <th class="text-right">Sub-total</th>
+                        </tr>
+                    </thead>
+                    <tbody>
+                        <colgroup>
+                            <col width='15%'/>
+                            <col width='35%'/>
+                            <col width='25%'/>
+                            <col width='25%'/>
+                        </colgroup>
+                        <t t-foreach="orderlines" t-as="orderline">
+                            <tr>
+                                <td>
+                                    <t t-esc="orderline.quantity"/>
+                                </td>
+                                <td>
+                                    <t t-esc="orderline.get_product().display_name"/>
+                                </td>
+                                <td>
+                                    <t t-esc="widget.format_currency(orderline.price)"/>
+                                </td>
+                                <td class="pos-right-align">
+                                    <t t-esc="widget.format_currency(orderline.get_display_price())"/>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td>********</td>
+                                <td>******************</td>
+                                <td>*************</td>
+                                <td>*************</td>
+                            </tr>
+                        </t>
+                    </tbody>
+                </table>
+                <table>
+                    <tr>
+                        <td>Subtotal:</td>
+                        <td class="pos-right-align">
+                            <t t-esc="widget.format_currency(order.getTotalTaxExcluded())"/>
+                        </td>
+                    </tr>
+                    <t t-foreach="order.getTaxDetails()" t-as="taxdetail">
+                        <tr>
+                            <td><t t-esc="taxdetail.name" /></td>
+                            <td class="pos-right-align">
+                                <t t-esc="widget.format_currency(taxdetail.amount)"/>
+                            </td>
+                        </tr>
+                    </t>
+                    <tr>
+                        <td>Descuento:</td>
+                        <td class="pos-right-align">
+                            <t t-esc="widget.format_currency(order.getDiscountTotal())"/>
+                        </td>
+                    </tr>
+                    <tr class="emph">
+                        <td>Total:</td>
+                        <td class="pos-right-align" style='font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;font-size: 20px;'>
+                            <t t-esc="widget.format_currency(order.getTotalTaxIncluded())"/>
+                        </td>
+                    </tr>
+                </table>
+                <p>========================</p>
+                <table>
+                    <tr t-foreach="paymentlines" t-as="line">
+                        <td>
+                            <t t-esc="line.name"/>
+                        </td>
+                        <td class="pos-right-align">
+                            <t t-esc="widget.format_currency(line.get_amount())"/>
+                        </td>
+                    </tr>
+                </table>
+                <br />
+                <table>
+                    <tr><td>Change:</td><td class="pos-right-align">
+                        <t t-esc="widget.format_currency(order.getChange())"/>
+                        </td></tr>
+                </table>
+                <br/>
+                <t t-if="widget.pos.config.receipt_footer">
+                    <br />
+                    <div style='text-align:center'>
+                        <t t-esc="widget.pos.config.receipt_footer" />
+                    </div>
+                </t>
+            </div>
+        </t>
+    </t>
+</templates>

+ 10 - 0
template.xml

@@ -0,0 +1,10 @@
+<openerp>
+    <data>
+        <template id="pos_ticket_homepro_assets_backend" name="pos_ticket_homepro_assets_backend" inherit_id="point_of_sale.assets_backend">
+            <xpath expr="." position="inside">
+                <script src="/pos_ticket_homepro/static/src/js/main.js"
+                        type="text/javascript"></script>
+            </xpath>
+        </template>
+    </data>
+</openerp>