@ -0,0 +1,50 @@ |
|||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
Restrict POS Refund with Password |
|||
================================== |
|||
This module is used to set password on refund button process in pos . |
|||
|
|||
Configuration |
|||
============= |
|||
* Set global refund security from settings |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
General Public License, Version 3 (AGPL v3). |
|||
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
* Developer: |
|||
(V16) Archana V |
|||
(V17) Anjhana A K |
|||
(V18) Abbas P |
|||
Contact: odoo@cybrosys.com |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://cybrosys.com |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
Maintainer |
|||
========== |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
|
|||
This module is maintained by Cybrosys Technologies. |
|||
|
|||
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Abbas P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import model |
@ -0,0 +1,48 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Abbas P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
{ |
|||
'name': 'Restrict POS Refund with Password', |
|||
'version': '18.0.1.0.0', |
|||
'summary': """Restrict POS Refund with Password In Odoo 18""", |
|||
'description': """POS Restrict Refund helps to set password protection for |
|||
refunds, ensuring authorized access""", |
|||
'category': 'Point of Sale', |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': "https://www.cybrosys.com", |
|||
'depends': ['point_of_sale'], |
|||
'data': [ |
|||
'views/pos_config_views.xml', |
|||
'views/res_config_settings_views.xml', |
|||
], |
|||
'assets': { |
|||
'point_of_sale._assets_pos': [ |
|||
'pos_refund_password/static/src/js/ticket_screen.js' |
|||
], |
|||
}, |
|||
'images': ['static/description/banner.png'], |
|||
'license': "AGPL-3", |
|||
'installable': True, |
|||
'application': False, |
|||
'auto_install': False, |
|||
} |
@ -0,0 +1,6 @@ |
|||
## Module <pos_refund_password> |
|||
|
|||
#### 15.02.2025 |
|||
#### Version 18.0.1.0.0 |
|||
#### ADD |
|||
- Initial commit for Restrict POS Refund with Password |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Abbas P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import pos_config |
|||
from . import res_config_settings |
@ -0,0 +1,44 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Abbas P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from odoo import api, models, fields |
|||
|
|||
|
|||
class PosConfig(models.Model): |
|||
"""Inherit pos configuration and add new fields.""" |
|||
_inherit = 'pos.config' |
|||
|
|||
refund_security = fields.Integer(string='Refund Security', |
|||
help="Refund security password, used for that specified shop") |
|||
|
|||
@api.model |
|||
def fetch_global_refund_security(self): |
|||
""" |
|||
Fetches the global refund security parameter from system settings. |
|||
|
|||
This method retrieves the value of the configuration parameter |
|||
'pos_refund_password.global_refund_security' stored in the `ir.config_parameter` model. |
|||
|
|||
Returns: |
|||
str or None: The value of the global refund security parameter if set, otherwise None. |
|||
""" |
|||
param = self.env['ir.config_parameter'].sudo().get_param('pos_refund_password.global_refund_security') |
|||
return param |
@ -0,0 +1,32 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Abbas P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from odoo import models, fields |
|||
|
|||
|
|||
class ResConfigSettings(models.TransientModel): |
|||
"""Adding a new field to res_config_settings model.""" |
|||
_inherit = 'res.config.settings' |
|||
|
|||
global_refund_security = fields.Integer( |
|||
string='Global Refund Security', |
|||
config_parameter='pos_refund_password.global_refund_security', |
|||
help="Global refund security password, used globally") |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 240 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 767 KiB |
After Width: | Height: | Size: 138 KiB |
After Width: | Height: | Size: 760 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 697 KiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 101 KiB |
After Width: | Height: | Size: 290 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 96 KiB |
After Width: | Height: | Size: 106 KiB |
After Width: | Height: | Size: 473 KiB |
After Width: | Height: | Size: 107 KiB |
After Width: | Height: | Size: 147 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 14 KiB |
@ -0,0 +1,55 @@ |
|||
/** @odoo-module */ |
|||
import { patch } from "@web/core/utils/patch"; |
|||
import { NumberPopup } from "@point_of_sale/app/utils/input_popups/number_popup"; |
|||
import { TicketScreen } from "@point_of_sale/app/screens/ticket_screen/ticket_screen"; |
|||
import { _t } from "@web/core/l10n/translation"; |
|||
import { useService } from "@web/core/utils/hooks"; |
|||
|
|||
// Refund password validation and popup
|
|||
patch(TicketScreen.prototype, { |
|||
setup() { |
|||
// Initialize necessary services
|
|||
super.setup(...arguments); |
|||
this.notification = useService("notification"); |
|||
}, |
|||
|
|||
async onDoRefund() { |
|||
try { |
|||
// Fetch global and session refund passwords
|
|||
const globalRefundPassword = await this.pos.barcodeReader.orm.call("pos.config", "fetch_global_refund_security", []); |
|||
const sessionRefundPassword = globalRefundPassword || this.pos.config.refund_security; |
|||
|
|||
// Determine the error message for invalid password
|
|||
const errorMessage = globalRefundPassword |
|||
? _t('Invalid Password, Enter your global password') |
|||
: _t('Incorrect Password'); |
|||
|
|||
// Trigger popup for password validation if sessionRefundPassword exists
|
|||
if (sessionRefundPassword) { |
|||
this.dialog.add(NumberPopup, { |
|||
title: _t("Confirm ?"), |
|||
placeholder: _t("Enter Password"), |
|||
formatDisplayedValue: (input) => input.replace(/./g, "•"), |
|||
getPayload: (inputPassword) => { |
|||
if (inputPassword == sessionRefundPassword) { |
|||
// Proceed with refund if password is correct
|
|||
super.onDoRefund(...arguments); |
|||
} else { |
|||
// Show notification if the password is incorrect
|
|||
this.notification.add(errorMessage, { |
|||
type: "warning", |
|||
title: _t("Error"), |
|||
}); |
|||
} |
|||
}, |
|||
}); |
|||
} else { |
|||
// Proceed with refund without password validation
|
|||
super.onDoRefund(...arguments); |
|||
} |
|||
} catch (error) { |
|||
// Handle any potential errors during the async process
|
|||
console.error("Error during refund password validation:", error); |
|||
} |
|||
}, |
|||
}); |
@ -0,0 +1,22 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- Add new field inside pos config--> |
|||
<record id="pos_config_view_form" model="ir.ui.view"> |
|||
<field name="name">pos.config.view.form.inherit.pos.refund.password</field> |
|||
<field name="model">pos.config</field> |
|||
<field name="inherit_id" ref="point_of_sale.pos_config_view_form"/> |
|||
<field name="arch" type="xml"> |
|||
<setting id="other_devices" position="after"> |
|||
<setting id="refund_security"> |
|||
<div class="row"> |
|||
<label for="refund_security"/> |
|||
<field name="refund_security" widget="char"/> |
|||
<div class="text-muted mb16"> |
|||
Set a security password on refund on pos screen |
|||
</div> |
|||
</div> |
|||
</setting> |
|||
</setting> |
|||
</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,24 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- Add new field inside pos settings--> |
|||
<record id="res_config_settings_view_form" model="ir.ui.view"> |
|||
<field name="name">res.config.settings.view.form.inherited.pos.refund.password</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_interface_section']" position="inside"> |
|||
<div class="col-12 col-lg-6 o_setting_box"> |
|||
<div class="o_setting_right_pane"> |
|||
<label for="global_refund_security"/> |
|||
<div class="text-muted"> |
|||
Set a Global security password on refund on pos screen . |
|||
<div> |
|||
<field name="global_refund_security" widget="char"/> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |