diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py
index af5d8b09b84..6b6fa8a9821 100644
--- a/addons/point_of_sale/point_of_sale.py
+++ b/addons/point_of_sale/point_of_sale.py
@@ -94,6 +94,7 @@ class pos_config(osv.osv):
'barcode_nomenclature_id': fields.many2one('barcode.nomenclature','Barcodes', help='Defines what kind of barcodes are available and how they are assigned to products, customers and cashiers', required=True),
'group_pos_manager_id': fields.many2one('res.groups','Point of Sale Manager Group', help='This field is there to pass the id of the pos manager group to the point of sale client'),
'group_pos_user_id': fields.many2one('res.groups','Point of Sale User Group', help='This field is there to pass the id of the pos user group to the point of sale client'),
+ 'tip_product_id': fields.many2one('product.product','Tip Product', help="The product used to encode the customer tip. Leave empty if you do not accept tips."),
}
def _check_cash_control(self, cr, uid, ids, context=None):
diff --git a/addons/point_of_sale/point_of_sale_view.xml b/addons/point_of_sale/point_of_sale_view.xml
index 64ddbc82fc5..9ea04a12d5b 100644
--- a/addons/point_of_sale/point_of_sale_view.xml
+++ b/addons/point_of_sale/point_of_sale_view.xml
@@ -700,6 +700,7 @@
+
diff --git a/addons/point_of_sale/static/src/css/pos.css b/addons/point_of_sale/static/src/css/pos.css
index 9ea9986d823..4961d278cb0 100644
--- a/addons/point_of_sale/static/src/css/pos.css
+++ b/addons/point_of_sale/static/src/css/pos.css
@@ -1179,6 +1179,8 @@ td {
border-top: 1px solid;
border-left: 1px solid;
border-color: #cacaca;
+ width: 296px;
+ overflow: hidden;
margin: 0;
}
.pos .payment-numpad .numpad button {
@@ -1267,6 +1269,9 @@ td {
position: relative;
transition: background-color, border-color, color 150ms linear;
}
+.payment-screen .payment-buttons .button:hover {
+ background-color: #efefef;
+}
.payment-screen .payment-buttons .button:first-child {
border-top-left-radius: 3px;
border-top-right-radius: 3px;
diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js
index 71d593961de..e409145f2f0 100644
--- a/addons/point_of_sale/static/src/js/models.js
+++ b/addons/point_of_sale/static/src/js/models.js
@@ -1470,6 +1470,33 @@ openerp.point_of_sale.load_models = function load_models(instance, module){ //mo
get_last_orderline: function(){
return this.orderlines.at(this.orderlines.length -1);
},
+ get_tip: function() {
+ var tip_product = this.pos.db.get_product_by_id(this.pos.config.tip_product_id[0]);
+ var lines = this.get_orderlines();
+ if (!tip_product) {
+ return 0;
+ } else {
+ for (var i = 0; i < lines.length; i++) {
+ if (lines[i].get_product() === tip_product) {
+ return lines[i].get_unit_price();
+ }
+ }
+ return 0;
+ }
+ },
+ set_tip: function(tip) {
+ var tip_product = this.pos.db.get_product_by_id(this.pos.config.tip_product_id[0]);
+ var lines = this.get_orderlines();
+ if (tip_product) {
+ for (var i = 0; i < lines.length; i++) {
+ if (lines[i].get_product() === tip_product) {
+ lines[i].set_unit_price(tip);
+ return;
+ }
+ }
+ this.add_product(tip_product, {quantity: 1, price: tip });
+ }
+ },
remove_orderline: function( line ){
this.assert_editable();
this.orderlines.remove(line);
diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js
index 9bcf9cb89b4..ed0b08f24de 100644
--- a/addons/point_of_sale/static/src/js/screens.js
+++ b/addons/point_of_sale/static/src/js/screens.js
@@ -1563,6 +1563,27 @@ openerp.point_of_sale.load_screens = function load_screens(instance, module){ //
this.$('.js_invoice').removeClass('highlight');
}
},
+ click_tip: function(){
+ var self = this;
+ var order = this.pos.get_order();
+ var tip = order.get_tip();
+ var change = order.get_change();
+ var value = tip;
+
+ if (tip === 0 && change > 0 ) {
+ value = change;
+ }
+
+ this.gui.show_popup('number',{
+ 'title': tip ? _t('Change Tip') : _t('Add Tip'),
+ 'value': value,
+ 'confirm': function(value) {
+ order.set_tip(Number(value));
+ self.order_changes();
+ self.render_paymentlines();
+ }
+ });
+ },
click_set_customer: function(){
this.gui.show_screen('clientlist');
},
@@ -1592,6 +1613,10 @@ openerp.point_of_sale.load_screens = function load_screens(instance, module){ //
this.$('.js_set_customer').click(function(){
self.click_set_customer();
});
+
+ this.$('.js_tip').click(function(){
+ self.click_tip();
+ });
this.$('.js_invoice').click(function(){
self.click_invoice();
});
diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml
index 4c77b710982..4335a520e2d 100644
--- a/addons/point_of_sale/static/src/xml/pos.xml
+++ b/addons/point_of_sale/static/src/xml/pos.xml
@@ -593,6 +593,11 @@
+
+
+ Tip
+
+
Open Cashbox