From 5b725e1bd62e0fdb746d4595fd79014ead340ee7 Mon Sep 17 00:00:00 2001 From: RisvanaCybro Date: Wed, 27 Dec 2023 12:45:48 +0530 Subject: [PATCH] Dec 27 : [FIX] Changed the license 'website_hr_portal' --- website_hr_portal/README.rst | 10 +- website_hr_portal/__init__.py | 16 +-- website_hr_portal/__manifest__.py | 54 ++++---- website_hr_portal/controllers/__init__.py | 17 +-- website_hr_portal/controllers/portal_event.py | 97 ++++++++------ .../controllers/portal_payslip.py | 122 ++++++++++-------- website_hr_portal/controllers/portal_shift.py | 67 ++++++---- 7 files changed, 216 insertions(+), 167 deletions(-) diff --git a/website_hr_portal/README.rst b/website_hr_portal/README.rst index e526d276e..781ae7a4e 100755 --- a/website_hr_portal/README.rst +++ b/website_hr_portal/README.rst @@ -1,6 +1,6 @@ -.. image:: https://img.shields.io/badge/licence-LGPL--3-green.svg - :target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html - :alt: License: LGPL-3 +.. 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 HR WEBSITE PORTAL ================= @@ -14,8 +14,8 @@ Configuration License ------- -General Public License, Version 3 (LGPL-3). -(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) +General Public License, Version 3 (AGPL-3). +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) Company ------- diff --git a/website_hr_portal/__init__.py b/website_hr_portal/__init__.py index 304a6d19b..5896c68b8 100755 --- a/website_hr_portal/__init__.py +++ b/website_hr_portal/__init__.py @@ -1,22 +1,22 @@ # -*- coding: utf-8 -*- -############################################################################# +################################################################################ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Copyright (C) 2023-TODAY Cybrosys Technologies(). # Author: Cybrosys Techno Solutions() # -# You can modify it under the terms of the GNU LESSER -# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. # -# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE -# (LGPL v3) along with this program. +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. # If not, see . # -############################################################################# +################################################################################ from . import controllers diff --git a/website_hr_portal/__manifest__.py b/website_hr_portal/__manifest__.py index ea5015be4..84f6cedfe 100755 --- a/website_hr_portal/__manifest__.py +++ b/website_hr_portal/__manifest__.py @@ -1,45 +1,45 @@ # -*- coding: utf-8 -*- -############################################################################# +################################################################################ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Copyright (C) 2023-TODAY Cybrosys Technologies(). # Author: Cybrosys Techno Solutions() # -# You can modify it under the terms of the GNU LESSER -# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. # -# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE -# (LGPL v3) along with this program. +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. # If not, see . # -############################################################################# +################################################################################ { - 'name': 'HR WEBSITE PORTAL', - 'version': '16.0.1.0.0', - 'category': 'Website', - 'summary': 'Employees can login and see, their payslips,shifts and events', - 'description': """This module helps the Employees can login and see, their + "name": "HR WEBSITE PORTAL", + "version": "16.0.1.0.0", + "category": "Website", + "summary": "Employees can login and see, their payslips,shifts and events", + "description": """This module helps the Employees can login and see, their payslips,remaining leaves, shift schedule and any news or events HRs posting.""", - 'author': 'Cybrosys Techno Solutions', - 'company': 'Cybrosys Techno Solutions', - 'maintainer': 'Cybrosys Techno Solutions', - 'website': 'https://www.cybrosys.com', - 'depends': ['hr_payroll_community', 'website_event'], - 'data': [ - 'views/portal_templates.xml', - 'views/payslip_templates.xml', - 'views/event_templates.xml' + "author": "Cybrosys Techno Solutions", + "company": "Cybrosys Techno Solutions", + "maintainer": "Cybrosys Techno Solutions", + "website": "https://www.cybrosys.com", + "depends": ["hr_payroll_community", "website_event"], + "data": [ + "views/portal_templates.xml", + "views/payslip_templates.xml", + "views/event_templates.xml", ], - 'images': ['static/description/banner.png'], - 'license': 'LGPL-3', - 'installable': True, - 'auto_install': False, - 'application': False, + "images": ["static/description/banner.png"], + "license": "AGPL-3", + "installable": True, + "auto_install": False, + "application": False, } diff --git a/website_hr_portal/controllers/__init__.py b/website_hr_portal/controllers/__init__.py index 9b7170060..bd121980c 100755 --- a/website_hr_portal/controllers/__init__.py +++ b/website_hr_portal/controllers/__init__.py @@ -1,23 +1,24 @@ # -*- coding: utf-8 -*- -############################################################################# +################################################################################ +# # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Copyright (C) 2023-TODAY Cybrosys Technologies(). # Author: Cybrosys Techno Solutions() # -# You can modify it under the terms of the GNU LESSER -# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. # -# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE -# (LGPL v3) along with this program. +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. # If not, see . # -############################################################################# +################################################################################ from . import portal_event from . import portal_payslip from . import portal_shift diff --git a/website_hr_portal/controllers/portal_event.py b/website_hr_portal/controllers/portal_event.py index 36be05aa4..3a42f9ed4 100755 --- a/website_hr_portal/controllers/portal_event.py +++ b/website_hr_portal/controllers/portal_event.py @@ -1,24 +1,24 @@ # -*- coding: utf-8 -*- -############################################################################# +################################################################################ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Copyright (C) 2023-TODAY Cybrosys Technologies(). # Author: Cybrosys Techno Solutions() # -# You can modify it under the terms of the GNU LESSER -# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. # -# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE -# (LGPL v3) along with this program. +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. # If not, see . # -############################################################################# +################################################################################ from odoo import http from odoo.http import request from odoo.addons.portal.controllers.portal import CustomerPortal @@ -30,48 +30,65 @@ class PortalEmployeeEvents(CustomerPortal): def _prepare_home_portal_values(self, counters): """Display counters of events of current user""" values = super()._prepare_home_portal_values(counters) - if 'event_count' in counters: - values['event_count'] = request.env[ - 'event.event'].sudo().search_count([]) + if "event_count" in counters: + values["event_count"] = request.env["event.event"].sudo().search_count([]) return values class WebsiteHrPortalEvents(http.Controller): """Display current user events""" - @http.route(['/my/event'], type='http', auth="user", website=True) + @http.route(["/my/event"], type="http", auth="user", website=True) def portal_my_events(self, sortby=None, search="", search_in="All"): """Display current user events""" searchbar_sortings = { - 'name': {'label': 'Name', 'order': 'name'}, - 'date_end': {'label': 'Date', 'order': 'date_end desc'}, - 'event_type_id': {'label': 'Event Type', 'order': 'event_type_id'}, - 'address_id': {'label': 'Venue', 'order': 'address_id'} + "name": {"label": "Name", "order": "name"}, + "date_end": {"label": "Date", "order": "date_end desc"}, + "event_type_id": {"label": "Event Type", "order": "event_type_id"}, + "address_id": {"label": "Venue", "order": "address_id"}, } searchbar_inputs = { - 'All': {'label': 'All', 'input': 'All', 'domain': - ['|', '|', ('event_type_id', 'ilike', search), - ('name', 'ilike', search), - ('address_id', 'ilike', search)]}, - 'Event Type': {'label': 'Event Type', 'input': 'Event Type', - 'domain': [('event_type_id', 'ilike', search)]}, - 'Name': {'label': 'Name', 'input': 'Name', - 'domain': [('name', 'ilike', search)]}, - 'Venue': {'label': 'Venue', 'input': 'Venue', - 'domain': [('address_id', 'ilike', search)]}, + "All": { + "label": "All", + "input": "All", + "domain": [ + "|", + "|", + ("event_type_id", "ilike", search), + ("name", "ilike", search), + ("address_id", "ilike", search), + ], + }, + "Event Type": { + "label": "Event Type", + "input": "Event Type", + "domain": [("event_type_id", "ilike", search)], + }, + "Name": { + "label": "Name", + "input": "Name", + "domain": [("name", "ilike", search)], + }, + "Venue": { + "label": "Venue", + "input": "Venue", + "domain": [("address_id", "ilike", search)], + }, } if not sortby: - sortby = 'event_type_id' - order = searchbar_sortings[sortby]['order'] - search_domain = searchbar_inputs[search_in]['domain'] - event = request.env['event.event'].sudo().search(search_domain, - order=order) - return http.request.render('website_hr_portal.portal_employee_events', - {'event': event, - 'searchbar_sortings': searchbar_sortings, - 'sortby': sortby, - 'search': search, - 'search_in': search_in, - 'searchbar_inputs': searchbar_inputs, - 'page_name': 'events' - }) + sortby = "event_type_id" + order = searchbar_sortings[sortby]["order"] + search_domain = searchbar_inputs[search_in]["domain"] + event = request.env["event.event"].sudo().search(search_domain, order=order) + return http.request.render( + "website_hr_portal.portal_employee_events", + { + "event": event, + "searchbar_sortings": searchbar_sortings, + "sortby": sortby, + "search": search, + "search_in": search_in, + "searchbar_inputs": searchbar_inputs, + "page_name": "events", + }, + ) diff --git a/website_hr_portal/controllers/portal_payslip.py b/website_hr_portal/controllers/portal_payslip.py index 1ffdd8264..d5f9ed986 100755 --- a/website_hr_portal/controllers/portal_payslip.py +++ b/website_hr_portal/controllers/portal_payslip.py @@ -1,24 +1,24 @@ # -*- coding: utf-8 -*- -############################################################################# +################################################################################ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Copyright (C) 2023-TODAY Cybrosys Technologies(). # Author: Cybrosys Techno Solutions() # -# You can modify it under the terms of the GNU LESSER -# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. # -# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE -# (LGPL v3) along with this program. +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. # If not, see . # -############################################################################# +################################################################################ from odoo import http from odoo.http import request from odoo.addons.portal.controllers.portal import CustomerPortal @@ -30,65 +30,85 @@ class PortalEmployeePayslip(CustomerPortal): def _prepare_home_portal_values(self, counters): """Display counters of payslips""" values = super()._prepare_home_portal_values(counters) - if 'payslip_count' in counters: - values['payslip_count'] = request.env[ - 'hr.payslip'].sudo().search_count( - [('employee_id.user_id', '=', request.env.user.id)]) + if "payslip_count" in counters: + values["payslip_count"] = ( + request.env["hr.payslip"] + .sudo() + .search_count([("employee_id.user_id", "=", request.env.user.id)]) + ) return values class WebsiteHrPortalPayslip(http.Controller): """Display current user payslips""" - @http.route(['/my/payslip'], type='http', auth="user", - website=True) - def portal_my_payslip(self, sortby=None, search="", - search_in='All'): + @http.route(["/my/payslip"], type="http", auth="user", website=True) + def portal_my_payslip(self, sortby=None, search="", search_in="All"): """Display current user payslips""" searchbar_sortings = { - 'struct_id': {'label': 'Structure', - 'order': 'struct_id desc'} + "struct_id": {"label": "Structure", "order": "struct_id desc"} } searchbar_inputs = { - 'All': {'label': 'All', 'input': 'All', 'domain': - ['|', '|', ('name', 'ilike', search), - ('number', 'ilike', search), - ('struct_id', 'ilike', search)]}, - 'Name': {'label': 'Name', 'input': 'Name', - 'domain': [('name', 'ilike', search)]}, - 'Reference': {'label': 'Reference', 'input': 'Reference', - 'domain': [('number', 'ilike', search)]}, - 'Structure': {'label': 'Structure', 'input': 'Structure', - 'domain': [('struct_id', 'ilike', search)]}, + "All": { + "label": "All", + "input": "All", + "domain": [ + "|", + "|", + ("name", "ilike", search), + ("number", "ilike", search), + ("struct_id", "ilike", search), + ], + }, + "Name": { + "label": "Name", + "input": "Name", + "domain": [("name", "ilike", search)], + }, + "Reference": { + "label": "Reference", + "input": "Reference", + "domain": [("number", "ilike", search)], + }, + "Structure": { + "label": "Structure", + "input": "Structure", + "domain": [("struct_id", "ilike", search)], + }, } if not sortby: - sortby = 'struct_id' - search_domain = searchbar_inputs[search_in]['domain'] - payslip = request.env['hr.payslip'].sudo().search([ - ('employee_id.user_id', '=', request.env.user.id)]) + sortby = "struct_id" + search_domain = searchbar_inputs[search_in]["domain"] + payslip = ( + request.env["hr.payslip"] + .sudo() + .search([("employee_id.user_id", "=", request.env.user.id)]) + ) return http.request.render( - 'website_hr_portal.portal_employee_payslips', + "website_hr_portal.portal_employee_payslips", { - 'payslip_id': payslip.search(search_domain), - 'searchbar_sortings': searchbar_sortings, - 'searchbar_inputs': searchbar_inputs, - 'sortby': sortby, - 'search': search, - 'search_in': search_in, - 'page_name': 'payslip' - }) + "payslip_id": payslip.search(search_domain), + "searchbar_sortings": searchbar_sortings, + "searchbar_inputs": searchbar_inputs, + "sortby": sortby, + "search": search, + "search_in": search_in, + "page_name": "payslip", + }, + ) - @http.route(['/payslip/details/'], type='http', auth="user", - website=True) + @http.route( + ["/payslip/details/"], type="http", auth="user", website=True + ) def portal_payslip_details(self, value): """Display current user payslip details""" - payslip = request.env['hr.payslip'].sudo().browse(value) - payslip_details = [schedule for schedule in - payslip.line_ids] + payslip = request.env["hr.payslip"].sudo().browse(value) + payslip_details = [schedule for schedule in payslip.line_ids] return http.request.render( - 'website_hr_portal.payslip_portal_content', + "website_hr_portal.payslip_portal_content", { - 'payslip': payslip, - 'payslip_details': payslip_details, - 'page_name': 'payslip_details' - }) + "payslip": payslip, + "payslip_details": payslip_details, + "page_name": "payslip_details", + }, + ) diff --git a/website_hr_portal/controllers/portal_shift.py b/website_hr_portal/controllers/portal_shift.py index bffb80439..9c3057dde 100644 --- a/website_hr_portal/controllers/portal_shift.py +++ b/website_hr_portal/controllers/portal_shift.py @@ -1,24 +1,24 @@ # -*- coding: utf-8 -*- -############################################################################# +################################################################################ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Copyright (C) 2023-TODAY Cybrosys Technologies(). # Author: Cybrosys Techno Solutions() # -# You can modify it under the terms of the GNU LESSER -# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. # -# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE -# (LGPL v3) along with this program. +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. # If not, see . # -############################################################################# +################################################################################ from odoo import http from odoo.http import request from odoo.addons.portal.controllers.portal import CustomerPortal @@ -30,30 +30,41 @@ class PortalEmployeeShifts(CustomerPortal): def _prepare_home_portal_values(self, counters): """Display counters of shifts of current user""" values = super()._prepare_home_portal_values(counters) - if 'shift_count' in counters: - values['shift_count'] = request.env[ - 'hr.employee'].sudo().search_count( - [('user_id', '=', request.env.user.id)]) + if "shift_count" in counters: + values["shift_count"] = ( + request.env["hr.employee"] + .sudo() + .search_count([("user_id", "=", request.env.user.id)]) + ) return values - @http.route(['/my/shift'], type='http', auth="user", website=True) + @http.route(["/my/shift"], type="http", auth="user", website=True) def portal_my_shifts(self): """Display current user shifts""" - shift = request.env['hr.employee'].sudo().search( - [('user_id', '=', request.env.user.id)]) - leave = request.env['hr.leave'].sudo().search( - [('id', '=', request.env.user.id)]) - attendance_list = [schedule for schedule in - shift.resource_calendar_id.attendance_ids] + shift = ( + request.env["hr.employee"] + .sudo() + .search([("user_id", "=", request.env.user.id)]) + ) + leave = ( + request.env["hr.leave"].sudo().search([("id", "=", request.env.user.id)]) + ) + attendance_list = [ + schedule for schedule in shift.resource_calendar_id.attendance_ids + ] data = [ - {'resource_calendar_id': shift.resource_calendar_id.name, - 'leave_ids': leave.number_of_days - } + { + "resource_calendar_id": shift.resource_calendar_id.name, + "leave_ids": leave.number_of_days, + } for shift in shift ] - return http.request.render('website_hr_portal.portal_employee_shifts', - {'shift_id': shift, - 'data': data, - 'attendance_list': attendance_list, - 'page_name': 'shifts' - }) + return http.request.render( + "website_hr_portal.portal_employee_shifts", + { + "shift_id": shift, + "data": data, + "attendance_list": attendance_list, + "page_name": "shifts", + }, + )