feat: add configurable setting to hide Cash In/Out button in POS navbar and update portrait mode layout styles
This commit is contained in:
parent
19f189dab7
commit
593884ab7b
2
__init__.py
Normal file
2
__init__.py
Normal file
@ -0,0 +1,2 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import models
|
||||
@ -18,7 +18,9 @@ Features
|
||||
""",
|
||||
'author': "Suherdy Yacob",
|
||||
'depends': ['point_of_sale'],
|
||||
'data': [],
|
||||
'data': [
|
||||
'views/res_config_settings_views.xml',
|
||||
],
|
||||
'assets': {
|
||||
'point_of_sale._assets_pos': [
|
||||
# Incremental rendering patches (existing)
|
||||
|
||||
3
models/__init__.py
Normal file
3
models/__init__.py
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import pos_config
|
||||
from . import res_config_settings
|
||||
18
models/pos_config.py
Normal file
18
models/pos_config.py
Normal 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
|
||||
11
models/res_config_settings.py
Normal file
11
models/res_config_settings.py
Normal 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
|
||||
)
|
||||
@ -12,4 +12,7 @@ patch(Navbar.prototype, {
|
||||
toggleDisplayMode() {
|
||||
this.portraitMode.toggle();
|
||||
},
|
||||
get showCashMoveButton() {
|
||||
return this.pos.showCashMoveButton && !this.pos.config.hide_cash_in_out_button;
|
||||
},
|
||||
});
|
||||
|
||||
@ -90,6 +90,12 @@
|
||||
// Push content above the fixed footer (pay strip ~52px + tab bar ~60px + gap)
|
||||
padding-bottom: 122px !important;
|
||||
overflow: hidden;
|
||||
|
||||
.overflow-y-auto {
|
||||
flex-grow: 1 !important;
|
||||
flex-shrink: 1 !important;
|
||||
min-height: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---- 2-COLUMN PRODUCT GRID ---- */
|
||||
|
||||
15
views/res_config_settings_views.xml
Normal file
15
views/res_config_settings_views.xml
Normal 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>
|
||||
Loading…
Reference in New Issue
Block a user