Browse Source

Agrega un campo en la terminal de punto de venta para notas.

sebas 2 years ago
commit
8226750cf4

+ 4 - 0
README.rst

@@ -0,0 +1,4 @@
+Order Notes in Point of Sale Interface
+=====================================
+
+Description: https://apps.odoo.com/apps/modules/8.0/pos_notes/

+ 1 - 0
__init__.py

@@ -0,0 +1 @@
+from . import pos_notes

BIN
__init__.pyc


+ 46 - 0
__openerp__.py

@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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': 'Order Notes in Point of Sale Interface',
+    'version': '1.0.0',
+    'category': 'Point Of Sale',
+    'sequence': 6,
+    'summary': '',
+    'description': """
+        -
+
+    """,
+    'author': 'Tahir Aduragba',
+
+    'depends': ['point_of_sale'],
+    
+    'installable': True,
+
+    'data': ['templates.xml',
+        'view/pos_view.xml',
+        'view/pos_order_view.xml'
+    ],
+
+    'qweb': ['static/src/xml/pos_notes.xml'],
+
+    'auto_install': False,
+}

+ 36 - 0
pos_notes.py

@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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/>.
+#
+##############################################################################
+
+from openerp import models
+
+class point_of_sale(models.Model):
+    _inherit = ('pos.order')
+
+    def _order_fields(self, cr, uid, ui_order, context=None):
+        return {
+            'name':         ui_order['name'],
+            'user_id':      ui_order['user_id'] or False,
+            'session_id':   ui_order['pos_session_id'],
+            'lines':        ui_order['lines'],
+            'pos_reference':ui_order['name'],
+            'partner_id':   ui_order['partner_id'] or False,
+            'note': ui_order['note'],
+        }

BIN
pos_notes.pyc


+ 51 - 0
static/description/index.html

@@ -0,0 +1,51 @@
+<section class="oe_container">
+    <div class="oe_row oe_spaced">
+        <div class="oe_span12">
+            <h2 class="oe_slogan">Order notes in Point of Sale interface</h2>
+            <h3 class="oe_slogan">Let a cashier add notes to an order in the Point of Sale interface</h3>
+        </div>
+
+        <div class="oe_span6">
+            <div class="oe_demo oe_picture oe_screenshot">
+                <img src="screenshot_pos_interface.png"/>
+            </div>
+        </div>
+        <div class="oe_span6">
+            <p class="oe_mt32">
+                Allows a cashier input notes for an order on the payment page
+            </p>
+        </div>
+    </div>
+</section>
+
+<section class="oe_container oe_dark">
+    <div class="oe_row oe_spaced">
+        <div class="oe_span6">
+            <p class="oe_mt32">
+                Adds order notes in the POS orders form view 
+            </p>
+        </div>
+
+        <div class="oe_span6">
+            <div class="oe_demo oe_picture oe_screenshot">
+                <img src="screenshot_pos_form_view.png"/>
+            </div>
+        </div>
+    </div>
+</section>
+
+<section class="oe_container">
+    <div class="oe_row oe_spaced">
+        <div class="oe_span12">
+            <h2>Usage</h2>
+            <p class="oe_mt32">
+                There no any settings. Just install the module and start POS.
+            </p>
+            <p class="oe_mt32">
+                Works in offline mode.
+            </p>
+        </div>
+    </div>
+</section>
+
+

BIN
static/description/screenshot_pos_form_view.png


BIN
static/description/screenshot_pos_interface.png


+ 8 - 0
static/src/css/pos_notes.css

@@ -0,0 +1,8 @@
+.pos .pos-order-note {
+    width: 100%;
+    height: 50px;
+	box-sizing: border-box;
+	margin: 8px 0;
+	font-size: 16px;
+	resize: none;
+}

+ 77 - 0
static/src/js/pos_notes.js

@@ -0,0 +1,77 @@
+openerp.pos_notes = function(instance){
+    var module = instance.point_of_sale;
+    var QWeb = instance.web.qweb;
+    var _t = instance.web._t;
+
+	module.PaymentScreenWidget.include({
+        show: function(){
+            this._super();
+			this.update_input();
+		},
+        update_input: function(){
+            var self = this;
+            var contents = this.$('.pos-order-note-div');
+            contents.find('.pos-order-note').on('keyup',function(event){
+					self.pos.get('selectedOrder').set_note(this.value);
+                });
+        },
+
+	});
+
+    module.Order = module.Order.extend({
+        initialize: function(attributes){
+            Backbone.Model.prototype.initialize.apply(this, arguments);
+            this.pos = attributes.pos;
+            this.sequence_number = this.pos.pos_session.sequence_number++;
+            this.uid =     this.generateUniqueId();
+            this.set({
+                creationDate:   new Date(),
+                orderLines:     new module.OrderlineCollection(),
+                paymentLines:   new module.PaymentlineCollection(),
+                name:           _t("Order ") + this.uid,
+                client:         null,
+				note:          "",
+            });
+            this.selected_orderline   = undefined;
+            this.selected_paymentline = undefined;
+            this.screen_data = {};  // see ScreenSelector
+            this.receipt_type = 'receipt';  // 'receipt' || 'invoice'
+            this.temporary = attributes.temporary || false;
+            return this;
+        },
+
+        export_as_JSON: function() {
+            var orderLines, paymentLines;
+            orderLines = [];
+            (this.get('orderLines')).each(_.bind( function(item) {
+                return orderLines.push([0, 0, item.export_as_JSON()]);
+            }, this));
+            paymentLines = [];
+            (this.get('paymentLines')).each(_.bind( function(item) {
+                return paymentLines.push([0, 0, item.export_as_JSON()]);
+            }, this));
+            return {
+                name: this.getName(),
+                amount_paid: this.getPaidTotal(),
+                amount_total: this.getTotalTaxIncluded(),
+                amount_tax: this.getTax(),
+                amount_return: this.getChange(),
+                lines: orderLines,
+                statement_ids: paymentLines,
+                pos_session_id: this.pos.pos_session.id,
+                partner_id: this.get_client() ? this.get_client().id : false,
+                user_id: this.pos.cashier ? this.pos.cashier.id : this.pos.user.id,
+                uid: this.uid,
+                sequence_number: this.sequence_number,
+				note: this.get_note(),
+            };
+        },
+		get_note: function(){
+			return this.get('note');
+		},
+		set_note: function(note){
+			this.set('note', note);
+		},
+
+    });
+}

+ 17 - 0
static/src/xml/pos_notes.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<templates id="template" xml:space="preserve">
+	<t t-extend="PaymentScreenWidget" >
+        <t t-jquery=".pos-payment-container" t-operation="append">
+           <div class="pos-order-note-div">
+			   <br />
+
+			   <div>
+				   <span class="label">Nota:</span>
+				</div>
+                <input class="pos-order-note"/>
+            </div>
+
+        </t>
+    </t>
+
+</templates>

+ 15 - 0
templates.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <template id="assets_backend" name="point_of_sale assets2" inherit_id="web.assets_backend">
+            <xpath expr="." position="inside">
+                <script type="text/javascript" src="/pos_notes/static/src/js/pos_notes.js"></script>
+            </xpath>
+        </template>
+        <template id="index" name="pos_notes index" inherit_id="point_of_sale.index">
+            <xpath expr="//link[@id='pos-stylesheet']" position="after">
+                <link rel="stylesheet" href="/pos_notes/static/src/css/pos_notes.css" id="pos-notes-stylesheet"/>
+            </xpath>
+        </template>
+    </data>
+</openerp>

+ 17 - 0
view/pos_order_view.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <record id="pos_view_order_form" model="ir.ui.view">
+            <field name="name">pos.order.form</field>
+            <field name="model">pos.order</field>
+            <field name="inherit_id" ref="point_of_sale.view_pos_order_tree"/>
+            <field name="arch" type="xml">
+                <field name="partner_id" position="after">
+                    <field name="note"/>
+                </field>
+            </field>
+        </record>
+
+    </data>
+</openerp>

+ 21 - 0
view/pos_view.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <record id="view_pos_orderfilter_search3" model="ir.ui.view">
+            <field name="name">pos.order.filter.search3</field>
+            <field name="model">pos.order</field>
+            <field name="inherit_id" ref="point_of_sale.view_pos_order_filter" />
+            <field name="arch" type="xml">
+              <search>
+                 <field name="note" string="Nota Interna"/>
+                 
+               </search>
+            </field>
+        </record>
+
+
+        
+
+    </data>
+</openerp>