Browse Source

[ADD] Initial Commit

pull/45/head
SHEREEF PT 7 years ago
parent
commit
cdc29b68ee
  1. 28
      pos_quick_payment/README.rst
  2. 22
      pos_quick_payment/__init__.py
  3. 44
      pos_quick_payment/__manifest__.py
  4. 3
      pos_quick_payment/models/__init__.py
  5. 33
      pos_quick_payment/models/models.py
  6. 2
      pos_quick_payment/security/ir.model.access.csv
  7. BIN
      pos_quick_payment/static/description/banner.jpg
  8. BIN
      pos_quick_payment/static/description/cybro_logo.png
  9. BIN
      pos_quick_payment/static/description/icon.png
  10. 93
      pos_quick_payment/static/description/index.html
  11. BIN
      pos_quick_payment/static/description/quick_payment_1.png
  12. BIN
      pos_quick_payment/static/description/quick_payment_2.png
  13. BIN
      pos_quick_payment/static/description/quick_payment_3.png
  14. 48
      pos_quick_payment/static/src/css/pos_quick_payment.css
  15. 91
      pos_quick_payment/static/src/js/pos_quick_payment.js
  16. 22
      pos_quick_payment/static/src/xml/pos_quick_payment.xml
  17. 11
      pos_quick_payment/views/templates.xml
  18. 25
      pos_quick_payment/views/views.xml

28
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

22
pos_quick_payment/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
###################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Author: Aswani PC(<https://www.cybrosys.com>)
#
# 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 <http://www.gnu.org/licenses/>.
#
###################################################################################
from . import models

44
pos_quick_payment/__manifest__.py

@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
###################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Author: Aswani PC(<https://www.cybrosys.com>)
#
# 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 <http://www.gnu.org/licenses/>.
#
###################################################################################
{
'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,
}

3
pos_quick_payment/models/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import models

33
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')

2
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
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_pos_quick_payment pos.quick.payment model_pos_quick_payment 1 0 0 0

BIN
pos_quick_payment/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

BIN
pos_quick_payment/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
pos_quick_payment/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

93
pos_quick_payment/static/description/index.html

@ -0,0 +1,93 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan">Pos Quick Payment</h2>
<h3 class="oe_slogan">Quick payment buttons in POS</h3>
<h4 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a></h4>
</div>
<div class="oe_row oe_spaced" style="padding-left:65px;">
<h4>Features:</h4>
<div>
<span style="color:green;"> &#9745; </span>Quick payment option in POS session configuration<br/>
<span style="color:green;"> &#9745; </span>Extra payment buttons for quick payment<br/>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="" style="text-align: center;">
<div class="oe_picture">
<h3 class="oe_slogan">Overview</h3>
<p class="oe_mt32">
'POS Quick Payment' adds extra buttons corresponding to possible denominations of currency. Using this Hot keys the user can make payments very quickly.
</p>
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="" style="text-align: center;">
<h3 class="oe_slogan">Configuration</h3>
<p>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.</p>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="quick_payment_1.png">
</div>
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="" style="text-align: center;">
<h3 class="oe_slogan">Quick Payment Buttons</h3>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="quick_payment_2.png">
</div>
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="" style="text-align: center;">
<p>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.</p>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="quick_payment_3.png">
</div>
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2>
<div class="oe_slogan" style="margin-top:10px !important;">
<div>
<a class="btn btn-primary btn-lg mt8"
style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com"><i
class="fa fa-envelope"></i> Email </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/contact/"><i
class="fa fa-phone"></i> Contact Us </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/odoo-customization-and-installation/"><i
class="fa fa-check-square"></i> Request Customization </a>
</div>
<br>
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
<div>
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td>
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td>
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td>
</div>
</div>
</section>

BIN
pos_quick_payment/static/description/quick_payment_1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

BIN
pos_quick_payment/static/description/quick_payment_2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
pos_quick_payment/static/description/quick_payment_3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

48
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;
}

91
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);
}
}
}
});
});

22
pos_quick_payment/static/src/xml/pos_quick_payment.xml

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-extend="PaymentScreenWidget">
<t t-jquery="div.left-content" t-operation="after">
<div class='middle-content pc40 touch-scrollable scrollable-y'>
<div class='quick_payment-container'>
</div>
</div>
</t>
</t>
<t t-name="PaymentScreen-QuickPayment">
<div class="quick_payment_list">
<t t-foreach="widget.pos.quick_payments" t-as="quick_payment">
<div class="button quick_payment" t-att-data-value="quick_payment.name">
<t t-esc="quick_payment.name" />
</div>
<br/>
</t>
</div>
</t>
</templates>

11
pos_quick_payment/views/templates.xml

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<template id="quick_payment_pos" inherit_id="point_of_sale.assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/pos_quick_payment/static/src/js/pos_quick_payment.js"/>
<link rel='stylesheet' href='/pos_quick_payment/static/src/css/pos_quick_payment.css'/>
</xpath>
</template>
</data>
</odoo>

25
pos_quick_payment/views/views.xml

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record id="view_pos_quick_payment_config_form" model="ir.ui.view">
<field name="name">pos.config.form.view</field>
<field name="model">pos.config</field>
<field name="inherit_id" ref="point_of_sale.view_pos_config_form"/>
<field name="arch" type="xml">
<field name="iface_print_skip_screen" position="after">
<field name="quick_payment"/>
</field>
<group name="features" position="after">
<group name="quick_payment" string="Quick Payment" attrs="{'invisible': [('quick_payment', '=', False)]}">
<group>
<field name="payment_options" widget="many2many_tags"/>
</group>
<group>
<field name="quick_payment_journal" />
</group>
</group>
</group>
</field>
</record>
</data>
</odoo>
Loading…
Cancel
Save