@ -0,0 +1,53 @@ | 
				
			|||||
 | 
					.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg | 
				
			||||
 | 
					    :target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html | 
				
			||||
 | 
					    :alt: License: LGPL-3 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Employee Bonus | 
				
			||||
 | 
					============== | 
				
			||||
 | 
					This module will help you in managing employee bonus. | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Configuration | 
				
			||||
 | 
					============= | 
				
			||||
 | 
					* Add users to the three user groups | 
				
			||||
 | 
					    - User: can create and submit the bonus request | 
				
			||||
 | 
					    - Department Head: can approve the bonus request of users | 
				
			||||
 | 
					    - Manager(HR Manager): can approve the bonus request of users | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Company | 
				
			||||
 | 
					------- | 
				
			||||
 | 
					* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					License | 
				
			||||
 | 
					------- | 
				
			||||
 | 
					General Public License, Version 3 (LGPL v3). | 
				
			||||
 | 
					(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Credits | 
				
			||||
 | 
					------- | 
				
			||||
 | 
					Developer : (V15) Ruksana P, | 
				
			||||
 | 
					            (V16) Sabeel B, | 
				
			||||
 | 
					            (V17) Sabeel B, | 
				
			||||
 | 
					            (V18) Ammu Raj, | 
				
			||||
 | 
					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,21 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					#    Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | 
				
			||||
 | 
					#    Author: Ammu Raj(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 | 
				
			||||
@ -0,0 +1,52 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					#    Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | 
				
			||||
 | 
					#    Author: Ammu Raj(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': 'Employee Bonus', | 
				
			||||
 | 
					    'version': '18.0.1.0.0', | 
				
			||||
 | 
					    'category': 'Human Resources', | 
				
			||||
 | 
					    'summary': """This module will help you in managing the employee bonus""", | 
				
			||||
 | 
					    'description': """This module helps to manage the bonus for employees , the  | 
				
			||||
 | 
					     user can submit the bonus request , department head can validate request  | 
				
			||||
 | 
					     manager can approve the request of employees and billing administrator can | 
				
			||||
 | 
					     post the journal entry. The approved bonus amount will be added to payslip | 
				
			||||
 | 
					     """, | 
				
			||||
 | 
					    'author': 'Cybrosys Techno Solutions', | 
				
			||||
 | 
					    'company': 'Cybrosys Techno Solutions', | 
				
			||||
 | 
					    'maintainer': 'Cybrosys Techno Solutions', | 
				
			||||
 | 
					    'website': "https://www.cybrosys.com", | 
				
			||||
 | 
					    'depends': ['account', 'hr_payroll_community'], | 
				
			||||
 | 
					    'data': [ | 
				
			||||
 | 
					        'security/employee_bonus_manager_groups.xml', | 
				
			||||
 | 
					        'security/bonus_request_security.xml', | 
				
			||||
 | 
					        'security/ir.model.access.csv', | 
				
			||||
 | 
					        'data/ir_sequence_data.xml', | 
				
			||||
 | 
					        'data/hr_salary_rule_data.xml', | 
				
			||||
 | 
					        'data/hr_payroll_structure_data.xml', | 
				
			||||
 | 
					        'views/bonus_request_views.xml', | 
				
			||||
 | 
					        'views/bonus_reason_views.xml', | 
				
			||||
 | 
					        'views/employee_bonus_manager_menus.xml' | 
				
			||||
 | 
					    ], | 
				
			||||
 | 
					    'images': ['static/description/banner.png'], | 
				
			||||
 | 
					    'license': 'LGPL-3', | 
				
			||||
 | 
					    'installable': True, | 
				
			||||
 | 
					    'auto_install': False, | 
				
			||||
 | 
					    'application': True | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,11 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="UTF-8" ?> | 
				
			||||
 | 
					<odoo noupdate="1"> | 
				
			||||
 | 
					    <!-- Update salary structure for bonus   --> | 
				
			||||
 | 
					    <record id="hr_payroll_community.structure_base" | 
				
			||||
 | 
					            model="hr.payroll.structure"> | 
				
			||||
 | 
					        <field eval="[(6, 0, [ref('hr_payroll_community.hr_rule_basic'), | 
				
			||||
 | 
					         ref('hr_payroll_community.hr_rule_taxable'), | 
				
			||||
 | 
					         ref('hr_payroll_community.hr_rule_net'),ref('hr_salary_rule_bonus')])]" | 
				
			||||
 | 
					               name="rule_ids"/> | 
				
			||||
 | 
					    </record> | 
				
			||||
 | 
					</odoo> | 
				
			||||
@ -0,0 +1,12 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="UTF-8" ?> | 
				
			||||
 | 
					<odoo noupdate="1"> | 
				
			||||
 | 
					    <!-- Salary rule Employee Bonus   --> | 
				
			||||
 | 
					    <record id="hr_salary_rule_bonus" model="hr.salary.rule"> | 
				
			||||
 | 
					        <field name="amount_select">code</field> | 
				
			||||
 | 
					        <field name="code">BONUS</field> | 
				
			||||
 | 
					        <field name="category_id" ref="hr_payroll_community.ALW"/> | 
				
			||||
 | 
					        <field name="name">Employee Bonus</field> | 
				
			||||
 | 
					        <field name="sequence" eval="59"/> | 
				
			||||
 | 
					        <field name="amount_python_compute">result = inputs.BONUS.amount</field> | 
				
			||||
 | 
					    </record> | 
				
			||||
 | 
					</odoo> | 
				
			||||
@ -0,0 +1,11 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="utf-8"?> | 
				
			||||
 | 
					<odoo noupdate="1"> | 
				
			||||
 | 
					    <!-- Sequence number for Bonus Request --> | 
				
			||||
 | 
					    <record id="ir_sequence_bonus_request" model="ir.sequence"> | 
				
			||||
 | 
					        <field name="name">Bonus Request Sequence</field> | 
				
			||||
 | 
					        <field name="code">bonus.request</field> | 
				
			||||
 | 
					        <field name="prefix">BR/</field> | 
				
			||||
 | 
					        <field name="padding">4</field> | 
				
			||||
 | 
					        <field name="company_id" eval="False"/> | 
				
			||||
 | 
					    </record> | 
				
			||||
 | 
					</odoo> | 
				
			||||
@ -0,0 +1,6 @@ | 
				
			|||||
 | 
					## Module <employee_bonus_manager> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					#### 12.12.2024 | 
				
			||||
 | 
					#### Version 18.0.1.0.0 | 
				
			||||
 | 
					#### ADD | 
				
			||||
 | 
					- Initial Commit for Employee Bonus | 
				
			||||
@ -0,0 +1,23 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					#    Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | 
				
			||||
 | 
					#    Author: Ammu Raj(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 bonus_reason | 
				
			||||
 | 
					from . import bonus_request | 
				
			||||
 | 
					from . import hr_payslip | 
				
			||||
@ -0,0 +1,30 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					#    Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | 
				
			||||
 | 
					#    Author: Ammu Raj(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 fields, models | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					class BonusReason(models.Model): | 
				
			||||
 | 
					    """ This class is used to create the bonus reasons.""" | 
				
			||||
 | 
					    _name = "bonus.reason" | 
				
			||||
 | 
					    _description = 'Bonus Reason Records' | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    name = fields.Char(string='Reason', required=True, | 
				
			||||
 | 
					                       help='Reason to be added for the bonus requests.') | 
				
			||||
@ -0,0 +1,233 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					#    Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | 
				
			||||
 | 
					#    Author: Ammu Raj(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 BonusRequest(models.Model): | 
				
			||||
 | 
					    """ This class is created for model bonus.request. It contains fields and | 
				
			||||
 | 
					    functions for the model. | 
				
			||||
 | 
					    Methods: | 
				
			||||
 | 
					        create(self, vals): | 
				
			||||
 | 
					            override create function for generating sequence number for the new | 
				
			||||
 | 
					            records of the model. | 
				
			||||
 | 
					        action_confirm(self): | 
				
			||||
 | 
					            actions to perform when clicking on the 'Confirm' button. | 
				
			||||
 | 
					        action_department_approve(self): | 
				
			||||
 | 
					            actions to perform when clicking on the 'Approve by Department' | 
				
			||||
 | 
					            button. | 
				
			||||
 | 
					        action_manager_approve(self): | 
				
			||||
 | 
					            actions to perform when clicking on the 'Approve by Manager' | 
				
			||||
 | 
					            button. | 
				
			||||
 | 
					        action_reject(self): | 
				
			||||
 | 
					            actions to perform when clicking on the 'Reject' button. | 
				
			||||
 | 
					        action_reset_to_draft(self): | 
				
			||||
 | 
					            actions to perform when clicking on the 'Reset to Draft' button.""" | 
				
			||||
 | 
					    _name = 'bonus.request' | 
				
			||||
 | 
					    _description = 'Create Bonus Request' | 
				
			||||
 | 
					    _inherit = 'mail.thread' | 
				
			||||
 | 
					    _rec_name = 'reference' | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    reference = fields.Char(string='Reference Number', copy=False, | 
				
			||||
 | 
					                            help='Sequence number for the bonus request.') | 
				
			||||
 | 
					    state = fields.Selection([('draft', 'Draft'), ('submitted', 'Submitted'), | 
				
			||||
 | 
					                              ('department_approved', 'Department Approved'), | 
				
			||||
 | 
					                              ('manager_approved', 'Manager Approved'), | 
				
			||||
 | 
					                              ('rejected', 'Rejected'), | 
				
			||||
 | 
					                              ('accounting', 'Accounting Head Approved')], | 
				
			||||
 | 
					                             string='State', default='draft', tracking=True, | 
				
			||||
 | 
					                             help='State of the bonus request', copy=False, | 
				
			||||
 | 
					                             group_expand='_group_expand_states') | 
				
			||||
 | 
					    employee_id = fields.Many2one('hr.employee', string='Employee', store=True, | 
				
			||||
 | 
					                                  required=True, tracking=True, | 
				
			||||
 | 
					                                  help='The bonus will be given to this ' | 
				
			||||
 | 
					                                       'employee') | 
				
			||||
 | 
					    user_id = fields.Many2one('res.users', string='User', | 
				
			||||
 | 
					                              related='employee_id.user_id', | 
				
			||||
 | 
					                              help='The user of the employee(If any)') | 
				
			||||
 | 
					    department_id = fields.Many2one('hr.department', string='Department', | 
				
			||||
 | 
					                                    help='The department of the employee', | 
				
			||||
 | 
					                                    store=True) | 
				
			||||
 | 
					    job_id = fields.Many2one('hr.job', string='Job', store=True, | 
				
			||||
 | 
					                             help='Job of the employee') | 
				
			||||
 | 
					    bonus_reason_id = fields.Many2one('bonus.reason', string='Bonus Reason', | 
				
			||||
 | 
					                                      help='Reason for providing the Bonus', | 
				
			||||
 | 
					                                      required=True) | 
				
			||||
 | 
					    confirmed_user_id = fields.Many2one('res.users', string='Confirmed by', | 
				
			||||
 | 
					                                        readonly=True, copy=False, | 
				
			||||
 | 
					                                        help='This field will record the name ' | 
				
			||||
 | 
					                                             'of the person who confirmed ' | 
				
			||||
 | 
					                                             'the bonus request.') | 
				
			||||
 | 
					    confirmed_date = fields.Date(string='Confirmed Date', readonly=True, | 
				
			||||
 | 
					                                 copy=False, tracking=True, | 
				
			||||
 | 
					                                 help='Confirmed date of bonus request') | 
				
			||||
 | 
					    bonus_amount = fields.Float(string='Bonus Amount', tracking=True, | 
				
			||||
 | 
					                                help='This amount will be given as the bonus.') | 
				
			||||
 | 
					    currency_id = fields.Many2one('res.currency', string='Company Currency', | 
				
			||||
 | 
					                                  readonly=True, | 
				
			||||
 | 
					                                  default=lambda self: | 
				
			||||
 | 
					                                  self.env.user.company_id.currency_id, | 
				
			||||
 | 
					                                  help='Company Currency') | 
				
			||||
 | 
					    company_id = fields.Many2one('res.company', string='Company', readonly=True, | 
				
			||||
 | 
					                                 default=lambda self: self.env.company, | 
				
			||||
 | 
					                                 help='Company of the user.') | 
				
			||||
 | 
					    department_approved_date = fields.Date(string='Department Approved Date', | 
				
			||||
 | 
					                                           readonly=True, copy=False, | 
				
			||||
 | 
					                                           help='Date on which the bonus ' | 
				
			||||
 | 
					                                                'request is approved by the ' | 
				
			||||
 | 
					                                                'Department.') | 
				
			||||
 | 
					    manager_approved_date = fields.Date(string='Manager Approved Date', | 
				
			||||
 | 
					                                        readonly=True, copy=False, | 
				
			||||
 | 
					                                        help='Date on which the bonus request ' | 
				
			||||
 | 
					                                             'is approved by the Manager.') | 
				
			||||
 | 
					    department_manager_id = fields.Many2one('res.users', readonly=True, | 
				
			||||
 | 
					                                            help='Name of the Department Head,' | 
				
			||||
 | 
					                                                 ' who approved the bonus ' | 
				
			||||
 | 
					                                                 'request', copy=False, | 
				
			||||
 | 
					                                            string='Department Head') | 
				
			||||
 | 
					    hr_manager_id = fields.Many2one('res.users', string='Manager', copy=False, | 
				
			||||
 | 
					                                    help='Name of the Manager, who approved the' | 
				
			||||
 | 
					                                         ' bonus request', readonly=True) | 
				
			||||
 | 
					    journal_id = fields.Many2one('account.journal', string='Bonus Journal', | 
				
			||||
 | 
					                                 help='The Jornal for bonus request', | 
				
			||||
 | 
					                                 company_dependent=True, required=False, | 
				
			||||
 | 
					                                 domain="[('type', '=', 'general')]", | 
				
			||||
 | 
					                                 states={'accounting': [('required', True)]}) | 
				
			||||
 | 
					    move_id = fields.Many2one('account.move', string='Accounting Entry', | 
				
			||||
 | 
					                              help='Accounting entry of bonus request', | 
				
			||||
 | 
					                              readonly=True) | 
				
			||||
 | 
					    credit_account_id = fields.Many2one('account.account', | 
				
			||||
 | 
					                                        string='Credit Account', | 
				
			||||
 | 
					                                        help='The credit account for creating ' | 
				
			||||
 | 
					                                             'journal entry') | 
				
			||||
 | 
					    debit_account_id = fields.Many2one('account.account', | 
				
			||||
 | 
					                                       string='Debit Account', | 
				
			||||
 | 
					                                       help='The debit account for creating ' | 
				
			||||
 | 
					                                            'journal entry') | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.model_create_multi | 
				
			||||
 | 
					    def create(self, vals_list): | 
				
			||||
 | 
					        """ Override the create function for creating new sequence number. | 
				
			||||
 | 
					        @params vals (dict): values for creating new records. | 
				
			||||
 | 
					        @returns res (models.Model): the created records of 'bonus.request' """ | 
				
			||||
 | 
					        for vals in vals_list: | 
				
			||||
 | 
					            if vals.get('reference', 'New') == 'New': | 
				
			||||
 | 
					                vals['reference'] = self.env['ir.sequence'].next_by_code( | 
				
			||||
 | 
					                    'bonus.request') or 'New' | 
				
			||||
 | 
					            res = super().create(vals) | 
				
			||||
 | 
					            return res | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.onchange('employee_id') | 
				
			||||
 | 
					    def _onchange_employee_id(self): | 
				
			||||
 | 
					        """ When changing employee_id , the department_id and job_id of | 
				
			||||
 | 
					        employee is changed """ | 
				
			||||
 | 
					        if self.employee_id: | 
				
			||||
 | 
					            self.department_id = self.employee_id.department_id | 
				
			||||
 | 
					            self.job_id = self.employee_id.job_id | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    def _group_expand_states(self): | 
				
			||||
 | 
					        """ To add the states in the kanban view """ | 
				
			||||
 | 
					        return [key for | 
				
			||||
 | 
					                key, val in type(self).state.selection] | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    def action_confirm(self): | 
				
			||||
 | 
					        """ Function for the 'Confirm' button to change the state to | 
				
			||||
 | 
					        'submitted', and update the confirmed user and date. """ | 
				
			||||
 | 
					        self.write({ | 
				
			||||
 | 
					            'state': 'submitted', | 
				
			||||
 | 
					            'confirmed_user_id': self._uid, | 
				
			||||
 | 
					            'confirmed_date': fields.Date.today() | 
				
			||||
 | 
					        }) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    def action_department_approve(self): | 
				
			||||
 | 
					        """ Function for the 'Approve by Department' button to change the state | 
				
			||||
 | 
					        to 'department_approved', and update the department manager and approved | 
				
			||||
 | 
					        time. """ | 
				
			||||
 | 
					        self.write({ | 
				
			||||
 | 
					            'state': 'department_approved', | 
				
			||||
 | 
					            'department_manager_id': self._uid, | 
				
			||||
 | 
					            'department_approved_date': fields.Date.today() | 
				
			||||
 | 
					        }) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    def action_manager_approve(self): | 
				
			||||
 | 
					        """ Function for the 'Approve by Manager' button to change the state to | 
				
			||||
 | 
					        'manager_approved', and update the HR manager and approved date & time. | 
				
			||||
 | 
					        """ | 
				
			||||
 | 
					        self.write({ | 
				
			||||
 | 
					            'state': 'manager_approved', | 
				
			||||
 | 
					            'hr_manager_id': self._uid, | 
				
			||||
 | 
					            'manager_approved_date': fields.Date.today() | 
				
			||||
 | 
					        }) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    def action_reject(self): | 
				
			||||
 | 
					        """ Function for the 'Reject' button to change the state to 'rejected'. | 
				
			||||
 | 
					        """ | 
				
			||||
 | 
					        self.state = 'rejected' | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    def action_reset_to_draft(self): | 
				
			||||
 | 
					        """ Function for the 'Reset to Draft' button to change the state to | 
				
			||||
 | 
					        'draft' and reset the fields which are to be updated on changing the | 
				
			||||
 | 
					        states.""" | 
				
			||||
 | 
					        self.write({ | 
				
			||||
 | 
					            'state': 'draft', | 
				
			||||
 | 
					            'confirmed_user_id': False, | 
				
			||||
 | 
					            'confirmed_date': False, | 
				
			||||
 | 
					            'department_manager_id': False, | 
				
			||||
 | 
					            'department_approved_date': False, | 
				
			||||
 | 
					            'hr_manager_id': False, | 
				
			||||
 | 
					            'manager_approved_date': False | 
				
			||||
 | 
					        }) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    def action_post_journal_entry(self): | 
				
			||||
 | 
					        """ Function for the 'Post Journal Entry' button to create a draft entry | 
				
			||||
 | 
					         for approved bonus request """ | 
				
			||||
 | 
					        account_move = self.env['account.move'].create({ | 
				
			||||
 | 
					            'ref': self.reference, | 
				
			||||
 | 
					            'state': 'draft', | 
				
			||||
 | 
					            'date': self.manager_approved_date, | 
				
			||||
 | 
					            'journal_id': self.journal_id.id, | 
				
			||||
 | 
					            'line_ids': [ | 
				
			||||
 | 
					                (0, 0, { | 
				
			||||
 | 
					                    'account_id': self.credit_account_id.id, | 
				
			||||
 | 
					                    'credit': self.bonus_amount, | 
				
			||||
 | 
					                    'name': self.employee_id.name + '-' + self.reference, | 
				
			||||
 | 
					                    'debit': 0.0, | 
				
			||||
 | 
					                }), | 
				
			||||
 | 
					                (0, 0, { | 
				
			||||
 | 
					                    'account_id': self.debit_account_id.id, | 
				
			||||
 | 
					                    'debit': self.bonus_amount, | 
				
			||||
 | 
					                    'name': self.employee_id.name + '-' + self.reference, | 
				
			||||
 | 
					                    'credit': 0.0, | 
				
			||||
 | 
					                }) | 
				
			||||
 | 
					            ] | 
				
			||||
 | 
					        }) | 
				
			||||
 | 
					        account_move.state = 'posted' | 
				
			||||
 | 
					        self.move_id = account_move.id | 
				
			||||
 | 
					        self.state = 'accounting' | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    def action_view_journal_items(self): | 
				
			||||
 | 
					        """To view the journal items for the bonus request""" | 
				
			||||
 | 
					        return { | 
				
			||||
 | 
					            'name': 'Journal Items', | 
				
			||||
 | 
					            'type': 'ir.actions.act_window', | 
				
			||||
 | 
					            'res_model': 'account.move', | 
				
			||||
 | 
					            'view_mode': 'form', | 
				
			||||
 | 
					            'res_id': self.move_id.id | 
				
			||||
 | 
					        } | 
				
			||||
@ -0,0 +1,47 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					#    Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | 
				
			||||
 | 
					#    Author: Ammu Raj(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, models | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					class HrPayslip(models.Model): | 
				
			||||
 | 
					    """ This class is used to create the bonus reasons. """ | 
				
			||||
 | 
					    _inherit = "hr.payslip" | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.onchange('employee_id', 'date_from', 'date_to', 'struct_id') | 
				
			||||
 | 
					    def _onchange_employee_id(self): | 
				
			||||
 | 
					        """ When changing employee the bonus amount for the employee will be | 
				
			||||
 | 
					        loaded as other input  """ | 
				
			||||
 | 
					        bonus_rule = self.env.ref( | 
				
			||||
 | 
					            'employee_bonus_manager.hr_salary_rule_bonus') | 
				
			||||
 | 
					        rules = self.struct_id.rule_ids.mapped('name') | 
				
			||||
 | 
					        if bonus_rule.name in rules: | 
				
			||||
 | 
					            bonus = self.env['bonus.request'].search([ | 
				
			||||
 | 
					                ('employee_id', '=', self.employee_id.id), | 
				
			||||
 | 
					                ('state', '=', 'accounting'), ('move_id.state', '=', 'posted'), | 
				
			||||
 | 
					                ('move_id.date', '>=', self.date_from), | 
				
			||||
 | 
					                ('move_id.date', '<=', self.date_to)]) | 
				
			||||
 | 
					            amount = sum(bonus.mapped('bonus_amount')) | 
				
			||||
 | 
					            self.input_line_ids = [(0, 0, { | 
				
			||||
 | 
					                'name': 'Bonus', | 
				
			||||
 | 
					                'code': 'BONUS', | 
				
			||||
 | 
					                'contract_id': self.contract_id.id, | 
				
			||||
 | 
					                'amount': amount, | 
				
			||||
 | 
					            })] | 
				
			||||
@ -0,0 +1,12 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="utf-8"?> | 
				
			||||
 | 
					<odoo noupdate="1"> | 
				
			||||
 | 
					    <!-- Record rules for Bonus Request --> | 
				
			||||
 | 
					    <!-- Multi-company rule --> | 
				
			||||
 | 
					    <record id="bonus_request_rule_company" model="ir.rule"> | 
				
			||||
 | 
					        <field name="name">Bonus Request multi company rule</field> | 
				
			||||
 | 
					        <field name="model_id" ref="model_bonus_request"/> | 
				
			||||
 | 
					        <field name="domain_force">['|', ('company_id', '=', False), | 
				
			||||
 | 
					            ('company_id', 'in', company_ids)] | 
				
			||||
 | 
					        </field> | 
				
			||||
 | 
					    </record> | 
				
			||||
 | 
					</odoo> | 
				
			||||
@ -0,0 +1,37 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="utf-8"?> | 
				
			||||
 | 
					<odoo> | 
				
			||||
 | 
					    <!-- Module category for the module to add the security groups --> | 
				
			||||
 | 
					    <record id="module_employee_bonus_manager" model="ir.module.category"> | 
				
			||||
 | 
					        <field name="name">Employee Bonus</field> | 
				
			||||
 | 
					        <field name="description">Access for Employee Bonus module</field> | 
				
			||||
 | 
					        <field name="sequence">50</field> | 
				
			||||
 | 
					    </record> | 
				
			||||
 | 
					    <!-- The security groups for the module --> | 
				
			||||
 | 
					    <!-- The User group for creating bonus request --> | 
				
			||||
 | 
					    <record id="employee_bonus_manager_group_user" model="res.groups"> | 
				
			||||
 | 
					        <field name="name">User</field> | 
				
			||||
 | 
					        <field name="category_id" ref="module_employee_bonus_manager"/> | 
				
			||||
 | 
					        <field name="implied_ids" eval="[(4, ref('base.group_user'))]"/> | 
				
			||||
 | 
					    </record> | 
				
			||||
 | 
					    <!-- The Department Head group for validating bonus request --> | 
				
			||||
 | 
					    <record id="employee_bonus_manager_group_department" model="res.groups"> | 
				
			||||
 | 
					        <field name="name">Department Head</field> | 
				
			||||
 | 
					        <field name="category_id" ref="module_employee_bonus_manager"/> | 
				
			||||
 | 
					        <field name="implied_ids" | 
				
			||||
 | 
					               eval="[(4, ref('employee_bonus_manager_group_user'))]"/> | 
				
			||||
 | 
					    </record> | 
				
			||||
 | 
					    <!-- The Manager group for approving bonus request --> | 
				
			||||
 | 
					    <record id="employee_bonus_manager_group_manager" model="res.groups"> | 
				
			||||
 | 
					        <field name="name">Manager</field> | 
				
			||||
 | 
					        <field name="category_id" ref="module_employee_bonus_manager"/> | 
				
			||||
 | 
					        <field name="implied_ids" | 
				
			||||
 | 
					               eval="[(4, ref('employee_bonus_manager_group_department'))]"/> | 
				
			||||
 | 
					        <field name="users" | 
				
			||||
 | 
					               eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/> | 
				
			||||
 | 
					    </record> | 
				
			||||
 | 
					    <!-- Add the default user to the security group User --> | 
				
			||||
 | 
					    <record id="base.default_user" model="res.users"> | 
				
			||||
 | 
					        <field name="groups_id" | 
				
			||||
 | 
					               eval="[(4,ref('employee_bonus_manager_group_user'))]"/> | 
				
			||||
 | 
					    </record> | 
				
			||||
 | 
					</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: 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: 912 KiB  | 
| 
		 After Width: | Height: | Size: 1.3 MiB  | 
| 
		 After Width: | Height: | Size: 46 KiB  | 
| 
		 After Width: | Height: | Size: 44 KiB  | 
| 
		 After Width: | Height: | Size: 46 KiB  | 
| 
		 After Width: | Height: | Size: 85 KiB  | 
| 
		 After Width: | Height: | Size: 330 KiB  | 
| 
		 After Width: | Height: | Size: 89 KiB  | 
| 
		 After Width: | Height: | Size: 99 KiB  | 
| 
		 After Width: | Height: | Size: 101 KiB  | 
| 
		 After Width: | Height: | Size: 100 KiB  | 
| 
		 After Width: | Height: | Size: 31 KiB  | 
| 
		 After Width: | Height: | Size: 87 KiB  | 
| 
		 After Width: | Height: | Size: 103 KiB  | 
| 
		 After Width: | Height: | Size: 101 KiB  | 
| 
		 After Width: | Height: | Size: 113 KiB  | 
| 
		 After Width: | Height: | Size: 152 KiB  | 
| 
		 After Width: | Height: | Size: 157 KiB  |