From 6fd3622fce4a505abc8feba6fc617213d3613c49 Mon Sep 17 00:00:00 2001 From: Ismael Calvo Date: Thu, 20 Aug 2015 12:36:14 +0200 Subject: [PATCH] [ADD] Pos Gift Ticket Module --- pos_gift_ticket/README.rst | 52 ++++++++++++++++++++++ pos_gift_ticket/__init__.py | 0 pos_gift_ticket/__openerp__.py | 39 +++++++++++++++++ pos_gift_ticket/i18n/es.po | 53 +++++++++++++++++++++++ pos_gift_ticket/i18n/pos_gift_ticket.pot | 52 ++++++++++++++++++++++ pos_gift_ticket/static/src/js/main.js | 48 +++++++++++++++++++++ pos_gift_ticket/static/src/xml/pos.xml | 55 ++++++++++++++++++++++++ pos_gift_ticket/views/pos_template.xml | 14 ++++++ 8 files changed, 313 insertions(+) create mode 100644 pos_gift_ticket/README.rst create mode 100644 pos_gift_ticket/__init__.py create mode 100644 pos_gift_ticket/__openerp__.py create mode 100644 pos_gift_ticket/i18n/es.po create mode 100644 pos_gift_ticket/i18n/pos_gift_ticket.pot create mode 100644 pos_gift_ticket/static/src/js/main.js create mode 100644 pos_gift_ticket/static/src/xml/pos.xml create mode 100644 pos_gift_ticket/views/pos_template.xml diff --git a/pos_gift_ticket/README.rst b/pos_gift_ticket/README.rst new file mode 100644 index 00000000..f993151e --- /dev/null +++ b/pos_gift_ticket/README.rst @@ -0,0 +1,52 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License: AGPL-3 + +Gift Ticket for Odoo Point of Sale +==================================== + +This module allows to print a gift ticket, which is the same ticket than normal +but without prices and taxes. + +Usage +===== + +Just press the *Gift Ticket* button that appears beside the normal print +ticket button + + +Installation +============ + +Nothing special is needed to install this module. + + +Configuration +============= + +No configuration needed. + + + +Credits +======= + +Contributors +------------ + +* Ismael Calvo + + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/pos_gift_ticket/__init__.py b/pos_gift_ticket/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pos_gift_ticket/__openerp__.py b/pos_gift_ticket/__openerp__.py new file mode 100644 index 00000000..d8264d93 --- /dev/null +++ b/pos_gift_ticket/__openerp__.py @@ -0,0 +1,39 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright : +# (c) 2015 FactorLibre S.L. (http://www.factorlibre.com) +# Ismael Calvo +# +# 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 . +# +############################################################################## + +{ + "name": "Gift Ticket", + "version": "0.1", + "author": "FactorLibre", + "website": "http://www.factorlibre.com", + "license": "AGPL-3", + "category": "Point Of Sale", + "depends": ['base', 'point_of_sale'], + 'data': [ + "views/pos_template.xml", + ], + "qweb": [ + 'static/src/xml/pos.xml', + ], + "installable": True, +} diff --git a/pos_gift_ticket/i18n/es.po b/pos_gift_ticket/i18n/es.po new file mode 100644 index 00000000..a9b3177a --- /dev/null +++ b/pos_gift_ticket/i18n/es.po @@ -0,0 +1,53 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_gift_ticket +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-08-17 07:44+0000\n" +"PO-Revision-Date: 2015-08-17 07:44+0000\n" +"Last-Translator: Ismael Calvo \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: pos_gift_ticket +#. openerp-web +#: code:addons/pos_gift_ticket/static/src/xml/pos.xml:22 +#, python-format +msgid "GIFT TICKET" +msgstr "TICKET REGALO" + +#. module: pos_gift_ticket +#. openerp-web +#: code:addons/pos_gift_ticket/static/src/js/main.js:19 +#, python-format +msgid "Gift Ticket" +msgstr "Ticket Regalo" + +#. module: pos_gift_ticket +#. openerp-web +#: code:addons/pos_gift_ticket/static/src/xml/pos.xml:11 +#, python-format +msgid "Phone:" +msgstr "Teléfono:" + +#. module: pos_gift_ticket +#. openerp-web +#: code:addons/pos_gift_ticket/static/src/xml/pos.xml:13 +#, python-format +msgid "Shop:" +msgstr "Tienda:" + +#. module: pos_gift_ticket +#. openerp-web +#: code:addons/pos_gift_ticket/static/src/xml/pos.xml:12 +#, python-format +msgid "User:" +msgstr "Usuario:" + diff --git a/pos_gift_ticket/i18n/pos_gift_ticket.pot b/pos_gift_ticket/i18n/pos_gift_ticket.pot new file mode 100644 index 00000000..f2085900 --- /dev/null +++ b/pos_gift_ticket/i18n/pos_gift_ticket.pot @@ -0,0 +1,52 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_gift_ticket +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-08-17 07:44+0000\n" +"PO-Revision-Date: 2015-08-17 07:44+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: pos_gift_ticket +#. openerp-web +#: code:addons/pos_gift_ticket/static/src/xml/pos.xml:22 +#, python-format +msgid "GIFT TICKET" +msgstr "" + +#. module: pos_gift_ticket +#. openerp-web +#: code:addons/pos_gift_ticket/static/src/js/main.js:19 +#, python-format +msgid "Gift Ticket" +msgstr "" + +#. module: pos_gift_ticket +#. openerp-web +#: code:addons/pos_gift_ticket/static/src/xml/pos.xml:11 +#, python-format +msgid "Phone:" +msgstr "" + +#. module: pos_gift_ticket +#. openerp-web +#: code:addons/pos_gift_ticket/static/src/xml/pos.xml:13 +#, python-format +msgid "Shop:" +msgstr "" + +#. module: pos_gift_ticket +#. openerp-web +#: code:addons/pos_gift_ticket/static/src/xml/pos.xml:12 +#, python-format +msgid "User:" +msgstr "" + diff --git a/pos_gift_ticket/static/src/js/main.js b/pos_gift_ticket/static/src/js/main.js new file mode 100644 index 00000000..96f04a5a --- /dev/null +++ b/pos_gift_ticket/static/src/js/main.js @@ -0,0 +1,48 @@ +/* + POS Gift Tickete for Odoo + Copyright (C) 2015 FactorLibre (www.factorlibre.com) + @author: Ismael Calvo + The licence is in the file __openerp__.py +*/ + + +openerp.pos_gift_ticket = function (instance) { + var _t = instance.web._t, + _lt = instance.web._lt; + var QWeb = instance.web.qweb; + + instance.point_of_sale.ReceiptScreenWidget.include({ + show: function(){ + this._super() + var self = this; + var print_gift_ticket_button = this.add_action_button({ + label: _t('Gift Ticket'), + icon: '/point_of_sale/static/src/img/icons/png48/printer.png', + click: function(){ + self.print_gift(); + }, + }); + }, + refresh_gift_ticket: function(){ + var order = this.pos.get('selectedOrder'); + $('.pos-receipt-container', this.$el).html(QWeb.render('PosGiftTicket',{ + widget:this, + order: order, + orderlines: order.get('orderLines').models, + })); + }, + print: function() { + this.refresh() + this._super() + }, + print_gift: function() { + this.refresh_gift_ticket() + this.pos.get('selectedOrder')._printed = true; + setTimeout(function() { + window.print(); + }, 2000); + // window.print(); + }, + }); + +}; diff --git a/pos_gift_ticket/static/src/xml/pos.xml b/pos_gift_ticket/static/src/xml/pos.xml new file mode 100644 index 00000000..1718d3ce --- /dev/null +++ b/pos_gift_ticket/static/src/xml/pos.xml @@ -0,0 +1,55 @@ + + + + + + + + + + +
+ +
+
+
+
+
+ Phone:
+ User:
+ Shop:
+
+ +
+ +
+
+
+
GIFT TICKET
+
+ + + + + + + + + +
+ + + +
+ +
+
+ +
+
+
+
+ +
\ No newline at end of file diff --git a/pos_gift_ticket/views/pos_template.xml b/pos_gift_ticket/views/pos_template.xml new file mode 100644 index 00000000..b02e02f8 --- /dev/null +++ b/pos_gift_ticket/views/pos_template.xml @@ -0,0 +1,14 @@ + + + + + + + \ No newline at end of file