[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
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user