[IMP] point_of_sale,pos_restaurant: move tipping to point_of_sale

You don't only tip in restaurants. In e.g. the US you can tip at a
barber shop.

It's not a big change since all the fields were already in
point_of_sale anyway.
This commit is contained in:
Joren Van Onder
2019-08-23 13:33:28 -07:00
parent ef153acbd6
commit aefe33735b
4 changed files with 28 additions and 31 deletions
@@ -319,6 +319,13 @@ class PosConfig(models.Model):
if any(self.available_pricelist_ids.mapped(lambda pl: pl.company_id.id not in (False, self.company_id.id))):
raise ValidationError(_("The selected pricelists must belong to no company or the company of the point of sale."))
@api.onchange('iface_tipproduct')
def _onchange_tipproduct(self):
if self.iface_tipproduct:
self.tip_product_id = self.env.ref('point_of_sale.product_product_tip', False)
else:
self.tip_product_id = False
@api.onchange('iface_print_via_proxy')
def _onchange_iface_print_via_proxy(self):
self.iface_print_auto = self.iface_print_via_proxy
@@ -372,6 +372,27 @@
</div>
</div>
</div>
<div class="col-12 col-lg-6 o_setting_box"
id="iface_tipproduct"
title="This product is used as reference on customer receipts.">
<div class="o_setting_left_pane">
<field name="iface_tipproduct"/>
</div>
<div class="o_setting_right_pane">
<label for="tip_product_id" string="Tips"/>
<div class="text-muted">
Accept customer tips or convert their change to a tip
</div>
<div class="content-group" attrs="{'invisible': [('iface_tipproduct', '=', False)]}">
<div class="mt16">
<label string="Tip Product" for="tip_product_id" class="o_light_label"/>
<field name="tip_product_id"
domain="[('available_in_pos', '=', True)]"
context="{'default_available_in_pos': True}"/>
</div>
</div>
</div>
</div>
</div>
<h2>Bills &amp; Receipts</h2>
<div class="row mt16 o_settings_container" id="receipt">
@@ -16,19 +16,11 @@ class PosConfig(models.Model):
is_order_printer = fields.Boolean('Order Printer')
module_pos_restaurant = fields.Boolean(default=True)
@api.onchange('iface_tipproduct')
def _onchange_tipproduct(self):
if self.iface_tipproduct:
self.tip_product_id = self.env.ref('point_of_sale.product_product_tip', False)
else:
self.tip_product_id = False
@api.onchange('module_pos_restaurant')
def _onchange_module_pos_restaurant(self):
if not self.module_pos_restaurant:
self.update({'iface_printbill': False,
'iface_splitbill': False,
'iface_tipproduct': False,
'is_order_printer': False,
'is_table_management': False,
'iface_orderline_notes': False})
@@ -36,29 +36,6 @@
</div>
</div>
</div>
<div class="col-12 col-lg-6 o_setting_box"
id="iface_tipproduct"
title="This product is used as reference on customer receipts."
attrs="{'invisible': [('module_pos_restaurant', '=', False)]}">
<div class="o_setting_left_pane">
<field name="iface_tipproduct"/>
</div>
<div class="o_setting_right_pane">
<label for="tip_product_id" string="Tips"/>
<span class="fa fa-lg fa-cutlery" title="For bars and restaurants" role="img" aria-label="For bars and restaurants"/>
<div class="text-muted">
Accept customer tips or convert their change to a tip
</div>
<div class="content-group" attrs="{'invisible': [('iface_tipproduct', '=', False)]}">
<div class="mt16">
<label string="Tip Product" for="tip_product_id" class="o_light_label"/>
<field name="tip_product_id"
domain="[('available_in_pos', '=', True)]"
context="{'default_available_in_pos': True}"/>
</div>
</div>
</div>
</div>
</div>
<div id="barcode_scanner" position="after">
<div class="col-12 col-lg-6 o_setting_box"