[IMP] pos_restaurant: make the internal note available for shop

Allow pos users to have the "internal note" button available even in
non-restaurant shops.

The changes also make sure that the button is disabled when there is no selected
orderline.

closes odoo/odoo#162863

Task-id: 3878947
Signed-off-by: Vlad Stroia (vlst) <vlst@odoo.com>
This commit is contained in:
Joseph Caburnay
2024-04-25 11:21:51 +00:00
parent a2a59d1e69
commit a1ee8f4d94
4 changed files with 7 additions and 8 deletions
@@ -69,7 +69,6 @@ class PosConfig(models.Model):
vals['iface_splitbill'] = True
if not is_restaurant or not vals.get('iface_tipproduct', False):
vals['set_tip_after_payment'] = False
vals["iface_orderline_notes"] = is_restaurant
pos_configs = super().create(vals_list)
for config in pos_configs:
if config.module_pos_restaurant:
@@ -7,7 +7,7 @@ class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
pos_floor_ids = fields.Many2many(related='pos_config_id.floor_ids', readonly=False)
pos_iface_orderline_notes = fields.Boolean(compute='_compute_pos_module_pos_restaurant', store=True, readonly=False)
pos_iface_orderline_notes = fields.Boolean(related='pos_config_id.iface_orderline_notes', readonly=False)
pos_iface_printbill = fields.Boolean(compute='_compute_pos_module_pos_restaurant', store=True, readonly=False)
pos_iface_splitbill = fields.Boolean(compute='_compute_pos_module_pos_restaurant', store=True, readonly=False)
pos_set_tip_after_payment = fields.Boolean(compute='_compute_pos_set_tip_after_payment', store=True, readonly=False)
@@ -18,13 +18,11 @@ class ResConfigSettings(models.TransientModel):
for res_config in self:
if not res_config.pos_module_pos_restaurant:
res_config.update({
'pos_iface_orderline_notes': False,
'pos_iface_printbill': False,
'pos_iface_splitbill': False,
})
else:
res_config.update({
'pos_iface_orderline_notes': res_config.pos_config_id.iface_orderline_notes,
'pos_iface_printbill': res_config.pos_config_id.iface_printbill,
'pos_iface_splitbill': res_config.pos_config_id.iface_splitbill,
})
@@ -2,7 +2,7 @@
<templates id="template" xml:space="preserve">
<t t-name="pos_restaurant.OrderlineNoteButton">
<button class="control-button btn btn-light rounded-0 fw-bolder" t-on-click="() => this.click()">
<button class="control-button btn btn-light rounded-0 fw-bolder" t-on-click="() => this.click()" t-att-disabled="!selectedOrderline">
<i class="fa fa-tag me-1" />
<span> </span>
<span>Internal Note</span>
@@ -18,9 +18,6 @@
</div>
</div>
</setting>
<setting string="Internal Notes" help="Add internal notes on order lines for the kitchen" id="iface_orderline_notes" invisible="not pos_module_pos_restaurant">
<field name="pos_iface_orderline_notes"/>
</setting>
<setting string="Early Receipt Printing" help="Allow to print receipt before payment" id="iface_printbill" invisible="not pos_module_pos_restaurant or is_kiosk_mode">
<field name="pos_iface_printbill"/>
</setting>
@@ -42,6 +39,11 @@
<label class="fw-normal" for="pos_set_tip_after_payment" string="Add tip after payment"/>
</div>
</div>
<block id="pos_interface_section" position="inside">
<setting string="Internal Notes" help="Add internal notes on order lines for the kitchen" id="iface_orderline_notes">
<field name="pos_iface_orderline_notes"/>
</setting>
</block>
</field>
</record>
</odoo>