Browse Source

Sep 13: [FIX] Bug fixed 'pos_access_right_hr'

pull/309/merge
Risvana Cybro 1 week ago
parent
commit
8011deba55
  1. 6
      pos_access_right_hr/__manifest__.py
  2. 5
      pos_access_right_hr/doc/RELEASE_NOTES.md
  3. BIN
      pos_access_right_hr/static/src/img/download.png
  4. 18
      pos_access_right_hr/static/src/js/ProductScreen.js
  5. 47
      pos_access_right_hr/static/src/xml/ActionpadWidget.xml

6
pos_access_right_hr/__manifest__.py

@ -21,7 +21,7 @@
################################################################################ ################################################################################
{ {
'name': 'POS Access Right', 'name': 'POS Access Right',
'version': '17.0.2.1.2', 'version': '17.0.2.1.4',
"category": 'Point of Sale', "category": 'Point of Sale',
'summary': 'To Restrict POS features for cashiers', 'summary': 'To Restrict POS features for cashiers',
'description': 'This app allows you to enable or disable POS features ' 'description': 'This app allows you to enable or disable POS features '
@ -30,7 +30,7 @@
'company': 'Cybrosys Techno Solutions', 'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions', 'maintainer': 'Cybrosys Techno Solutions',
'website': 'https://www.cybrosys.com/', 'website': 'https://www.cybrosys.com/',
'depends': ['pos_hr'], 'depends': ['point_of_sale','pos_hr', 'pos_restaurant'],
'data': [ 'data': [
'views/hr_employee_views.xml', 'views/hr_employee_views.xml',
], ],
@ -39,7 +39,7 @@
'pos_access_right_hr/static/src/js/PosStore.js', 'pos_access_right_hr/static/src/js/PosStore.js',
'pos_access_right_hr/static/src/js/ActionpadWidget.js', 'pos_access_right_hr/static/src/js/ActionpadWidget.js',
'pos_access_right_hr/static/src/js/ProductScreen.js', 'pos_access_right_hr/static/src/js/ProductScreen.js',
'pos_access_right_hr/static/src/xml/ActionpadWidget.xml' 'pos_access_right_hr/static/src/xml/ActionpadWidget.xml',
], ],
}, },
'images': ['static/description/banner.jpg'], 'images': ['static/description/banner.jpg'],

5
pos_access_right_hr/doc/RELEASE_NOTES.md

@ -20,3 +20,8 @@
#### Version 17.0.2.1.3 #### Version 17.0.2.1.3
##### BUG_FIX ##### BUG_FIX
- Bug fix: POS Restaurant session failed to load correctly. - Bug fix: POS Restaurant session failed to load correctly.
#### 10.09.2025
#### Version 17.0.2.1.4
##### BUG_FIX
- Bug fix: Updated module with restricted keyboard events.

BIN
pos_access_right_hr/static/src/img/download.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

18
pos_access_right_hr/static/src/js/ProductScreen.js

@ -25,16 +25,30 @@ patch(ProductScreen.prototype, {
{ value: "-", text: "+/-", disabled: this.pos.cashier?.disable_plus_minus }, { value: "-", text: "+/-", disabled: this.pos.cashier?.disable_plus_minus },
{ value: "0", disabled: this.pos.cashier?.disable_numpad }, { value: "0", disabled: this.pos.cashier?.disable_numpad },
{ value: this.env.services.localization.decimalPoint, disabled: this.pos.cashier?.disable_numpad }, { value: this.env.services.localization.decimalPoint, disabled: this.pos.cashier?.disable_numpad },
// Unicode: https://www.compart.com/en/unicode/U+232B
{ value: "Backspace", text: "⌫", disabled: this.pos.cashier?.disable_remove_button }, { value: "Backspace", text: "⌫", disabled: this.pos.cashier?.disable_remove_button },
].map((button) => ({ ].map((button) => ({
...button, ...button,
class: this.pos.numpadMode === button.value ? "active border-primary" : "", class: this.pos.numpadMode === button.value ? "active border-primary" : "",
})); }));
}, },
async updateSelectedOrderline({ buffer, key }) {
const cashier = this.pos?.cashier;
if (key === '-' && cashier?.disable_plus_minus) {
return; // Block minus key
} else if (key === '+' && cashier?.disable_plus_minus) {
return; // Block + key
}
else if (key === 'Backspace' && cashier?.disable_remove_button) {
return; // Block remove/backspace key
} else if (/^[0-9]$/.test(key) && cashier?.disable_numpad) {
return; // Block numpad input
}
return super.updateSelectedOrderline({ buffer, key });
},
disable_payment() { disable_payment() {
if (this.pos.cashier?.disable_payment) { if (this.pos.cashier?.disable_payment) {
return true; return true;
} else { } else {
return false; return false;

47
pos_access_right_hr/static/src/xml/ActionpadWidget.xml

@ -1,15 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve"> <templates xml:space="preserve">
<!-- Inheriting ActionpadWidget template for adding the button disable feature-->
<t name="pos_access_right_hr.ActionpadWidget" owl="1"
t-inherit="point_of_sale.ActionpadWidget" t-inherit-mode="extension">
<xpath expr="//button[hasclass('pay-order-button')]" position="attributes">
<attribute name="t-att-disabled">disable_payment()</attribute>
</xpath>
<xpath expr="//button[hasclass('set-partner')]" position="attributes">
<attribute name="t-att-disabled">disable_customer()</attribute>
</xpath>
</t>
<!-- Inheriting ProductScreen template for adding the button disable feature --> <!-- Inheriting ProductScreen template for adding the button disable feature -->
<t name="pos_access_right_hr.ProductScreen" owl="1" <t name="pos_access_right_hr.ProductScreen" owl="1"
t-inherit="pos_restaurant.SplitBillScreen" t-inherit-mode="extension"> t-inherit="pos_restaurant.SplitBillScreen" t-inherit-mode="extension">
@ -17,4 +7,41 @@
<attribute name="t-att-disabled">disable_payment()</attribute> <attribute name="t-att-disabled">disable_payment()</attribute>
</xpath> </xpath>
</t> </t>
<t t-name="pos_access_right_hr.ActionpadWidget" t-inherit="point_of_sale.ActionpadWidget" t-inherit-mode="extension">
<xpath expr="//div[hasclass('actionpad')]" position="replace">
<div class="actionpad d-flex flex-column flex-grow-1 mw-50 p-0 border-end">
<button class="button mobile-more-button btn btn-secondary flex-fill border-bottom"
t-if="ui.isSmall and props.onClickMore" t-on-click="props.onClickMore">
<span>More...</span>
</button>
<button class="button set-partner btn btn-light rounded-0 py-2 flex-shrink-1 fw-bolder"
t-att-disabled="disable_customer()"
t-on-click="() => this.pos.selectPartner()">
<div class="d-flex justify-content-center align-items-center ">
<span class="d-flex justify-content-center align-items-center rounded-circle me-2 text-bg-dark"
t-if="!ui.isSmall">
<i class="fa fa-user" role="img" aria-label="Customer" title="Customer"/>
</span>
<div t-if="props.partner" class="text-truncate fw-bolder text-action">
<t t-esc="props.partner.name"/>
</div>
<div t-else="fw-bolder">
Customer
</div>
</div>
</button>
<button class="pay validation pay-order-button btn-primary"
t-att-disabled="disable_payment()"
t-attf-class="{{getMainButtonClasses()}}"
t-att-class="{ 'with-more-button': props.onClickMore and ui.isSmall }"
t-on-click="props.actionToTrigger ? this.props.actionToTrigger : () => pos.get_order().pay()">
<div class="pay-circle d-flex align-items-center justify-content-center py-2 mb-2">
<i class="oi oi-chevron-right" role="img" aria-label="Pay" title="Pay"/>
</div>
<t class="text-white" t-esc="props.actionName"/>
</button>
</div>
</xpath>
</t>
</templates> </templates>

Loading…
Cancel
Save