@ -0,0 +1,35 @@ |
|||
OHRMS Advance Salary' |
|||
===================== |
|||
|
|||
Advance Salary In HR. |
|||
|
|||
Installation |
|||
============ |
|||
- www.odoo.com/documentation/10.0/setup/install.html |
|||
- Install our custom addon |
|||
|
|||
License |
|||
======= |
|||
GNU AFFERO GENERAL PUBLIC LICENSE, Version 3 (AGPLv3) |
|||
(http://www.gnu.org/licenses/agpl.html) |
|||
|
|||
Bug Tracker |
|||
=========== |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
Credits |
|||
======= |
|||
* Cybrosys Techno Solutions <https://www.cybrosys.com> |
|||
|
|||
Author |
|||
------ |
|||
|
|||
Developers: Anusha P P <anusha@cybrosys.in> |
|||
Sreejith P <sreejith@cybrosys.in> |
|||
|
|||
Maintainer |
|||
---------- |
|||
|
|||
This module is maintained by Cybrosys Technologies. |
|||
|
|||
For support and more information, please visit https://www.cybrosys.com. |
@ -0,0 +1,4 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
import models |
|||
|
@ -0,0 +1,51 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################### |
|||
# A part of OpenHRMS Project <https://www.openhrms.com> |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2018-TODAY Cybrosys Technologies (<https://www.cybrosys.com>). |
|||
# Author: Anusha P P (<https://www.cybrosys.com>) |
|||
# |
|||
# This program is free software: you can modify |
|||
# it under the terms of the GNU Affero General Public License (AGPL) as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################### |
|||
{ |
|||
'name': 'OHRMS Advance Salary', |
|||
'version': '10.0.1.0.0', |
|||
'summary': 'Advance Salary In HR', |
|||
'description': """ |
|||
Helps you to manage Advance Salary Request of your company's staff. |
|||
""", |
|||
'category': 'Human Resources', |
|||
'author': "Cybrosys Techno Solutions", |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': "https://www.openhrms.com", |
|||
'depends': [ |
|||
'hr_payroll', 'hr', 'account_accountant', 'hr_contract', 'hr_loan', |
|||
], |
|||
'data': [ |
|||
'security/ir.model.access.csv', |
|||
'security/security.xml', |
|||
'views/salary_structure.xml', |
|||
'views/salary_advance.xml', |
|||
], |
|||
'demo': [], |
|||
'images': ['static/description/banner.jpg'], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
|||
|
@ -0,0 +1,5 @@ |
|||
# -*- coding: utf-8 -*- |
|||
import salary_advance |
|||
import salary_structure |
|||
import hr_advance_payslip |
|||
|
@ -0,0 +1,29 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from datetime import datetime |
|||
from odoo import models |
|||
from odoo.exceptions import except_orm |
|||
|
|||
|
|||
class SalaryRuleInput(models.Model): |
|||
_inherit = 'hr.payslip' |
|||
|
|||
def get_inputs(self, contract_ids, date_from, date_to): |
|||
"""This Compute the other inputs to employee payslip. |
|||
""" |
|||
res = super(SalaryRuleInput, self).get_inputs(contract_ids, date_from, date_to) |
|||
print self, contract_ids, date_from, date_to |
|||
contract_obj = self.env['hr.contract'] |
|||
emp_id = contract_obj.browse(contract_ids[0]).employee_id |
|||
adv_salary = self.env['salary.advance'].search([('employee_id', '=', emp_id.id)]) |
|||
print emp_id, adv_salary |
|||
for adv_obj in adv_salary: |
|||
current_date = datetime.strptime(date_from, '%Y-%m-%d').date().month |
|||
date = adv_obj.date |
|||
existing_date = datetime.strptime(date, '%Y-%m-%d').date().month |
|||
if current_date == existing_date: |
|||
state = adv_obj.state |
|||
amount = adv_obj.advance |
|||
for result in res: |
|||
if state == 'approve' and amount != 0 and result.get('code') == 'SAR': |
|||
result['amount'] = amount |
|||
return res |
@ -0,0 +1,186 @@ |
|||
# -*- coding: utf-8 -*- |
|||
import time |
|||
from datetime import datetime |
|||
from odoo import fields, models, api, _ |
|||
from odoo.exceptions import except_orm |
|||
from odoo import exceptions |
|||
|
|||
|
|||
class SalaryAdvancePayment(models.Model): |
|||
_name = "salary.advance" |
|||
_inherit = ['mail.thread', 'ir.needaction_mixin'] |
|||
|
|||
name = fields.Char(string='Name', readonly=True, select=True, default=lambda self: 'Adv/') |
|||
employee_id = fields.Many2one('hr.employee', string='Employee', required=True) |
|||
date = fields.Date(string='Date', required=True, default=lambda self: fields.Date.today()) |
|||
reason = fields.Text(string='Reason') |
|||
currency_id = fields.Many2one('res.currency', string='Currency', required=True, |
|||
default=lambda self: self.env.user.company_id.currency_id) |
|||
company_id = fields.Many2one('res.company', string='Company', required=True, |
|||
default=lambda self: self.env.user.company_id) |
|||
advance = fields.Float(string='Advance', required=True) |
|||
payment_method = fields.Many2one('account.journal', string='Payment Method') |
|||
exceed_condition = fields.Boolean(string='Exceed than maximum', |
|||
help="The Advance is greater than the maximum percentage in salary structure") |
|||
department = fields.Many2one('hr.department', string='Department') |
|||
state = fields.Selection([('draft', 'Draft'), |
|||
('submit', 'Submitted'), |
|||
('waiting_approval', 'Waiting Approval From Accounts'), |
|||
('approve', 'Approved'), |
|||
('cancel', 'Cancelled'), |
|||
('reject', 'Rejected')], string='Status', default='draft', track_visibility='onchange') |
|||
debit = fields.Many2one('account.account', string='Debit Account') |
|||
credit = fields.Many2one('account.account', string='Credit Account') |
|||
journal = fields.Many2one('account.journal', string='Journal') |
|||
employee_contract_id = fields.Many2one('hr.contract', string='Contract') |
|||
|
|||
def onchange_employee_id(self, employee_id): |
|||
if employee_id: |
|||
employee_obj = self.env['hr.employee'].browse(employee_id) |
|||
department_id = employee_obj.department_id.id |
|||
domain = [('employee_id', '=', employee_id)] |
|||
return {'value': {'department': department_id}, 'domain': { |
|||
'employee_contract_id': domain, |
|||
}} |
|||
|
|||
@api.onchange('company_id') |
|||
def onchange_company_id(self): |
|||
company = self.company_id |
|||
domain = [('company_id.id', '=', company.id)] |
|||
result = { |
|||
'domain': { |
|||
'journal': domain, |
|||
}, |
|||
|
|||
} |
|||
return result |
|||
|
|||
@api.one |
|||
def submit_to_manager(self): |
|||
self.state = 'submit' |
|||
|
|||
@api.one |
|||
def cancel(self): |
|||
self.state = 'cancel' |
|||
|
|||
@api.one |
|||
def reject(self): |
|||
self.state = 'reject' |
|||
|
|||
@api.model |
|||
def create(self, vals): |
|||
vals['name'] = self.env['ir.sequence'].get('salary.advance.seq') or ' ' |
|||
res_id = super(SalaryAdvancePayment, self).create(vals) |
|||
return res_id |
|||
|
|||
@api.one |
|||
def approve_request(self): |
|||
"""This Approve the employee salary advance request. |
|||
""" |
|||
emp_obj = self.env['hr.employee'] |
|||
address = emp_obj.browse([self.employee_id.id]).address_home_id |
|||
if not address.id: |
|||
raise except_orm('Error!', 'Define home address for employee') |
|||
salary_advance_search = self.search([('employee_id', '=', self.employee_id.id), ('id', '!=', self.id), |
|||
('state', '=', 'approve')]) |
|||
current_month = datetime.strptime(self.date, '%Y-%m-%d').date().month |
|||
for each_advance in salary_advance_search: |
|||
existing_month = datetime.strptime(each_advance.date, '%Y-%m-%d').date().month |
|||
if current_month == existing_month: |
|||
raise except_orm('Error!', 'Advance can be requested once in a month') |
|||
if not self.employee_contract_id: |
|||
raise except_orm('Error!', 'Define a contract for the employee') |
|||
struct_id = self.employee_contract_id.struct_id |
|||
if not struct_id.max_percent or not struct_id.advance_date: |
|||
raise except_orm('Error!', 'Max percentage or advance days are not provided in Contract') |
|||
adv = self.advance |
|||
amt = (self.employee_contract_id.struct_id.max_percent * self.employee_contract_id.wage) / 100 |
|||
if adv > amt and not self.exceed_condition: |
|||
raise except_orm('Error!', 'Advance amount is greater than allotted') |
|||
|
|||
if not self.advance: |
|||
raise except_orm('Warning', 'You must Enter the Salary Advance amount') |
|||
payslip_obj = self.env['hr.payslip'].search([('employee_id', '=', self.employee_id.id), |
|||
('state', '=', 'done'), ('date_from', '<=', self.date), |
|||
('date_to', '>=', self.date)]) |
|||
if payslip_obj: |
|||
raise except_orm('Warning', "This month salary already calculated") |
|||
|
|||
for slip in self.env['hr.payslip'].search([('employee_id', '=', self.employee_id.id)]): |
|||
slip_moth = datetime.strptime(slip.date_from, '%Y-%m-%d').date().month |
|||
if current_month == slip_moth + 1: |
|||
slip_day = datetime.strptime(slip.date_from, '%Y-%m-%d').date().day |
|||
current_day = datetime.strptime(self.date, '%Y-%m-%d').date().day |
|||
if current_day - slip_day < struct_id.advance_date: |
|||
raise exceptions.Warning( |
|||
_('Request can be done after "%s" Days From prevoius month salary') % struct_id.advance_date) |
|||
self.state = 'waiting_approval' |
|||
|
|||
@api.one |
|||
def approve_request_acc_dept(self): |
|||
"""This Approve the employee salary advance request from accounting department. |
|||
""" |
|||
salary_advance_search = self.search([('employee_id', '=', self.employee_id.id), ('id', '!=', self.id), |
|||
('state', '=', 'approve')]) |
|||
current_month = datetime.strptime(self.date, '%Y-%m-%d').date().month |
|||
for each_advance in salary_advance_search: |
|||
existing_month = datetime.strptime(each_advance.date, '%Y-%m-%d').date().month |
|||
print current_month, existing_month |
|||
if current_month == existing_month: |
|||
raise except_orm('Error!', 'Advance can be requested once in a month') |
|||
if not self.debit or not self.credit or not self.journal: |
|||
raise except_orm('Warning', "You must enter Debit & Credit account and journal to approve ") |
|||
if not self.advance: |
|||
raise except_orm('Warning', 'You must Enter the Salary Advance amount') |
|||
|
|||
move_obj = self.env['account.move'] |
|||
timenow = time.strftime('%Y-%m-%d') |
|||
line_ids = [] |
|||
debit_sum = 0.0 |
|||
credit_sum = 0.0 |
|||
for request in self: |
|||
amount = request.advance |
|||
request_name = request.employee_id.name |
|||
reference = request.name |
|||
journal_id = request.journal.id |
|||
move = { |
|||
'narration': 'Salary Advance Of ' + request_name, |
|||
'ref': reference, |
|||
'journal_id': journal_id, |
|||
'date': timenow, |
|||
'state': 'posted', |
|||
} |
|||
|
|||
debit_account_id = request.debit.id |
|||
credit_account_id = request.credit.id |
|||
|
|||
if debit_account_id: |
|||
debit_line = (0, 0, { |
|||
'name': request_name, |
|||
'account_id': debit_account_id, |
|||
'journal_id': journal_id, |
|||
'date': timenow, |
|||
'debit': amount > 0.0 and amount or 0.0, |
|||
'credit': amount < 0.0 and -amount or 0.0, |
|||
'currency_id': self.currency_id.id, |
|||
}) |
|||
line_ids.append(debit_line) |
|||
debit_sum += debit_line[2]['debit'] - debit_line[2]['credit'] |
|||
|
|||
if credit_account_id: |
|||
credit_line = (0, 0, { |
|||
'name': request_name, |
|||
'account_id': credit_account_id, |
|||
'journal_id': journal_id, |
|||
'date': timenow, |
|||
'debit': amount < 0.0 and -amount or 0.0, |
|||
'credit': amount > 0.0 and amount or 0.0, |
|||
'currency_id': self.currency_id.id, |
|||
}) |
|||
line_ids.append(credit_line) |
|||
credit_sum += credit_line[2]['credit'] - credit_line[2]['debit'] |
|||
|
|||
move.update({'line_ids': line_ids}) |
|||
move_id = move_obj.create(move) |
|||
self.state = 'approve' |
|||
return True |
@ -0,0 +1,11 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from odoo import fields, models |
|||
|
|||
|
|||
class SalaryStructure(models.Model): |
|||
_inherit = 'hr.payroll.structure' |
|||
|
|||
max_percent = fields.Integer(string='Max.Salary Advance Percentage') |
|||
advance_date = fields.Integer(string='Salary Advance-After days') |
|||
|
|
@ -0,0 +1,35 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<data> |
|||
|
|||
<record id="rule_advance_salary_multi_company" model="ir.rule"> |
|||
<field name="name">Advance Request Multi Company</field> |
|||
<field name="model_id" ref="model_salary_advance"/> |
|||
<field eval="True" name="global"/> |
|||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field> |
|||
</record> |
|||
|
|||
<record id="hr_salary_advance_manager_rule" model="ir.rule"> |
|||
<field name="name">Salary Advance</field> |
|||
<field name="model_id" ref="model_salary_advance"/> |
|||
<field name="groups" eval="[(4, ref('hr.group_hr_user')),(4, ref('account.group_account_user'))]"/> |
|||
<field name="perm_write" eval="True"/> |
|||
<field name="perm_read" eval="True"/> |
|||
<field name="perm_create" eval="True"/> |
|||
<field name="perm_unlink" eval="True"/> |
|||
</record> |
|||
|
|||
<record id="hr_salary_advance_employee_rule" model="ir.rule"> |
|||
<field name="name">Salary Advance Rule For Employee</field> |
|||
<field name="domain_force">[('employee_id.user_id','=',user.id)]</field> |
|||
<field name="global" eval="True"/> |
|||
<field name="model_id" ref="model_salary_advance"/> |
|||
<field name="groups" eval="[(4,ref('base.group_user'))]"/> |
|||
<field name="perm_write" eval="True"/> |
|||
<field name="perm_read" eval="True"/> |
|||
<field name="perm_create" eval="True"/> |
|||
<field name="perm_unlink" eval="True"/> |
|||
</record> |
|||
|
|||
</data> |
|||
</odoo> |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 96 KiB |
After Width: | Height: | Size: 115 KiB |
After Width: | Height: | Size: 221 KiB |
After Width: | Height: | Size: 32 KiB |
@ -0,0 +1,133 @@ |
|||
<section class="oe_container "> |
|||
<div class="oe_row"> |
|||
<h2 class="oe_slogan">OpenHRMS</h2> |
|||
<h3 class="oe_slogan">Most advanced open source HR management software</h3> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced oe_mt32"> |
|||
<div class="oe_span"> |
|||
<div class="oe_demo oe_picture oe_screenshot"> |
|||
<a href="https://www.openhrms.com/#request-demo"> |
|||
<img src="HRMS-BUTTON.png"> |
|||
</a> |
|||
<div class="oe_demo_footer oe_centeralign">Online Demo</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</section> |
|||
<section class="oe_container oe_dark"> |
|||
<div class="oe_row oe_spaced"> |
|||
<h2 class="oe_slogan">HR Salary Advance</h2> |
|||
<h3 class="oe_slogan">Manage salary advance request of employees</h3> |
|||
<h4 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a></h4> |
|||
</div> |
|||
<div class="oe_row oe_spaced" style="padding-left:65px;"> |
|||
<h4>Features:</h4> |
|||
<div> |
|||
<span style="color:green;"> ☑ </span>Employee can request for advance salary.<br/> |
|||
<span style="color:green;"> ☑ </span>Set advance salary percentage limit in salary structure.<br/> |
|||
<span style="color:green;"> ☑ </span>Set salary advance days in salary structure.<br/> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="" style="text-align: center;"> |
|||
<div class="oe_picture"> |
|||
<h3 class="oe_slogan">Overview</h3> |
|||
<p class="oe_mt32"> |
|||
HR Salary Advance is a component of Open HRMS suit. HR Salary Advance |
|||
module helps the user to manage salary advance requests from employees. You can configure advance salary rules, |
|||
set advance salary limit, minimum number of days, and provide advance salary to employees |
|||
</p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container oe_dark"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="" style="text-align: center;"> |
|||
<h3 class="oe_slogan">Configuration</h3> |
|||
<p>Add salary advance Rules in Salary Structure and provide the max.advance percentage and advance days</p> |
|||
<div class="oe_span12"> |
|||
<div class="oe_demo oe_picture oe_screenshot"> |
|||
<img style="border:10px solid white;" src="salary_advance_rule.png"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="" style="text-align: center;"> |
|||
<h3 class="oe_slogan">Advance Request</h3> |
|||
<p>Employee can create Advance request</p> |
|||
<div class="oe_span12"> |
|||
<div class="oe_demo oe_picture oe_screenshot"> |
|||
<img style="border:10px solid white;" src="salary_request.png"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container oe_dark"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="" style="text-align: center;"> |
|||
<h3 class="oe_slogan">Salary Advance request approval From Hr & Accounts Department</h3> |
|||
<div class="oe_span12"> |
|||
<div class="oe_demo oe_picture oe_screenshot"> |
|||
<img style="border:10px solid white;" src="advance_request_approval.png"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="" style="text-align: center;"> |
|||
<h3 class="oe_slogan">Employee Payslip</h3> |
|||
<p>When we create payslip salary advance will be deducted from the salary</p> |
|||
<div class="oe_span12"> |
|||
<div class="oe_demo oe_picture oe_screenshot"> |
|||
<img style="border:10px solid white;" src="salary_advance_deduction.png"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
|
|||
<div class="row section-content"> |
|||
<div class="col-md-6 img-content"> |
|||
<h3>Our Odoo Services</h3> |
|||
</div> <div class="bc-span col-md-12"><div class="inner-span"><a target="_blank" href="https://www.openhrms.com"><img class="img-border img-responsive thumbnail" src="cybro-service.png"></a></div></div> |
|||
</div> |
|||
</div> |
|||
|
|||
<section class="oe_container oe_dark"> |
|||
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2> |
|||
<div class="oe_slogan" style="margin-top:10px !important;"> |
|||
<div> |
|||
<a class="btn btn-primary btn-lg mt8" |
|||
style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com"><i |
|||
class="fa fa-envelope"></i> Email </a> <a |
|||
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" |
|||
href="https://www.cybrosys.com/contact/"><i |
|||
class="fa fa-phone"></i> Contact Us </a> <a |
|||
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" |
|||
href="https://www.cybrosys.com/odoo-customization-and-installation/"><i |
|||
class="fa fa-check-square"></i> Request Customization </a> |
|||
</div> |
|||
<br> |
|||
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block"> |
|||
</div> |
|||
</section> |
|||
|
After Width: | Height: | Size: 121 KiB |
After Width: | Height: | Size: 93 KiB |
After Width: | Height: | Size: 87 KiB |
@ -0,0 +1,146 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<odoo> |
|||
<data> |
|||
|
|||
<record id="view_salary_advance_form" model="ir.ui.view"> |
|||
<field name="name">salary.advance.form</field> |
|||
<field name="model">salary.advance</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Salary Advance"> |
|||
<header> |
|||
<button name="submit_to_manager" string="Submit" type="object" states="draft" class="oe_highlight"/> |
|||
<button name="approve_request" string="Approve" type="object" states="submit" class="oe_highlight" groups="hr.group_hr_manager,hr.group_hr_user"/> |
|||
<button name="approve_request_acc_dept" string="Approve" type="object" states="waiting_approval" class="oe_highlight" groups="account.group_account_manager,account.group_account_user"/> |
|||
<button name="cancel" string="Cancel" type="object" states="draft,submit"/> |
|||
<button name="reject" string="Reject" type="object" states="waiting_approval"/> |
|||
<field name="state" widget="statusbar" statusbar_visible="draft,submit,waiting_approval,approve,cancel,reject"/> |
|||
</header> |
|||
<sheet> |
|||
<div class="oe_title oe_left"> |
|||
<h2> |
|||
<field name="name" class="oe_inline" readonly="1"/> |
|||
</h2> |
|||
</div> |
|||
<group> |
|||
<group> |
|||
<field name="employee_id" on_change="onchange_employee_id(employee_id)"/> |
|||
<field name="department"/> |
|||
<field name="date"/> |
|||
<field name="reason"/> |
|||
<field name="exceed_condition" groups="hr.group_hr_manager,hr.group_hr_user"/> |
|||
</group> |
|||
<group> |
|||
<field name="advance"/> |
|||
<field name="currency_id" groups="base.group_multi_currency"/> |
|||
<field name="company_id" groups="base.group_multi_currency"/> |
|||
<field name="credit" attrs="{'invisible':[('state', '=', 'draft'), ('state', '=', 'submit')]}" groups="account.group_account_manager"/> |
|||
<field name="debit" attrs="{'invisible':[('state', '=', 'draft'), ('state', '=', 'submit')]}" groups="account.group_account_manager"/> |
|||
<field name="journal" attrs="{'invisible': [('state', '=', 'draft'), ('state', '=', 'submit')]}" groups="account.group_account_manager"/> |
|||
<field name="employee_contract_id" attrs="{'invisible': ['|', ('state', '=', 'draft'), ('state', '=', 'approve')]}" groups="hr.group_hr_manager,hr.group_hr_user"/> |
|||
</group> |
|||
</group> |
|||
</sheet> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
<record model="ir.ui.view" id="view_salary_advance_tree"> |
|||
<field name="name">salary.advance.tree</field> |
|||
<field name="model">salary.advance</field> |
|||
<field name="arch" type="xml"> |
|||
<tree string="Salary Advance"> |
|||
<field name="employee_id"/> |
|||
<field name="date"/> |
|||
<field name="advance"/> |
|||
<field name="state"/> |
|||
</tree> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="view_salary_advance_filter" model="ir.ui.view"> |
|||
<field name="name">salary.advance.select</field> |
|||
<field name="model">salary.advance</field> |
|||
<field name="arch" type="xml"> |
|||
<search string="Search"> |
|||
<field name="name" string="Salary Advance" filter_domain="['|',('name','ilike',self)]"/> |
|||
<field name="employee_id"/> |
|||
<field name="state"/> |
|||
<filter string="My Requests" domain="[('employee_id.user_id.id','=',uid)]" name="my_requests_filter"/> |
|||
<filter domain="[('state', '=', 'draft')]" string="To Submit" name="to_report" help="New Requests"/> |
|||
<filter domain="[('state','in',('submit','waiting_approval'))]" string="To Approve" name="submitted" help="Submitted Requests"/> |
|||
<filter domain="[('state', '=', 'approve')]" string="Approved" name="approved" help="Approved Requests"/> |
|||
<separator/> |
|||
<group expand="0" string="Group By"> |
|||
<filter string="Employee" domain="[]" context="{'group_by':'employee_id'}"/> |
|||
<filter name="State" string="State" domain="[]" context="{'group_by':'state'}"/> |
|||
<filter string="Date" domain="[]" context="{'group_by':'date'}"/> |
|||
</group> |
|||
</search> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="action_my_salary_advance" model="ir.actions.act_window"> |
|||
<field name="name">Salary Advance</field> |
|||
<field name="type">ir.actions.act_window</field> |
|||
<field name="res_model">salary.advance</field> |
|||
<field name="view_type">form</field> |
|||
<field name="view_mode">tree,form</field> |
|||
<field name="search_view_id" ref="view_salary_advance_filter"/> |
|||
<field name="context">{'search_default_my_requests_filter':1}</field> |
|||
<field name="domain">[('employee_id.user_id', '=', uid)]</field> |
|||
<field name="help" type="html"> |
|||
<p class="oe_view_nocontent_create"> |
|||
Create Requests. |
|||
</p> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="action_my_salary_advance_request_approved" model="ir.actions.act_window"> |
|||
<field name="name">Salary Advance</field> |
|||
<field name="type">ir.actions.act_window</field> |
|||
<field name="res_model">salary.advance</field> |
|||
<field name="view_type">form</field> |
|||
<field name="view_mode">tree,form</field> |
|||
<field name="search_view_id" ref="view_salary_advance_filter"/> |
|||
<field name="context">{'search_default_approved':1}</field> |
|||
<field name="domain">[('employee_id.user_id', '=', uid)]</field> |
|||
<field name="help" type="html"> |
|||
<p class="oe_view_nocontent_create"> |
|||
Create Requests. |
|||
</p> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="action_salary_advance_to_approve" model="ir.actions.act_window"> |
|||
<field name="name">Salary Advance</field> |
|||
<field name="type">ir.actions.act_window</field> |
|||
<field name="res_model">salary.advance</field> |
|||
<field name="view_type">form</field> |
|||
<field name="view_mode">tree,form</field> |
|||
<field name="search_view_id" ref="view_salary_advance_filter"/> |
|||
<field name="context">{'search_default_submitted': 1}</field> |
|||
<field name="domain"></field> |
|||
<field name="help" type="html"> |
|||
<p class="oe_view_nocontent_create"> |
|||
Create Requests. |
|||
</p> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="ir_seq_hr_advance" model="ir.sequence"> |
|||
<field name="name">Salary Advance Request</field> |
|||
<field name="code">salary.advance.seq</field> |
|||
<field name="prefix">SAR </field> |
|||
<field name="padding">4</field> |
|||
<field name="number_increment">1</field> |
|||
<field name="number_next_actual">1</field> |
|||
<field name="implementation">standard</field> |
|||
<field name="company_id" eval="False"/> |
|||
</record> |
|||
|
|||
<menuitem id="parent_menu_salary_advance" name="Advance" parent="hr_loan.menu_hr_loans_and_advances" sequence="7"/> |
|||
<menuitem id="menu_my_salary_advance" action="action_my_salary_advance" parent="parent_menu_salary_advance" name="Request Salary Advance" sequence="1" /> |
|||
<menuitem id="menu_salary_advance" action="action_salary_advance_to_approve" parent="parent_menu_salary_advance" name="Salary Advance To Approve" sequence="3" groups="hr.group_hr_manager,hr.group_hr_user,account.group_account_manager"/> |
|||
<menuitem id="menu_my_salary_advance_approved" action="action_my_salary_advance_request_approved" parent="parent_menu_salary_advance" name="My Approved Salary Advance" sequence="2" /> |
|||
</data> |
|||
</odoo> |
@ -0,0 +1,33 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<odoo> |
|||
<data> |
|||
<!-- advance salary rule --> |
|||
<record id="hr_payslip_rule_advance" model="hr.salary.rule"> |
|||
<field name="code">SAR</field> |
|||
<field name="name">Advance Salary</field> |
|||
<field name="category_id" ref="hr_payroll.DED"/> |
|||
<field name="amount_select">code</field> |
|||
<field name="amount_python_compute">result = inputs.SAR and - (inputs.SAR.amount)</field> |
|||
<field name="appears_on_payslip" eval="True"/> |
|||
<field name="sequence" eval="190"/> |
|||
</record> |
|||
|
|||
<record id="hr_rule_input_advance" model="hr.rule.input"> |
|||
<field name="code">SAR</field> |
|||
<field name="name">Salary Advance</field> |
|||
<field name="input_id" ref="hr_payslip_rule_advance"/> |
|||
</record> |
|||
<!-- salary structure --> |
|||
<record model="ir.ui.view" id="model_salary_structure"> |
|||
<field name="name">salary.structure.form</field> |
|||
<field name="model">hr.payroll.structure</field> |
|||
<field name="inherit_id" ref="hr_payroll.view_hr_employee_grade_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='parent_id']" position="after"> |
|||
<field name="max_percent"/> |
|||
<field name="advance_date"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</data> |
|||
</odoo> |