summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorJoren Van Onder <jov@odoo.com>2015-11-20 12:57:41 +0100
committerJoren Van Onder <jov@odoo.com>2015-11-20 13:33:44 +0100
commit8cd0127af300efd7f33bc45935912d75ca92f8b0 (patch)
tree8bb08ca5fe528266444524cfdbb6cd22c28d8713 /addons
parentebcc2ea4eb45f09d195c34d6cd1cecbb95093a32 (diff)
[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
Diffstat (limited to 'addons')
-rw-r--r--addons/pos_discount/discount.py6
-rw-r--r--addons/pos_discount/views/views.xml10
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 @@
<field name="model">pos.config</field>
<field name="inherit_id" ref="point_of_sale.view_pos_config_form" />
<field name="arch" type="xml">
- <xpath expr="//group[@name='features']/group[1]" position="inside">
- <field name='iface_discount' />
- </xpath>
<xpath expr="//group[@name='receipt']" position="after">
- <group string="Discounts" col="4" >
+ <group string="Discounts">
+ <field name='iface_discount' />
+ </group>
+ <group col="4" attrs="{'invisible': [('iface_discount', '=', False)]}">
<field name='discount_pc' />
- <field name="discount_product_id" />
+ <field name='discount_product_id' attrs="{'required': [('iface_discount', '=', True)]}" />
</group>
</xpath>
</field>