diff --git a/pos_quick_payment/README.rst b/pos_quick_payment/README.rst new file mode 100644 index 000000000..28cb4b975 --- /dev/null +++ b/pos_quick_payment/README.rst @@ -0,0 +1,28 @@ +===================== +Pos Quick Payment V10 +===================== + +This module add extra quick payment buttons in pos payment screen + +Installation +============ + +Just select it from available modules to install it, there is no need to extra installations. + +Configuration +============= + +* Using the Boolean button in POS configuration you can enable quick payment option. +* Once you have enabled it, there is an option for adding quick payment journal and quick payment options. + +Features +======== + +* Quick payment option in POS session configuration. +* Extra payment buttons for quick payment + +Credits +======= +Developer: Aswani pc @ cybrosys + + diff --git a/pos_quick_payment/__init__.py b/pos_quick_payment/__init__.py new file mode 100644 index 000000000..a458e962f --- /dev/null +++ b/pos_quick_payment/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Aswani PC() +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) 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 . +# +################################################################################### +from . import models diff --git a/pos_quick_payment/__manifest__.py b/pos_quick_payment/__manifest__.py new file mode 100644 index 000000000..718422c55 --- /dev/null +++ b/pos_quick_payment/__manifest__.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Aswani PC() +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) 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': "Pos Quick Payment", + 'version': '10.0.1.0.0', + 'summary': """Quick Payment Buttons In POS""", + 'description': """ + This module add extra quick payment buttons in pos payment screen. + """, + 'author': "Cybrosys Techno Solutions", + 'maintainer': 'Cybrosys Techno Solutions', + 'company': "Cybrosys Techno Solutions", + 'website': "https://www.cybrosys.com", + 'category': 'Point Of Sale', + 'depends': ['point_of_sale'], + 'data': [ + 'views/views.xml', + 'views/templates.xml', + ], + 'qweb': ['static/src/xml/pos_quick_payment.xml'], + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, +} diff --git a/pos_quick_payment/models/__init__.py b/pos_quick_payment/models/__init__.py new file mode 100644 index 000000000..cde864bae --- /dev/null +++ b/pos_quick_payment/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import models diff --git a/pos_quick_payment/models/models.py b/pos_quick_payment/models/models.py new file mode 100644 index 000000000..4d797336a --- /dev/null +++ b/pos_quick_payment/models/models.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- + +from odoo import models, fields, api, _ +from odoo.exceptions import UserError + + +class PosSessionQuickPayment(models.Model): + _inherit = 'pos.config' + + quick_payment = fields.Boolean(string='Quick Payment') + payment_options = fields.Many2many('pos.quick.payment', string='Payment Options') + quick_payment_journal = fields.Many2one('account.journal', string='Payment Journal') + + @api.model + def create(self, vals): + if 'quick_payment' in vals and vals['quick_payment']: + if 'quick_payment_journal' not in vals: + raise UserError(_('Please configure journal for quick payment.')) + return super(PosSessionQuickPayment, self).create(vals) + + @api.multi + def write(self, vals): + if 'quick_payment' in vals and vals['quick_payment']: + if 'quick_payment_journal' not in vals: + raise UserError(_('Please configure journal for quick payment.')) + return super(PosSessionQuickPayment, self).write(vals) + + +class PosQuickPayment(models.Model): + _name = 'pos.quick.payment' + + name = fields.Char(string='Amount') + note = fields.Text(string='Note') diff --git a/pos_quick_payment/security/ir.model.access.csv b/pos_quick_payment/security/ir.model.access.csv new file mode 100644 index 000000000..cf8e9b553 --- /dev/null +++ b/pos_quick_payment/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_pos_quick_payment,pos.quick.payment,model_pos_quick_payment,,1,0,0,0 \ No newline at end of file diff --git a/pos_quick_payment/static/description/banner.jpg b/pos_quick_payment/static/description/banner.jpg new file mode 100644 index 000000000..1e3120d36 Binary files /dev/null and b/pos_quick_payment/static/description/banner.jpg differ diff --git a/pos_quick_payment/static/description/cybro_logo.png b/pos_quick_payment/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/pos_quick_payment/static/description/cybro_logo.png differ diff --git a/pos_quick_payment/static/description/icon.png b/pos_quick_payment/static/description/icon.png new file mode 100644 index 000000000..77495e373 Binary files /dev/null and b/pos_quick_payment/static/description/icon.png differ diff --git a/pos_quick_payment/static/description/index.html b/pos_quick_payment/static/description/index.html new file mode 100644 index 000000000..95788122c --- /dev/null +++ b/pos_quick_payment/static/description/index.html @@ -0,0 +1,93 @@ +
+
+

Pos Quick Payment

+

Quick payment buttons in POS

+

Cybrosys Technologies

+
+
+

Features:

+
+ Quick payment option in POS session configuration
+ Extra payment buttons for quick payment
+
+
+
+ +
+
+
+
+

Overview

+

+ 'POS Quick Payment' adds extra buttons corresponding to possible denominations of currency. Using this Hot keys the user can make payments very quickly. +

+
+
+
+
+ +
+
+
+

Configuration

+

Using the Boolean button in POS configuration you can enable quick payment option. Once you have enabled it, there is an option for adding quick payment journal and quick payment options.

+
+
+ +
+
+
+
+
+ +
+
+
+

Quick Payment Buttons

+
+
+ +
+
+
+
+
+ +
+
+
+

The added quick payment options will be displayed as buttons in POS screen. Click any of the buttons to add the amount to the payment line.

+
+
+ +
+
+
+
+
+ +
+

Need Any Help?

+ +
diff --git a/pos_quick_payment/static/description/quick_payment_1.png b/pos_quick_payment/static/description/quick_payment_1.png new file mode 100644 index 000000000..9a4fae7bc Binary files /dev/null and b/pos_quick_payment/static/description/quick_payment_1.png differ diff --git a/pos_quick_payment/static/description/quick_payment_2.png b/pos_quick_payment/static/description/quick_payment_2.png new file mode 100644 index 000000000..5328df6f8 Binary files /dev/null and b/pos_quick_payment/static/description/quick_payment_2.png differ diff --git a/pos_quick_payment/static/description/quick_payment_3.png b/pos_quick_payment/static/description/quick_payment_3.png new file mode 100644 index 000000000..5d5f68157 Binary files /dev/null and b/pos_quick_payment/static/description/quick_payment_3.png differ diff --git a/pos_quick_payment/static/src/css/pos_quick_payment.css b/pos_quick_payment/static/src/css/pos_quick_payment.css new file mode 100644 index 000000000..c5a2d9237 --- /dev/null +++ b/pos_quick_payment/static/src/css/pos_quick_payment.css @@ -0,0 +1,48 @@ +.screen .middle-content{ + position: absolute; + top: 64px; bottom: 0px; + right: 62%; + overflow-x: hidden; + overflow-y: auto; + border-right: dashed 1px rgb(215,215,215); +} +.screen .left-content.pc40{ + right: 70% !important; +} + +.screen .right-content.pc60{ + left: 38% !important; +} + +.quick_payment_list { + margin: 10px; +} +.quick_payment_list .button { + background: #e2e2e2; + line-height: 40px; + font-size: 16px; + width :60px; + border: solid 1px rgb(202, 202, 202); + border-top-width: 0px; + cursor: pointer; + text-align: center; +} +.quick_payment_list .button:first-child { + border-top-width: 1px; + border-top-left-radius: 3px; + border-top-right-radius: 3px; +} +.quick_payment_list .button:last-child { + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; +} +.quick_payment_list .button:active { + background: black; + border-color: black; + color: white; +} +.quick_payment_list .button.active { + background: #6EC89B; + color: white; + border-color: #6EC89B; +} diff --git a/pos_quick_payment/static/src/js/pos_quick_payment.js b/pos_quick_payment/static/src/js/pos_quick_payment.js new file mode 100644 index 000000000..5d46d5e56 --- /dev/null +++ b/pos_quick_payment/static/src/js/pos_quick_payment.js @@ -0,0 +1,91 @@ +odoo.define('pos_quick_payment.quick_payment', function (require) { +"use strict"; + +var PosBaseWidget = require('point_of_sale.BaseWidget'); +var gui = require('point_of_sale.gui'); +var models = require('point_of_sale.models'); +var core = require('web.core'); +var Model = require('web.DataModel'); +var utils = require('web.utils'); +var formats = require('web.formats'); + +var screens = require('point_of_sale.screens'); +var PaymentScreenWidget = screens.PaymentScreenWidget; + +var QWeb = core.qweb; +var _t = core._t; + +var round_pr = utils.round_precision; + +models.load_models({ + model: 'pos.quick.payment', + fields: ['name'], + domain: function(self){ return [['id','in',self.config.payment_options]];}, + loaded: function(self, quick_payments){ + self.quick_payments = quick_payments; + }, + }); + +PaymentScreenWidget.include({ + renderElement: function() { + this._super(); + if (this.pos.config.quick_payment){ + var quick_payment = this.render_quick_payment(); + quick_payment.appendTo(this.$('.quick_payment-container')); + } + + + }, + + render_quick_payment: function() { + var self = this; + var quick_payment = $(QWeb.render('PaymentScreen-QuickPayment', { widget:this })); + quick_payment.on('click','.quick_payment',function(){ + self.click_quick_payment($(this).data('value')); + }); + return quick_payment; + }, + + click_quick_payment: function(value){ + var self = this; + var paymentlines = this.pos.get_order().get_paymentlines(); + var open_paymentline = false; + var payment_line = null; + var cashregister = null; + if(! self.pos.config.quick_payment_journal){ + self.gui.show_popup('alert',{ + 'title': 'No journal configured', + 'body': 'Please configure journal for quick payment.', + }); + } + else{ + for (var i = 0; i < paymentlines.length; i++) { + if (paymentlines[i].cashregister.journal_id[0] === self.pos.config.quick_payment_journal[0]) { + open_paymentline = true; + payment_line = paymentlines[i]; + break; + } + } + if (! open_paymentline){ + for ( var i = 0; i < self.pos.cashregisters.length; i++ ) { + if ( self.pos.cashregisters[i].journal_id[0] === self.pos.config.quick_payment_journal[0]){ + cashregister = self.pos.cashregisters[i]; + break; + } + } + this.pos.get_order().add_paymentline(cashregister); + this.reset_input(); + this.render_paymentlines(); + this.payment_input(value); + } + else{ + this.pos.get_order().select_paymentline(payment_line); + this.reset_input(); + this.render_paymentlines(); + this.payment_input(payment_line.amount+value); + } + } + } +}); + +}); \ No newline at end of file diff --git a/pos_quick_payment/static/src/xml/pos_quick_payment.xml b/pos_quick_payment/static/src/xml/pos_quick_payment.xml new file mode 100644 index 000000000..8846abc99 --- /dev/null +++ b/pos_quick_payment/static/src/xml/pos_quick_payment.xml @@ -0,0 +1,22 @@ + + + + +
+
+
+
+
+
+ + +
+ +
+ +
+
+
+
+
+
diff --git a/pos_quick_payment/views/templates.xml b/pos_quick_payment/views/templates.xml new file mode 100644 index 000000000..c2ae16ce5 --- /dev/null +++ b/pos_quick_payment/views/templates.xml @@ -0,0 +1,11 @@ + + + +