Browse Source

commit inicial

Rodney Elpidio Enciso Arias 6 năm trước cách đây
commit
1619e97fbd
5 tập tin đã thay đổi với 249 bổ sung0 xóa
  1. 24 0
      __init__.py
  2. BIN
      __init__.pyc
  3. 39 0
      __openerp__.py
  4. 73 0
      static/src/js/main.js
  5. 113 0
      static/src/xml/pos.xml

+ 24 - 0
__init__.py

@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+# Python source code encoding : https://www.python.org/dev/peps/pep-0263/
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This module copyright :
+#        (c) 2014 Antiun Ingenieria, SL (Madrid, Spain, http://www.antiun.com)
+#                 Endika Iglesias <endikaig@antiun.com>
+#                 Antonio Espinosa <antonioea@antiun.com>
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################

BIN
__init__.pyc


+ 39 - 0
__openerp__.py

@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+# Python source code encoding : https://www.python.org/dev/peps/pep-0263/
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This module copyright :
+#        (c) 2014 Antiun Ingenieria, SL (Madrid, Spain, http://www.antiun.com)
+#                 Endika Iglesias <endikaig@antiun.com>
+#                 Antonio Espinosa <antonioea@antiun.com>
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+{
+    'name': 'Pos ticket ferresur',
+    'category': 'Point Of Sale',
+    'version': '8.0.1.0.0',
+    'depends': [
+        'point_of_sale',
+    ],
+    'qweb': [
+        'static/src/xml/pos.xml',
+    ],
+    'author': 'Antiun Ingeniería S.L. - Eiru',
+    'website': 'https://www.eiru.com.py',
+    'license': 'AGPL-3',
+    'installable': True,
+}

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

@@ -0,0 +1,73 @@
+/**
+ * # -*- coding: utf-8 -*-
+ * ##############################################################################
+ * #
+ * #    OpenERP, Open Source Management Solution
+ * #    This module copyright :
+ * #        (c) 2014 Antiun Ingenieria, SL (Madrid, Spain, http://www.antiun.com)
+ * #                 Endika Iglesias <endikaig@antiun.com>
+ * #                 Antonio Espinosa <antonioea@antiun.com>
+ * #
+ * #    This program is free software: you can redistribute it and/or modify
+ * #    it under the terms of the GNU Affero General Public License as
+ * #    published by the Free Software Foundation, either version 3 of the
+ * #    License, or (at your option) any later version.
+ * #
+ * #    This program is distributed in the hope that it will be useful,
+ * #    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * #    GNU Affero General Public License for more details.
+ * #
+ * #    You should have received a copy of the GNU Affero General Public License
+ * #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * #
+ * ##############################################################################
+ */
+
+// Check jQuery available
+if (typeof jQuery === 'undefined') { throw new Error('POS Ticket Logo Addon requires jQuery'); }
+
++function ($) {
+    'use strict';
+
+    openerp.pos_ticket_logo = function (instance, module) {
+        var _t = instance.web._t,
+            _lt = instance.web._lt;
+        var QWeb = instance.web.qweb;
+
+        var PosModelParent = instance.point_of_sale.PosModel;
+        instance.point_of_sale.PosModel = instance.point_of_sale.PosModel.extend({
+            load_server_data: function(){
+                var self = this;
+                var loaded = PosModelParent.prototype.load_server_data.apply(this, arguments);
+                $.when(loaded).then(function(){
+                    self.company_logo.onload = function(){
+                        var img = self.company_logo;
+                        var ratio = 1;
+                        var targetwidth = 260;
+                        var maxheight = 120;
+                        if( img.width !== targetwidth ){
+                            ratio = targetwidth / img.width;
+                        }
+                        if( img.height * ratio > maxheight ){
+                            ratio = maxheight / img.height;
+                        }
+                        var width  = Math.floor(img.width * ratio);
+                        var height = Math.floor(img.height * ratio);
+                        var c = document.createElement('canvas');
+                            c.width  = width;
+                            c.height = height;
+                        var ctx = c.getContext('2d');
+                            ctx.drawImage(self.company_logo,0,0, width, height);
+
+                        self.company_logo_base64 = c.toDataURL();
+                        loaded.resolve();
+                    };
+                    self.company_logo.src = '/web/binary/image?model=res.company&id=' + self.company.id + '&field=logo';
+                });
+                return loaded;
+            }
+        });
+    };
+
+}(jQuery);

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

@@ -0,0 +1,113 @@
+<?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 class="pos-center-align">
+                <img t-att-src="widget.pos.company_logo_base64"/><br />
+            </div>
+            <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/>
+            <t t-if="widget.pos.config.receipt_header">
+                <div style='text-align:center;font-size: 20px;'>
+                    <t t-esc="widget.pos.config.receipt_header" />
+                </div>
+                <br />
+            </t>
+            <t t-esc="widget.pos.company.phone || ''"/> <br/>
+            Vendedor: <t t-esc="widget.pos.cashier ? widget.pos.cashier.name : widget.pos.user.name"/>
+            <t t-if="order.attributes.client">
+                <br/>
+                Cliente: <t t-esc="order.attributes.client.name ? order.attributes.client.name : ''"/><br/>
+                Teléfono: <t t-esc="order.attributes.client.phone ? order.attributes.client.phone : ''"/><br/><br/>
+            </t>
+            <table class="table table-condensed">
+                <thead>
+                    <tr>
+                        <th>Producto</th>
+                        <th class="text-right">Cant.</th>
+                        <th class="text-right">Precio</th>
+                    </tr>
+                </thead>
+                <tbody>
+                    <colgroup>
+                        <col width='50%'/>
+                        <col width='20%'/>
+                        <col width='30%'/>
+                    </colgroup>
+                    <tr t-foreach="orderlines" t-as="orderline">
+                        <td>
+                            <t t-esc="orderline.get_product().display_name"/>
+                             <t t-if="orderline.get_discount() > 0">
+                                <div class="pos-disc-font">
+                                    Con <t t-esc="orderline.get_discount()"/>% descuento
+                                </div>
+                            </t>
+                        </td>
+                        <td>
+                            <t t-esc="orderline.get_quantity_str_with_unit()"/>
+                        </td>
+                        <td class="pos-right-align">
+                            <t t-esc="widget.format_currency(orderline.get_display_price())"/>
+                        </td>
+                    </tr>
+                </tbody>
+            </table>
+            <br />
+            <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>
+            <br/>
+            <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>
+            <table>
+                <tr><td>Change:</td><td class="pos-right-align">
+                    <t t-esc="widget.format_currency(order.getChange())"/>
+                    </td></tr>
+            </table>
+            <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>