From 8cd0127af300efd7f33bc45935912d75ca92f8b0 Mon Sep 17 00:00:00 2001 From: Joren Van Onder Date: Fri, 20 Nov 2015 12:57:41 +0100 Subject: [PATCH] [IMP] pos_discount: usability improvements regarding discount setup Before this, setting up the discount on a pos_config was a bit confusing. Although iface_discount was enabled by default on the pos_config, the discount button would not show up in the actual POS. The reason for this is that the discount button only shows up when a discount product has been set, and there is no default for that. So in order to make things a bit clearer the following has been done: - Group discount related options together - Only show discount product and default percentage field when using discount - Rename 'Discount percentage' -> 'Default percentage' - Default iface_discount to False (because a discount_product_id has to be manually set anyway) - Make discount_product_id required when discount is enabled - Only allow discount_product_id candidates that have available_in_pos set, because the POS frontend only loads those products --- addons/pos_discount/discount.py | 6 +++--- addons/pos_discount/views/views.xml | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/addons/pos_discount/discount.py b/addons/pos_discount/discount.py index a3b259d734c..3f558abe2a9 100644 --- a/addons/pos_discount/discount.py +++ b/addons/pos_discount/discount.py @@ -13,10 +13,10 @@ class pos_config(osv.osv): _inherit = 'pos.config' _columns = { 'iface_discount': fields.boolean('Order Discounts', help='Allow the cashier to give discounts on the whole order.'), - 'discount_pc': fields.float('Discount Percentage', help='The default discount percentage'), - 'discount_product_id': fields.many2one('product.product','Discount Product', help='The product used to model the discount'), + 'discount_pc': fields.float('Default Percentage', help='The default discount percentage'), + 'discount_product_id': fields.many2one('product.product','Discount Product', domain="[('available_in_pos', '=', True)]", + help='The product used to model the discount'), } _defaults = { - 'iface_discount': True, 'discount_pc': 10, } diff --git a/addons/pos_discount/views/views.xml b/addons/pos_discount/views/views.xml index fd75259e924..a827bda5e1b 100644 --- a/addons/pos_discount/views/views.xml +++ b/addons/pos_discount/views/views.xml @@ -7,13 +7,13 @@ pos.config - - - - + + + + - +