feat: add configurable setting to hide Cash In/Out button in POS navbar and update portrait mode layout styles

This commit is contained in:
Suherdy Yacob 2026-06-03 08:42:58 +07:00
parent 19f189dab7
commit 593884ab7b
8 changed files with 61 additions and 1 deletions

2
__init__.py Normal file
View File

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import models

View File

@ -18,7 +18,9 @@ Features
""", """,
'author': "Suherdy Yacob", 'author': "Suherdy Yacob",
'depends': ['point_of_sale'], 'depends': ['point_of_sale'],
'data': [], 'data': [
'views/res_config_settings_views.xml',
],
'assets': { 'assets': {
'point_of_sale._assets_pos': [ 'point_of_sale._assets_pos': [
# Incremental rendering patches (existing) # Incremental rendering patches (existing)

3
models/__init__.py Normal file
View File

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import pos_config
from . import res_config_settings

18
models/pos_config.py Normal file
View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from odoo import fields, models, api
class PosConfig(models.Model):
_inherit = 'pos.config'
hide_cash_in_out_button = fields.Boolean(
string="Hide Cash In/Out Button (Navbar)",
default=False,
help="Hide the Cash In/Out button in the POS Navbar menu"
)
@api.model
def _load_pos_data_fields(self, config):
fields_list = super()._load_pos_data_fields(config)
if fields_list:
fields_list.append('hide_cash_in_out_button')
return fields_list

View File

@ -0,0 +1,11 @@
# -*- coding: utf-8 -*-
from odoo import fields, models
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
pos_hide_cash_in_out_button = fields.Boolean(
string="Hide Cash In/Out Button (Navbar)",
related='pos_config_id.hide_cash_in_out_button',
readonly=False
)

View File

@ -12,4 +12,7 @@ patch(Navbar.prototype, {
toggleDisplayMode() { toggleDisplayMode() {
this.portraitMode.toggle(); this.portraitMode.toggle();
}, },
get showCashMoveButton() {
return this.pos.showCashMoveButton && !this.pos.config.hide_cash_in_out_button;
},
}); });

View File

@ -90,6 +90,12 @@
// Push content above the fixed footer (pay strip ~52px + tab bar ~60px + gap) // Push content above the fixed footer (pay strip ~52px + tab bar ~60px + gap)
padding-bottom: 122px !important; padding-bottom: 122px !important;
overflow: hidden; overflow: hidden;
.overflow-y-auto {
flex-grow: 1 !important;
flex-shrink: 1 !important;
min-height: 0 !important;
}
} }
/* ---- 2-COLUMN PRODUCT GRID ---- */ /* ---- 2-COLUMN PRODUCT GRID ---- */

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.pos_ui_optimization</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="point_of_sale.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//block[@id='pos_payment_section']" position="inside">
<setting string="Hide Cash In/Out (Navbar)" help="Hide Cash In/Out button in POS Navbar">
<field name="pos_hide_cash_in_out_button"/>
</setting>
</xpath>
</field>
</record>
</odoo>