@ -0,0 +1,54 @@ |
|||
.. 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 |
|||
|
|||
POS Discount Manager Approval |
|||
===================== |
|||
This module helps to provide Discount limit for each employee in every pos |
|||
|
|||
Configuration |
|||
============= |
|||
* No additional configurations needed |
|||
|
|||
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 |
|||
------- |
|||
* Developers: |
|||
(V15) Sruthi Pavithran, |
|||
(V16) Sruthi Pavithran, |
|||
(V17) Anjhana A K, |
|||
(V18) Bhagyadev K 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: Bhagyadev KP (odoo@cybrosys.com) |
|||
# |
|||
# This program is free software: you can modify |
|||
# it under the terms of the GNU Affero General Public License (AGPL) as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# 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 for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from . import models |
@ -0,0 +1,48 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Bhagyadev KP (odoo@cybrosys.com) |
|||
# |
|||
# This program is free software: you can modify |
|||
# it under the terms of the GNU Affero General Public License (AGPL) as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# 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 for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
{ |
|||
'name': "POS Discount Manager Approval", |
|||
'version': '18.0.1.0.0', |
|||
'category': 'Point Of Sale', |
|||
'summary': "Discount limit for each employee in every point of sale""", |
|||
'description': """This module helps you to set a discount limit for each |
|||
employee in every point of sale.It facilitate the manager approval when |
|||
discount over the limit of employee""", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': "Cybrosys Techno Solutions", |
|||
'website': "http://www.cybrosys.com", |
|||
'depends': ['pos_discount', 'hr'], |
|||
'data': [ |
|||
'views/hr_employee_views.xml', |
|||
], |
|||
'assets': { |
|||
'point_of_sale._assets_pos': [ |
|||
'pos_discount_manager/static/src/js/payment_screen.js', |
|||
] |
|||
}, |
|||
'images': ['static/description/banner.jpg'], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False |
|||
} |
@ -0,0 +1,6 @@ |
|||
## Module <pos_discount_manager> |
|||
|
|||
#### 29.05.2025 |
|||
#### Version 18.0.1.0.0 |
|||
#### ADD |
|||
- Initial Commit POS Discount Manager Approval |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Bhagyadev KP (odoo@cybrosys.com) |
|||
# |
|||
# This program is free software: you can modify |
|||
# it under the terms of the GNU Affero General Public License (AGPL) as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# 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 for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from . import hr_employee |
|||
from . import hr_employee_public |
@ -0,0 +1,40 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Bhagyadev KP (odoo@cybrosys.com) |
|||
# |
|||
# This program is free software: you can modify |
|||
# it under the terms of the GNU Affero General Public License (AGPL) as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# 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 for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class HrEmployee(models.Model): |
|||
"""Add field into hr employee""" |
|||
_inherit = 'hr.employee' |
|||
|
|||
limited_discount = fields.Integer(string="Discount Limit", |
|||
help="Provide discount limit to each " |
|||
"employee") |
|||
|
|||
@api.model |
|||
def _load_pos_data_fields(self, config_id): |
|||
"""Loading fields""" |
|||
result = super()._load_pos_data_fields(config_id) |
|||
result.append('limited_discount') |
|||
result.append('parent_id') |
|||
result.append('pin') |
|||
return result |
@ -0,0 +1,39 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Bhagyadev KP (odoo@cybrosys.com) |
|||
# |
|||
# This program is free software: you can modify |
|||
# it under the terms of the GNU Affero General Public License (AGPL) as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# 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 for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class HrEmployeePublic(models.Model): |
|||
"""Add field into hr employee""" |
|||
_inherit = 'hr.employee.public' |
|||
|
|||
limited_discount = fields.Integer(string="Discount Limit", |
|||
help="Provide discount limit to each " |
|||
"employee", |
|||
related="employee_id.limited_discount") |
|||
|
|||
@api.model |
|||
def _load_pos_data_fields(self, config_id): |
|||
"""Loading fields""" |
|||
result = super()._load_pos_data_fields(config_id) |
|||
result.append('limited_discount') |
|||
return result |
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: 738 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: 18 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 141 KiB |
After Width: | Height: | Size: 118 KiB |
After Width: | Height: | Size: 112 KiB |
After Width: | Height: | Size: 227 KiB |
After Width: | Height: | Size: 521 KiB |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 69 KiB |
After Width: | Height: | Size: 75 KiB |
After Width: | Height: | Size: 65 KiB |
After Width: | Height: | Size: 309 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 810 KiB |
After Width: | Height: | Size: 309 KiB |
After Width: | Height: | Size: 47 KiB |
@ -0,0 +1,48 @@ |
|||
/* global Sha1 */ |
|||
import { patch } from "@web/core/utils/patch"; |
|||
import { PaymentScreen } from "@point_of_sale/app/screens/payment_screen/payment_screen"; |
|||
import { session } from "@web/session"; |
|||
import { _t } from "@web/core/l10n/translation"; |
|||
import { NumberPopup } from "@point_of_sale/app/utils/input_popups/number_popup"; |
|||
//Patching PaymentScreen
|
|||
patch(PaymentScreen.prototype, { |
|||
async _finalizeValidation() { |
|||
var order = this.pos.get_order(); |
|||
var orderlines = this.currentOrder.get_orderlines() |
|||
var employee_dis = this.pos.get_cashier()['limited_discount']; |
|||
var employee_name = this.pos.get_cashier()['name'] |
|||
var manager = this.pos.get_cashier() |
|||
var flag = 1; |
|||
if (employee_dis != 0) { |
|||
orderlines.forEach((order) => { |
|||
if(order.discount > employee_dis) |
|||
flag = 0; |
|||
}); |
|||
} |
|||
if (flag != 1) { |
|||
this.dialog.add(NumberPopup, { |
|||
title: _t(employee_name + ', your discount is over the limit. \n Manager pin for Approval'), |
|||
getPayload: async (num) => { |
|||
if (manager.parent_id){ |
|||
var output = this.pos.models["hr.employee"].filter((obj) => obj.id === manager.parent_id.id ); |
|||
if (Sha1.hash(num) == output[0]._pin) { |
|||
await super._finalizeValidation(...arguments); |
|||
} else { |
|||
this.notification.add(_t("Manager Restricted your discount"), { |
|||
type: "danger", |
|||
title: _t(employee_name + ", Your Manager pin is incorrect."), |
|||
}); |
|||
} |
|||
} else { |
|||
this.notification.add(_t("Manager/Pin not set"), { |
|||
type: "danger", |
|||
title: _t(employee_name + ", Manager/Pin not set."), |
|||
}); |
|||
} |
|||
}, |
|||
}); |
|||
} else { |
|||
await super._finalizeValidation(...arguments); |
|||
} |
|||
} |
|||
}); |
@ -0,0 +1,14 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Inheriting form view of hr employee--> |
|||
<record id="view_employee_form" model="ir.ui.view"> |
|||
<field name="name">hr.employee.view.form.inherit.pos.discount.manager</field> |
|||
<field name="model">hr.employee</field> |
|||
<field name="inherit_id" ref="hr.view_employee_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='job_id']" position="after"> |
|||
<field name="limited_discount"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |