Browse Source

May 17: [FIX] Bug Fixed 'pos_access_right_hr'

pull/317/head
RisvanaCybro 1 year ago
parent
commit
156cf8ecd2
  1. 2
      pos_access_right_hr/__manifest__.py
  2. 6
      pos_access_right_hr/doc/RELEASE_NOTES.md
  3. 5
      pos_access_right_hr/static/src/js/ActionpadWidget.js
  4. 32
      pos_access_right_hr/static/src/js/ProductScreen.js
  5. 42
      pos_access_right_hr/static/src/xml/ActionpadWidget.xml

2
pos_access_right_hr/__manifest__.py

@ -21,7 +21,7 @@
################################################################################ ################################################################################
{ {
'name': 'POS Access Right', 'name': 'POS Access Right',
'version': '17.0.1.0.0', 'version': '17.0.2.1.1',
"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 '

6
pos_access_right_hr/doc/RELEASE_NOTES.md

@ -4,3 +4,9 @@
#### Version 17.0.1.0.0 #### Version 17.0.1.0.0
##### ADD ##### ADD
- Initial commit for POS Access Right - Initial commit for POS Access Right
#### 17.05.2024
#### Version 17.0.2.1.1
##### ADD
- Bug fix

5
pos_access_right_hr/static/src/js/ActionpadWidget.js

@ -8,14 +8,15 @@ patch(ActionpadWidget.prototype, {
super.setup(); super.setup();
}, },
disable_customer() { disable_customer() {
if (this.pos.cashier.disable_customer) { if (this.pos.cashier?.disable_customer) {
return true; return true;
} else { } else {
return false; return false;
} }
}, },
disable_payment() { disable_payment() {
if (this.pos.cashier.disable_payment) { console.log(this.pos.cashier?.disable_customer)
if (this.pos.cashier?.disable_payment) {
return true; return true;
} else { } else {
return false; return false;

32
pos_access_right_hr/static/src/js/ProductScreen.js

@ -10,23 +10,23 @@ patch(ProductScreen.prototype, {
}, },
getNumpadButtons() { getNumpadButtons() {
return [ return [
{ value: "1", disabled: this.pos.cashier.disable_numpad }, { value: "1", disabled: this.pos.cashier?.disable_numpad },
{ value: "2", disabled: this.pos.cashier.disable_numpad }, { value: "2", disabled: this.pos.cashier?.disable_numpad },
{ value: "3", disabled: this.pos.cashier.disable_numpad }, { value: "3", disabled: this.pos.cashier?.disable_numpad },
{ value: "quantity", text: "Qty", disabled: this.pos.cashier.disable_qty }, { value: "quantity", text: "Qty", disabled: this.pos.cashier?.disable_qty },
{ value: "4", disabled: this.pos.cashier.disable_numpad }, { value: "4", disabled: this.pos.cashier?.disable_numpad },
{ value: "5", disabled: this.pos.cashier.disable_numpad }, { value: "5", disabled: this.pos.cashier?.disable_numpad },
{ value: "6", disabled: this.pos.cashier.disable_numpad }, { value: "6", disabled: this.pos.cashier?.disable_numpad },
{ value: "discount", text: "% Disc", disabled: !this.pos.config.manual_discount || this.pos.cashier.disable_discount }, { value: "discount", text: "% Disc", disabled: !this.pos.config?.manual_discount || this.pos.cashier?.disable_discount },
{ value: "7", disabled: this.pos.cashier.disable_numpad }, { value: "7", disabled: this.pos.cashier?.disable_numpad },
{ value: "8", disabled: this.pos.cashier.disable_numpad }, { value: "8", disabled: this.pos.cashier?.disable_numpad },
{ value: "9", disabled: this.pos.cashier.disable_numpad }, { value: "9", disabled: this.pos.cashier?.disable_numpad },
{ value: "price", text: "Price", disabled: !this.pos.cashierHasPriceControlRights() || this.pos.cashier.disable_price }, { value: "price", text: "Price", disabled: !this.pos.cashierHasPriceControlRights() || this.pos.cashier?.disable_price },
{ 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 // 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" : "",

42
pos_access_right_hr/static/src/xml/ActionpadWidget.xml

@ -3,43 +3,11 @@
<!-- Inheriting ActionpadWidget template for adding the button disable feature--> <!-- Inheriting ActionpadWidget template for adding the button disable feature-->
<t name="pos_access_right_hr.ActionpadWidget" owl="1" <t name="pos_access_right_hr.ActionpadWidget" owl="1"
t-inherit="point_of_sale.ActionpadWidget" t-inherit-mode="extension"> t-inherit="point_of_sale.ActionpadWidget" t-inherit-mode="extension">
<xpath expr="//div[hasclass('actionpad')]" position="replace"> <xpath expr="//button[hasclass('pay-order-button')]" position="attributes">
<div class="actionpad d-flex flex-column flex-grow-1 p-0 border-end"> <attribute name="t-att-disabled">disable_payment()</attribute>
<button class="button mobile-more-button btn btn-secondary flex-fill border-bottom" </xpath>
t-if="ui.isSmall and props.onClickMore" <xpath expr="//button[hasclass('set-partner')]" position="attributes">
t-on-click="props.onClickMore"> <attribute name="t-att-disabled">disable_customer()</attribute>
<span>More...</span>
</button>
<button class="button set-partner btn btn-light rounded-0 py-2 flex-shrink-1 fw-bolder" id="customer_disable"
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-attf-class="{{getMainButtonClasses()}}"
t-att-class="{ 'with-more-button': props.onClickMore and ui.isSmall }"
t-att-disabled="disable_payment()"
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> </xpath>
</t> </t>
</templates> </templates>

Loading…
Cancel
Save