Browse Source

Merge pull request #45 from factorlibre/8.0_pos_gift_ticket

[ADD] Pos Gift Ticket Module
pull/51/merge
Sylvain LE GAL 9 years ago
parent
commit
8493b25c3f
  1. 60
      pos_gift_ticket/README.rst
  2. 0
      pos_gift_ticket/__init__.py
  3. 39
      pos_gift_ticket/__openerp__.py
  4. 53
      pos_gift_ticket/i18n/es.po
  5. 52
      pos_gift_ticket/i18n/pos_gift_ticket.pot
  6. 48
      pos_gift_ticket/static/src/js/main.js
  7. 55
      pos_gift_ticket/static/src/xml/pos.xml
  8. 14
      pos_gift_ticket/views/pos_template.xml

60
pos_gift_ticket/README.rst

@ -0,0 +1,60 @@
.. 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.
Known issues / Roadmap
======================
Missing features
----------------
* Not tested with a **PosBox setting** so surely will not work if *'print by
proxy'* is enabled.
Credits
=======
Contributors
------------
* Ismael Calvo <ismael.calvo@factorlibre.com>
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.

0
pos_gift_ticket/__init__.py

39
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 <ismael.calvo@factorlibre.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": "Gift Ticket",
"version": "0.1",
"author": "FactorLibre, Odoo Community Association (OCA)",
"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,
}

53
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 <ismael.calvo@factorlibre.com>\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:"

52
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 ""

48
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 <ismael.calvo@factorlibre.com>
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();
},
});
};

55
pos_gift_ticket/static/src/xml/pos.xml

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-extend="PosTicket">
<t t-jquery=".pos-center-align t:first" t-operation="replace">
<t t-esc="order.get('creationDate').toString(Date.CultureInfo.formatPatterns.shortDate + ' ' +
Date.CultureInfo.formatPatterns.longTime)"/>
</t>
</t>
<t t-name="PosGiftTicket">
<div class="pos-sale-ticket">
<div class="pos-center-align">
<t t-esc="order.get('creationDate').toString(Date.CultureInfo.formatPatterns.shortDate + ' ' +
Date.CultureInfo.formatPatterns.longTime)"/><br />
<t t-esc="order.get('name')"/></div>
<br />
<t t-esc="widget.pos.company.name"/><br />
Phone: <t t-esc="widget.pos.company.phone || ''"/><br />
User: <t t-esc="widget.pos.cashier ? widget.pos.cashier.name : widget.pos.user.name"/><br />
Shop: <t t-esc="widget.pos.shop.name"/><br />
<br />
<t t-if="widget.pos.config.receipt_header">
<div style='text-align:center'>
<t t-esc="widget.pos.config.receipt_header" />
</div>
<br />
</t>
<div class="pos-center-align" style="font-size:1.2em;font-weight:bold;">GIFT TICKET</div>
<br />
<table>
<colgroup>
<col width='75%' />
<col width='25%' />
</colgroup>
<tr t-foreach="orderlines" t-as="orderline">
<td>
<t t-esc="orderline.get_product().display_name"/>
</td>
<td class="pos-right-align">
<t t-esc="orderline.get_quantity_str_with_unit()"/>
</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>
</templates>

14
pos_gift_ticket/views/pos_template.xml

@ -0,0 +1,14 @@
<openerp>
<data>
<template id="pos_gift_ticket_assets_backend"
name="pos_gift_ticket_assets_backend"
inherit_id="point_of_sale.assets_backend">
<xpath expr="." position="inside">
<script src="/pos_gift_ticket/static/src/js/main.js"
type="text/javascript"></script>
</xpath>
</template>
</data>
</openerp>
Loading…
Cancel
Save