@ -0,0 +1,57 @@ | 
				
			|||||
 | 
					.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg | 
				
			||||
 | 
					    :target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html | 
				
			||||
 | 
					    :alt: License: LGPL-3 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Payroll Advanced Features | 
				
			||||
 | 
					========================= | 
				
			||||
 | 
					* Payroll Advanced Features for Odoo 18 community edition | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Features | 
				
			||||
 | 
					======== | 
				
			||||
 | 
					* Payroll-Payslip Reporting. | 
				
			||||
 | 
					* Automatic Mail During Confirmation of Payslip. | 
				
			||||
 | 
					* Mass Confirm Payslip. | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Configuration | 
				
			||||
 | 
					============= | 
				
			||||
 | 
					Nothing to configure. | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					License | 
				
			||||
 | 
					------- | 
				
			||||
 | 
					Affero General Public License, v3.0 (AGPL v3). | 
				
			||||
 | 
					(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Company | 
				
			||||
 | 
					------- | 
				
			||||
 | 
					* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Credits | 
				
			||||
 | 
					------- | 
				
			||||
 | 
					* Developers: (V14) Jibin James | 
				
			||||
 | 
					              (V15) Aneesh, | 
				
			||||
 | 
					              (V16) Anusha, | 
				
			||||
 | 
					              (V17) Farhana Jahan PT, | 
				
			||||
 | 
					              (V18) Rosmy John, | 
				
			||||
 | 
					  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,24 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | 
				
			||||
 | 
					#    Author: Cybrosys Techno Solutions (odoo@cybrosys.com) | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You can modify it under the terms of the GNU LESSER | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (LGPL 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. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    (LGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					from . import models | 
				
			||||
 | 
					from . import report | 
				
			||||
 | 
					from . import wizard | 
				
			||||
@ -0,0 +1,49 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | 
				
			||||
 | 
					#    Author: Cybrosys Techno Solutions (odoo@cybrosys.com) | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You can modify it under the terms of the GNU LESSER | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (LGPL 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. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    (LGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					{ | 
				
			||||
 | 
					    'name': 'Payroll Advanced Features', | 
				
			||||
 | 
					    'summary': 'Payroll Advanced Features For Odoo 18 Community.', | 
				
			||||
 | 
					    'description': 'Payroll Advanced Features For Odoo 18 Community,' | 
				
			||||
 | 
					                   'Payroll-Payslip Reporting, Automatic Mail During ' | 
				
			||||
 | 
					                   'Confirmation of Payslip, Mass Confirm Payslip ', | 
				
			||||
 | 
					    'category': 'Generic Modules/Human Resources', | 
				
			||||
 | 
					    'author': 'Cybrosys Techno Solutions', | 
				
			||||
 | 
					    'company': 'Cybrosys Techno Solutions', | 
				
			||||
 | 
					    'maintainer': 'Cybrosys Techno Solutions', | 
				
			||||
 | 
					    'website': 'https://www.cybrosys.com', | 
				
			||||
 | 
					    'depends': [ | 
				
			||||
 | 
					        'hr_payroll_community', 'mail', | 
				
			||||
 | 
					    ], | 
				
			||||
 | 
					    'data': [ | 
				
			||||
 | 
					        'security/ir.model.access.csv', | 
				
			||||
 | 
					        'views/hr_payslip_views.xml', | 
				
			||||
 | 
					        'views/res_config_settings_views.xml', | 
				
			||||
 | 
					        'data/mail_template_data.xml', | 
				
			||||
 | 
					        'wizard/payslip_confirm_views.xml', | 
				
			||||
 | 
					        'report/hr_payslip_report_views.xml', | 
				
			||||
 | 
					    ], | 
				
			||||
 | 
					    'images': ['static/description/banner.jpg'], | 
				
			||||
 | 
					    'license': 'LGPL-3', | 
				
			||||
 | 
					    'installable': True, | 
				
			||||
 | 
					    'auto_install': False, | 
				
			||||
 | 
					    'application': False, | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,21 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="utf-8"?> | 
				
			||||
 | 
					<odoo> | 
				
			||||
 | 
					    <data> | 
				
			||||
 | 
					        <!--Monthly Payslip Email Template--> | 
				
			||||
 | 
					        <record id="email_template_payslip" model="mail.template"> | 
				
			||||
 | 
					            <field name="name">Monthly Payslip Email</field> | 
				
			||||
 | 
					            <field name="model_id" ref="hr_payroll_community.model_hr_payslip"/> | 
				
			||||
 | 
					            <field name="email_from">{{(user.email)}}</field> | 
				
			||||
 | 
					            <field name="email_to">{{object.employee_id.private_email}}</field> | 
				
			||||
 | 
					            <field name="subject">Ref {{object.number}}</field> | 
				
			||||
 | 
					            <field name="auto_delete" eval="True"/> | 
				
			||||
 | 
					            <field name="body_html"><![CDATA[ | 
				
			||||
 | 
					                    <p>Hi,</p> | 
				
			||||
 | 
					                    <p>Here by attaching payslip details of this month</p> | 
				
			||||
 | 
					                    ]]> | 
				
			||||
 | 
					            </field> | 
				
			||||
 | 
					            <field name="report_template_ids" eval="[(4, ref('hr_payroll_community.hr_payslip_report_action'))]"/> | 
				
			||||
 | 
					            <field name="template_fs">{{(object.number or '').replace('/','_')}}</field> | 
				
			||||
 | 
					        </record> | 
				
			||||
 | 
					    </data> | 
				
			||||
 | 
					</odoo> | 
				
			||||
@ -0,0 +1,5 @@ | 
				
			|||||
 | 
					## Module <hr_payslip_monthly_report> | 
				
			||||
 | 
					#### 31.05.2025 | 
				
			||||
 | 
					#### Version 18.0.1.0.0 | 
				
			||||
 | 
					#### ADD | 
				
			||||
 | 
					- Initial commit for Payroll Advanced Features | 
				
			||||
@ -0,0 +1,23 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | 
				
			||||
 | 
					#    Author: Cybrosys Techno Solutions (odoo@cybrosys.com) | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You can modify it under the terms of the GNU LESSER | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (LGPL 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. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    (LGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					from . import hr_payslip | 
				
			||||
 | 
					from . import res_config_settings | 
				
			||||
@ -0,0 +1,87 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | 
				
			||||
 | 
					#    Author: Cybrosys Techno Solutions (odoo@cybrosys.com) | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You can modify it under the terms of the GNU LESSER | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (LGPL 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. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    (LGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					import logging | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					from odoo import fields, models, _ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					_logger = logging.getLogger(__name__) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					class HrPayslip(models.Model): | 
				
			||||
 | 
					    """Inherit hr_payslip module for sending a mail.""" | 
				
			||||
 | 
					    _inherit = 'hr.payslip' | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    is_send_mail = fields.Boolean( | 
				
			||||
 | 
					        string="Is Send Mail", | 
				
			||||
 | 
					        help="Checks the Mail is send or not") | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    def action_payslip_done(self): | 
				
			||||
 | 
					        """Checking auto email option is set. If set email containing payslip | 
				
			||||
 | 
					        details will send on confirmation""" | 
				
			||||
 | 
					        if self.env['ir.config_parameter'].sudo().get_param( | 
				
			||||
 | 
					                'send_payslip_by_email'): | 
				
			||||
 | 
					            self.write({'is_send_mail': True}) | 
				
			||||
 | 
					        res = super(HrPayslip, self).action_payslip_done() | 
				
			||||
 | 
					        if self.env['ir.config_parameter'].sudo().get_param( | 
				
			||||
 | 
					                'send_payslip_by_email'): | 
				
			||||
 | 
					            for payslip in self: | 
				
			||||
 | 
					                if payslip.employee_id.private_email: | 
				
			||||
 | 
					                    template = self.env.ref( | 
				
			||||
 | 
					                        'hr_payslip_monthly_report.email_template_payslip') | 
				
			||||
 | 
					                    template.sudo().send_mail(payslip.id, force_send=True) | 
				
			||||
 | 
					                    _logger.info("Payslip details for %s send by mail", | 
				
			||||
 | 
					                                 payslip.employee_id.name) | 
				
			||||
 | 
					        return res | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    def action_payslip_send(self): | 
				
			||||
 | 
					        """Opens a window to compose an email, | 
				
			||||
 | 
					        with template message loaded by default""" | 
				
			||||
 | 
					        self.ensure_one() | 
				
			||||
 | 
					        self.write({'is_send_mail': True}) | 
				
			||||
 | 
					        ir_model_data = self.env['ir.model.data'] | 
				
			||||
 | 
					        try: | 
				
			||||
 | 
					            template_id = ir_model_data._xmlid_lookup( | 
				
			||||
 | 
					                'hr_payslip_monthly_report.email_template_payslip')[1] | 
				
			||||
 | 
					        except ValueError: | 
				
			||||
 | 
					            template_id = False | 
				
			||||
 | 
					        try: | 
				
			||||
 | 
					            compose_form_id = ir_model_data._xmlid_lookup( | 
				
			||||
 | 
					                'mail.email_compose_message_wizard_form')[1] | 
				
			||||
 | 
					        except ValueError: | 
				
			||||
 | 
					            compose_form_id = False | 
				
			||||
 | 
					        ctx = { | 
				
			||||
 | 
					            'default_model': 'hr.payslip', | 
				
			||||
 | 
					            'default_res_ids': self.ids, | 
				
			||||
 | 
					            'default_template_id': template_id, | 
				
			||||
 | 
					            'default_composition_mode': 'comment', | 
				
			||||
 | 
					            'force_email': True, | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					        return { | 
				
			||||
 | 
					            'name': _('Compose Email'), | 
				
			||||
 | 
					            'type': 'ir.actions.act_window', | 
				
			||||
 | 
					            'view_mode': 'form', | 
				
			||||
 | 
					            'res_model': 'mail.compose.message', | 
				
			||||
 | 
					            'views': [(compose_form_id, 'form')], | 
				
			||||
 | 
					            'view_id': compose_form_id, | 
				
			||||
 | 
					            'target': 'new', | 
				
			||||
 | 
					            'context': ctx, | 
				
			||||
 | 
					        } | 
				
			||||
@ -0,0 +1,51 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | 
				
			||||
 | 
					#    Author: Cybrosys Techno Solutions (odoo@cybrosys.com) | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You can modify it under the terms of the GNU LESSER | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (LGPL 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. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    (LGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					from odoo import api, fields, models | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					class ResConfigSettings(models.TransientModel): | 
				
			||||
 | 
					    """Inherit res_config_settings for adding a boolean for send | 
				
			||||
 | 
					    Payslip by Mail""" | 
				
			||||
 | 
					    _inherit = 'res.config.settings' | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    send_payslip_by_email = fields.Boolean( | 
				
			||||
 | 
					        string="Automatic Send Payslip By Mail", | 
				
			||||
 | 
					        help="Is needed for automatic send mail") | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.model | 
				
			||||
 | 
					    def get_values(self): | 
				
			||||
 | 
					        """Function for getting boolean""" | 
				
			||||
 | 
					        res = super(ResConfigSettings, self).get_values() | 
				
			||||
 | 
					        params = self.env['ir.config_parameter'].sudo() | 
				
			||||
 | 
					        send_payslip_by_email = params.get_param('send_payslip_by_email', | 
				
			||||
 | 
					                                                 default=False) | 
				
			||||
 | 
					        res.update( | 
				
			||||
 | 
					            send_payslip_by_email=send_payslip_by_email | 
				
			||||
 | 
					        ) | 
				
			||||
 | 
					        return res | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    def set_values(self): | 
				
			||||
 | 
					        """Function for setting boolean""" | 
				
			||||
 | 
					        super(ResConfigSettings, self).set_values() | 
				
			||||
 | 
					        self.env['ir.config_parameter'].sudo().set_param( | 
				
			||||
 | 
					            "send_payslip_by_email", | 
				
			||||
 | 
					            self.send_payslip_by_email) | 
				
			||||
@ -0,0 +1,22 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | 
				
			||||
 | 
					#    Author: Cybrosys Techno Solutions (odoo@cybrosys.com) | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You can modify it under the terms of the GNU LESSER | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (LGPL 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. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    (LGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					from . import hr_payslip_report | 
				
			||||
@ -0,0 +1,160 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | 
				
			||||
 | 
					#    Author: Cybrosys Techno Solutions (odoo@cybrosys.com) | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You can modify it under the terms of the GNU LESSER | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (LGPL 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. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    (LGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					import time | 
				
			||||
 | 
					from calendar import monthrange | 
				
			||||
 | 
					from datetime import date | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					from odoo import fields, models, tools | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					class HrPayrollReportView(models.Model): | 
				
			||||
 | 
					    """Create a new model for getting monthly report""" | 
				
			||||
 | 
					    _name = 'hr.payroll.report' | 
				
			||||
 | 
					    _auto = False | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    now = date.today() | 
				
			||||
 | 
					    month_day = monthrange(now.year, now.month) | 
				
			||||
 | 
					    start_date = fields.Date(string="Start Date", | 
				
			||||
 | 
					                             default=time.strftime('%Y-%m-01'), invisible=True, | 
				
			||||
 | 
					                             help="Start Date for Report") | 
				
			||||
 | 
					    end_date = fields.Date(string="End Date", default=time.strftime( | 
				
			||||
 | 
					        '%Y-%m-' + str(month_day[1]) + ''), invisible=True, | 
				
			||||
 | 
					                           help="End Date for Report") | 
				
			||||
 | 
					    name = fields.Many2one('hr.employee', string='Employee', | 
				
			||||
 | 
					                           help="Choose Employee") | 
				
			||||
 | 
					    date_from = fields.Date(string='From', help="Starting Date for Report") | 
				
			||||
 | 
					    date_to = fields.Date(string='To', help="Ending Date for Report") | 
				
			||||
 | 
					    state = fields.Selection( | 
				
			||||
 | 
					        [('draft', 'Draft'), ('verify', 'Waiting'), ('done', 'Done'), | 
				
			||||
 | 
					         ('cancel', 'Rejected')], | 
				
			||||
 | 
					        string='Status', help="Select Status for Report") | 
				
			||||
 | 
					    job_id = fields.Many2one('hr.job', string='Job Title', | 
				
			||||
 | 
					                             help="Choose Hr Job") | 
				
			||||
 | 
					    company_id = fields.Many2one('res.company', string='Company', | 
				
			||||
 | 
					                                 help="Choose Company") | 
				
			||||
 | 
					    department_id = fields.Many2one('hr.department', | 
				
			||||
 | 
					                                    string='Department', | 
				
			||||
 | 
					                                    help="Choose Hr Department") | 
				
			||||
 | 
					    rule_name = fields.Many2one('hr.salary.rule.category', | 
				
			||||
 | 
					                                string="Rule Category", | 
				
			||||
 | 
					                                help="Choose Salary Rule Category") | 
				
			||||
 | 
					    rule_amount = fields.Float(string="Amount", help="Set Amount") | 
				
			||||
 | 
					    struct_id = fields.Many2one('hr.payroll.structure', | 
				
			||||
 | 
					                                string="Salary Structure", | 
				
			||||
 | 
					                                help="Choose Hr Payroll Structure") | 
				
			||||
 | 
					    rule_id = fields.Many2one('hr.salary.rule', | 
				
			||||
 | 
					                              string="Salary Rule", help="Choose Salary Rule") | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    def _select(self): | 
				
			||||
 | 
					        """ | 
				
			||||
 | 
					            Generate and return a SQL SELECT statement for retrieving specific fields from the database. | 
				
			||||
 | 
					            Returns: | 
				
			||||
 | 
					                str: SQL SELECT statement with the following fields: | 
				
			||||
 | 
					                    - Minimum of psl.id | 
				
			||||
 | 
					                    - ps.id | 
				
			||||
 | 
					                    - ps.number | 
				
			||||
 | 
					                    - emp.id as name | 
				
			||||
 | 
					                    - dp.id as department_id | 
				
			||||
 | 
					                    - jb.id as job_id | 
				
			||||
 | 
					                    - cmp.id as company_id | 
				
			||||
 | 
					                    - ps.date_from | 
				
			||||
 | 
					                    - ps.date_to | 
				
			||||
 | 
					                    - ps.state as state | 
				
			||||
 | 
					                    - rl.id as rule_name | 
				
			||||
 | 
					                    - psl.total as rule_amount | 
				
			||||
 | 
					                    - ps.struct_id as struct_id | 
				
			||||
 | 
					                    - rlu.id as rule_id | 
				
			||||
 | 
					            """ | 
				
			||||
 | 
					        select_str = """ | 
				
			||||
 | 
					            min(psl.id),ps.id,ps.number,emp.id as name,dp.id as  | 
				
			||||
 | 
					            department_id,jb.id as job_id,cmp.id as company_id,ps.date_from,  | 
				
			||||
 | 
					            ps.date_to, ps.state as state ,rl.id as rule_name,  | 
				
			||||
 | 
					            psl.total as rule_amount,ps.struct_id as struct_id,rlu.id as rule_id | 
				
			||||
 | 
					            """ | 
				
			||||
 | 
					        return select_str | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    def _from(self): | 
				
			||||
 | 
					        """ | 
				
			||||
 | 
					            Generate and return a SQL FROM clause for joining tables in a | 
				
			||||
 | 
					            database query. | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					            Returns: | 
				
			||||
 | 
					                str: SQL FROM clause with the following table joins: | 
				
			||||
 | 
					                    - hr_payslip_line (psl) | 
				
			||||
 | 
					                    - hr_payslip (ps) on ps.id = psl.slip_id | 
				
			||||
 | 
					                    - hr_salary_rule (rlu) on rlu.id = psl.salary_rule_id | 
				
			||||
 | 
					                    - hr_employee (emp) on ps.employee_id = emp.id | 
				
			||||
 | 
					                    - hr_salary_rule_category (rl) on rl.id = psl.category_id | 
				
			||||
 | 
					                    - hr_department (dp) (left join) on emp.department_id = dp.id | 
				
			||||
 | 
					                    - hr_job (jb) (left join) on emp.job_id = jb.id | 
				
			||||
 | 
					                    - res_company (cmp) on cmp.id = ps.company_id | 
				
			||||
 | 
					            """ | 
				
			||||
 | 
					        from_str = """ | 
				
			||||
 | 
					                hr_payslip_line psl    | 
				
			||||
 | 
					                join hr_payslip ps on ps.id=psl.slip_id | 
				
			||||
 | 
					                join hr_salary_rule rlu on rlu.id = psl.salary_rule_id | 
				
			||||
 | 
					                join hr_employee emp on ps.employee_id=emp.id | 
				
			||||
 | 
					                join hr_salary_rule_category rl on rl.id = psl.category_id | 
				
			||||
 | 
					                left join hr_department dp on emp.department_id=dp.id | 
				
			||||
 | 
					                left join hr_job jb on emp.job_id=jb.id | 
				
			||||
 | 
					                join res_company cmp on cmp.id=ps.company_id | 
				
			||||
 | 
					             """ | 
				
			||||
 | 
					        return from_str | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    def _group_by(self): | 
				
			||||
 | 
					        """ | 
				
			||||
 | 
					            Generate and return a SQL GROUP BY clause for grouping results in a | 
				
			||||
 | 
					            database query. | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					            Returns: | 
				
			||||
 | 
					                str: SQL GROUP BY clause with the following fields: | 
				
			||||
 | 
					                    - ps.number | 
				
			||||
 | 
					                    - ps.id | 
				
			||||
 | 
					                    - emp.id | 
				
			||||
 | 
					                    - dp.id | 
				
			||||
 | 
					                    - jb.id | 
				
			||||
 | 
					                    - cmp.id | 
				
			||||
 | 
					                    - ps.date_from | 
				
			||||
 | 
					                    - ps.date_to | 
				
			||||
 | 
					                    - ps.state | 
				
			||||
 | 
					                    - psl.total | 
				
			||||
 | 
					                    - psl.name | 
				
			||||
 | 
					                    - psl.category_id | 
				
			||||
 | 
					                    - rl.id | 
				
			||||
 | 
					                    - rlu.id | 
				
			||||
 | 
					            """ | 
				
			||||
 | 
					        group_by_str = """group by ps.number,ps.id,emp.id,dp.id,jb.id,cmp.id, | 
				
			||||
 | 
					        ps.date_from,ps.date_to,ps.state, | 
				
			||||
 | 
					            psl.total,psl.name,psl.category_id,rl.id,rlu.id""" | 
				
			||||
 | 
					        return group_by_str | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    def init(self): | 
				
			||||
 | 
					        """ | 
				
			||||
 | 
					            Initialize or update a database view with a SELECT statement. | 
				
			||||
 | 
					        """ | 
				
			||||
 | 
					        tools.drop_view_if_exists(self.env.cr, self._table) | 
				
			||||
 | 
					        self.env.cr.execute("""CREATE or REPLACE VIEW %s as ( SELECT | 
				
			||||
 | 
					                   %s | 
				
			||||
 | 
					                   FROM %s | 
				
			||||
 | 
					                   %s | 
				
			||||
 | 
					                   )""" % ( | 
				
			||||
 | 
					            self._table, self._select(), self._from(), self._group_by())) | 
				
			||||
@ -0,0 +1,88 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="utf-8"?> | 
				
			||||
 | 
					<odoo> | 
				
			||||
 | 
					    <!--    Pivot view of hr_payroll_report--> | 
				
			||||
 | 
					    <record id="hr_payroll_report_view_pivot" model="ir.ui.view"> | 
				
			||||
 | 
					        <field name="name">hr.payroll.view.pivot</field> | 
				
			||||
 | 
					        <field name="model">hr.payroll.report</field> | 
				
			||||
 | 
					        <field name="arch" type="xml"> | 
				
			||||
 | 
					            <pivot string="Payslip Analysis"> | 
				
			||||
 | 
					                <field name="name" type="row"/> | 
				
			||||
 | 
					                <field name="date_from" interval="month" type="col"/> | 
				
			||||
 | 
					                <field name="rule_amount" type="measure"/> | 
				
			||||
 | 
					            </pivot> | 
				
			||||
 | 
					        </field> | 
				
			||||
 | 
					    </record> | 
				
			||||
 | 
					    <!--    Graph view of hr_payroll_report--> | 
				
			||||
 | 
					    <record id="hr_payroll_report_view_graph" model="ir.ui.view"> | 
				
			||||
 | 
					        <field name="name">hr.payroll.view.graph</field> | 
				
			||||
 | 
					        <field name="model">hr.payroll.report</field> | 
				
			||||
 | 
					        <field name="arch" type="xml"> | 
				
			||||
 | 
					            <graph string="Payslip Analysis"> | 
				
			||||
 | 
					                <field name="date_from" type="row"/> | 
				
			||||
 | 
					                <field name="rule_amount" type="measure"/> | 
				
			||||
 | 
					            </graph> | 
				
			||||
 | 
					        </field> | 
				
			||||
 | 
					    </record> | 
				
			||||
 | 
					    <!--Filtration for hr_payroll_report--> | 
				
			||||
 | 
					    <record id="hr_payroll_report_search" model="ir.ui.view"> | 
				
			||||
 | 
					        <field name="name">hr.payroll.select</field> | 
				
			||||
 | 
					        <field name="model">hr.payroll.report</field> | 
				
			||||
 | 
					        <field name="arch" type="xml"> | 
				
			||||
 | 
					            <search string="Payslip Analysis"> | 
				
			||||
 | 
					                <field name="name"/> | 
				
			||||
 | 
					                <field name="date_from"/> | 
				
			||||
 | 
					                <field name="company_id" groups="base.group_multi_company"/> | 
				
			||||
 | 
					                <field name="start_date" invisible="1"/> | 
				
			||||
 | 
					                <field name="end_date" invisible="1"/> | 
				
			||||
 | 
					                <filter string="This Month" name="thismonth" | 
				
			||||
 | 
					                        domain="[('date_from','>=',time.strftime('%%Y-%%m-01'))]"/> | 
				
			||||
 | 
					                <filter string="This Year" name="year" | 
				
			||||
 | 
					                        domain="[('date_from','<=', time.strftime('%%Y-12-31')),('date_from','>=',time.strftime('%%Y-01-01')),('date_to','<=', time.strftime('%%Y-12-31')),('date_to','>=',time.strftime('%%Y-01-01'))]"/> | 
				
			||||
 | 
					                <filter name="Done" string="Done" | 
				
			||||
 | 
					                        domain="[('state','=', 'done')]"/> | 
				
			||||
 | 
					                <filter name="Draft" string="Draft" | 
				
			||||
 | 
					                        domain="[('state','=','draft')]"/> | 
				
			||||
 | 
					                <separator/> | 
				
			||||
 | 
					                <field name="department_id"/> | 
				
			||||
 | 
					                <group expand="1" string="Group By"> | 
				
			||||
 | 
					                    <filter string="Employee" name="Employee" | 
				
			||||
 | 
					                            context="{'group_by':'name'}"/> | 
				
			||||
 | 
					                    <filter string="Job" name="job" | 
				
			||||
 | 
					                            context="{'group_by':'job_id'}"/> | 
				
			||||
 | 
					                    <filter string="Department" name="department" | 
				
			||||
 | 
					                            context="{'group_by':'department_id'}"/> | 
				
			||||
 | 
					                    <filter name="status" string="Status" | 
				
			||||
 | 
					                            context="{'group_by':'state'}"/> | 
				
			||||
 | 
					                    <filter string="Company" name="company" | 
				
			||||
 | 
					                            groups="base.group_multi_company" | 
				
			||||
 | 
					                            context="{'group_by':'company_id'}"/> | 
				
			||||
 | 
					                </group> | 
				
			||||
 | 
					            </search> | 
				
			||||
 | 
					        </field> | 
				
			||||
 | 
					    </record> | 
				
			||||
 | 
					    <!-- Window action to open hr_payroll_report--> | 
				
			||||
 | 
					    <record id="hr_payroll_report_action" model="ir.actions.act_window"> | 
				
			||||
 | 
					        <field name="res_model">hr.payroll.report</field> | 
				
			||||
 | 
					        <field name="name">Payslips</field> | 
				
			||||
 | 
					        <field name="view_mode">pivot,graph</field> | 
				
			||||
 | 
					        <field name="context">{'search_default_year':1}</field> | 
				
			||||
 | 
					        <field name="help">This report helps in payroll analysis. This helps you | 
				
			||||
 | 
					            to check your payslips and sorting it out from different group | 
				
			||||
 | 
					            criteria (Employee, Job title, Department, Company, Pay slip etc.). | 
				
			||||
 | 
					        </field> | 
				
			||||
 | 
					    </record> | 
				
			||||
 | 
					    <!--    Menus for Report--> | 
				
			||||
 | 
					    <menuitem | 
				
			||||
 | 
					            name="Reports" | 
				
			||||
 | 
					            id="menu_hr_payslip_reports" | 
				
			||||
 | 
					            parent="hr_payroll_community.menu_hr_payroll_community_root" | 
				
			||||
 | 
					            groups="hr_payroll_community.group_hr_payroll_community_user" | 
				
			||||
 | 
					            sequence="45"/> | 
				
			||||
 | 
					    <menuitem | 
				
			||||
 | 
					            id="menu_hr_payslip_view_report" | 
				
			||||
 | 
					            name="Payslip Report" | 
				
			||||
 | 
					            parent="menu_hr_payslip_reports" | 
				
			||||
 | 
					            action="hr_payroll_report_action" | 
				
			||||
 | 
					            groups="hr_payroll_community.group_hr_payroll_community_user" | 
				
			||||
 | 
					            sequence="10"/> | 
				
			||||
 | 
					</odoo> | 
				
			||||
		
		
			
  | 
| 
		 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: 77 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: 78 KiB  | 
| 
		 After Width: | Height: | Size: 49 KiB  | 
| 
		 After Width: | Height: | Size: 34 KiB  | 
| 
		 After Width: | Height: | Size: 56 KiB  | 
| 
		 After Width: | Height: | Size: 190 KiB  | 
| 
		 After Width: | Height: | Size: 40 KiB  | 
| 
		 After Width: | Height: | Size: 83 KiB  | 
| 
		 After Width: | Height: | Size: 150 KiB  | 
| 
		 After Width: | Height: | Size: 35 KiB  | 
| 
		 After Width: | Height: | Size: 106 KiB  | 
| 
		 After Width: | Height: | Size: 171 KiB  | 
| 
		 After Width: | Height: | Size: 127 KiB  | 
| 
		 After Width: | Height: | Size: 44 KiB  | 
| 
		 After Width: | Height: | Size: 89 KiB  |