Browse Source

[ADD] Initial Commit

pull/72/head
Sreejith P 7 years ago
parent
commit
bfd4236d5d
  1. 35
      ohrms_loan/README.md
  2. 3
      ohrms_loan/__init__.py
  3. 52
      ohrms_loan/__manifest__.py
  4. 23
      ohrms_loan/data/salary_rule_loan.xml
  5. 6
      ohrms_loan/doc/RELEASE_NOTES.md
  6. 4
      ohrms_loan/models/__init__.py
  7. 129
      ohrms_loan/models/hr_loan.py
  8. 80
      ohrms_loan/models/hr_payroll.py
  9. 17
      ohrms_loan/security/ir.model.access.csv
  10. 35
      ohrms_loan/security/security.xml
  11. BIN
      ohrms_loan/static/description/HRMS-BUTTON.png
  12. BIN
      ohrms_loan/static/description/accounting_validation.png
  13. BIN
      ohrms_loan/static/description/banner.jpg
  14. BIN
      ohrms_loan/static/description/cybro-service.png
  15. BIN
      ohrms_loan/static/description/cybro_logo.png
  16. BIN
      ohrms_loan/static/description/icon.png
  17. 169
      ohrms_loan/static/description/index.html
  18. BIN
      ohrms_loan/static/description/loan_amount_deduction.png
  19. BIN
      ohrms_loan/static/description/loan_approval.png
  20. BIN
      ohrms_loan/static/description/loan_request.png
  21. BIN
      ohrms_loan/static/description/loan_rule.png
  22. BIN
      ohrms_loan/static/description/payslip.png
  23. 162
      ohrms_loan/views/hr_loan.xml
  24. 14
      ohrms_loan/views/hr_loan_seq.xml
  25. 13
      ohrms_loan/views/hr_payroll.xml

35
ohrms_loan/README.md

@ -0,0 +1,35 @@
Open HRMS Loan Management
=========================
Manage Loan Requests.
Installation
============
- www.odoo.com/documentation/11.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>
Maintainer
----------
This module is maintained by Cybrosys Technologies.
For support and more information, please visit https://www.cybrosys.com.

3
ohrms_loan/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import models

52
ohrms_loan/__manifest__.py

@ -0,0 +1,52 @@
# -*- 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': 'Open HRMS Loan Management',
'version': '11.0.1.0.0',
'summary': 'Manage Loan Requests',
'description': """
Helps you to manage Loan Requests 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': [
'base', 'hr_payroll', 'hr', 'account',
],
'data': [
'security/ir.model.access.csv',
'security/security.xml',
'views/hr_loan_seq.xml',
'data/salary_rule_loan.xml',
'views/hr_loan.xml',
'views/hr_payroll.xml',
],
'demo': [],
'images': ['static/description/banner.jpg'],
'license': 'AGPL-3',
'installable': True,
'auto_install': False,
'application': False,
}

23
ohrms_loan/data/salary_rule_loan.xml

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!--Adding a salary rule for loan-->
<data noupdate="0">
<record id="hr_rule_loan" model="hr.salary.rule">
<field name="code">LO</field>
<field name="name">Loan</field>
<field name="category_id" ref="hr_payroll.DED"/>
<field name="amount_select">code</field>
<field name="amount_python_compute">result = inputs.LO and - (inputs.LO.amount)</field>
<field name="appears_on_payslip" eval="True"/>
<field name="sequence" eval="190"/>
</record>
<record id="hr_rule_input_loan" model="hr.rule.input">
<field name="code">LO</field>
<field name="name">Loan</field>
<field name="input_id" ref="hr_rule_loan"/>
</record>
</data>
</odoo>

6
ohrms_loan/doc/RELEASE_NOTES.md

@ -0,0 +1,6 @@
## Module <ohrms_loan>
#### 21.04.2018
#### Version 11.0.1.0.0
##### ADD
- Initial commit for Open HRMS Project

4
ohrms_loan/models/__init__.py

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
from . import hr_loan
from . import hr_payroll

129
ohrms_loan/models/hr_loan.py

@ -0,0 +1,129 @@
# -*- coding: utf-8 -*-
from odoo import models, fields, api
from datetime import datetime
from dateutil.relativedelta import relativedelta
from odoo.exceptions import except_orm
class HrLoan(models.Model):
_name = 'hr.loan'
_inherit = ['mail.thread', 'mail.activity.mixin']
_description = "Loan Request"
@api.one
def _compute_loan_amount(self):
total_paid = 0.0
for loan in self:
for line in loan.loan_lines:
if line.paid:
total_paid += line.amount
balance_amount = loan.loan_amount - total_paid
self.total_amount = loan.loan_amount
self.balance_amount = balance_amount
self.total_paid_amount = total_paid
name = fields.Char(string="Loan Name", default="/", readonly=True)
date = fields.Date(string="Date", default=fields.Date.today(), readonly=True)
employee_id = fields.Many2one('hr.employee', string="Employee", required=True)
department_id = fields.Many2one('hr.department', related="employee_id.department_id", readonly=True,
string="Department")
installment = fields.Integer(string="No Of Installments", default=1)
payment_date = fields.Date(string="Payment Start Date", required=True, default=fields.Date.today())
loan_lines = fields.One2many('hr.loan.line', 'loan_id', string="Loan Line", index=True)
emp_account_id = fields.Many2one('account.account', string="Loan Account")
treasury_account_id = fields.Many2one('account.account', string="Treasury Account")
journal_id = fields.Many2one('account.journal', string="Journal")
company_id = fields.Many2one('res.company', 'Company', readonly=True,
default=lambda self: self.env.user.company_id,
states={'draft': [('readonly', False)]})
currency_id = fields.Many2one('res.currency', string='Currency', required=True,
default=lambda self: self.env.user.company_id.currency_id)
job_position = fields.Many2one('hr.job', related="employee_id.job_id", readonly=True, string="Job Position")
loan_amount = fields.Float(string="Loan Amount", required=True)
total_amount = fields.Float(string="Total Amount", readonly=True, compute='_compute_loan_amount')
balance_amount = fields.Float(string="Balance Amount", compute='_compute_loan_amount')
total_paid_amount = fields.Float(string="Total Paid Amount", compute='_compute_loan_amount')
state = fields.Selection([
('draft', 'Draft'),
('waiting_approval_1', 'Submitted'),
('waiting_approval_2', 'Waiting Approval'),
('approve', 'Approved'),
('refuse', 'Refused'),
('cancel', 'Canceled'),
], string="State", default='draft', track_visibility='onchange', copy=False, )
@api.model
def create(self, values):
loan_count = self.env['hr.loan'].search_count([('employee_id', '=', values['employee_id']), ('state', '=', 'approve'),
('balance_amount', '!=', 0)])
if loan_count:
raise except_orm('Error!', 'The employee has already a pending installment')
else:
values['name'] = self.env['ir.sequence'].get('hr.loan.seq') or ' '
res = super(HrLoan, self).create(values)
return res
@api.multi
def action_refuse(self):
return self.write({'state': 'refuse'})
@api.multi
def action_submit(self):
self.write({'state': 'waiting_approval_1'})
@api.multi
def action_cancel(self):
self.write({'state': 'cancel'})
@api.multi
def action_approve(self):
for data in self:
if not data.loan_lines:
raise except_orm('Error!', 'Please Compute installment')
else:
self.write({'state': 'approve'})
@api.multi
def compute_installment(self):
"""This automatically create the installment the employee need to pay to
company based on payment start date and the no of installments.
"""
for loan in self:
date_start = datetime.strptime(loan.payment_date, '%Y-%m-%d')
amount = loan.loan_amount / loan.installment
for i in range(1, loan.installment + 1):
self.env['hr.loan.line'].create({
'date': date_start,
'amount': amount,
'employee_id': loan.employee_id.id,
'loan_id': loan.id})
date_start = date_start + relativedelta(months=1)
return True
class InstallmentLine(models.Model):
_name = "hr.loan.line"
_description = "Installment Line"
date = fields.Date(string="Payment Date", required=True)
employee_id = fields.Many2one('hr.employee', string="Employee")
amount = fields.Float(string="Amount", required=True)
paid = fields.Boolean(string="Paid")
loan_id = fields.Many2one('hr.loan', string="Loan Ref.")
payslip_id = fields.Many2one('hr.payslip', string="Payslip Ref.")
class HrEmployee(models.Model):
_inherit = "hr.employee"
@api.one
def _compute_employee_loans(self):
"""This compute the loan amount and total loans count of an employee.
"""
self.loan_count = self.env['hr.loan'].search_count([('employee_id', '=', self.id)])
loan_count = fields.Integer(string="Loan Count", compute='_compute_employee_loans')

80
ohrms_loan/models/hr_payroll.py

@ -0,0 +1,80 @@
# -*- coding: utf-8 -*-
import time
import babel
from odoo import models, fields, api, tools, _
from datetime import datetime
class HrPayslipInput(models.Model):
_inherit = 'hr.payslip.input'
loan_line_id = fields.Many2one('hr.loan.line', string="Loan Installment")
class HrPayslip(models.Model):
_inherit = 'hr.payslip'
@api.onchange('employee_id', 'date_from', 'date_to')
def onchange_employee(self):
if (not self.employee_id) or (not self.date_from) or (not self.date_to):
return
employee = self.employee_id
date_from = self.date_from
date_to = self.date_to
contract_ids = []
ttyme = datetime.fromtimestamp(time.mktime(time.strptime(date_from, "%Y-%m-%d")))
locale = self.env.context.get('lang') or 'en_US'
self.name = _('Salary Slip of %s for %s') % (
employee.name, tools.ustr(babel.dates.format_date(date=ttyme, format='MMMM-y', locale=locale)))
self.company_id = employee.company_id
if not self.env.context.get('contract') or not self.contract_id:
contract_ids = self.get_contract(employee, date_from, date_to)
if not contract_ids:
return
self.contract_id = self.env['hr.contract'].browse(contract_ids[0])
if not self.contract_id.struct_id:
return
self.struct_id = self.contract_id.struct_id
# computation of the salary input
contracts = self.env['hr.contract'].browse(contract_ids)
worked_days_line_ids = self.get_worked_day_lines(contracts, date_from, date_to)
worked_days_lines = self.worked_days_line_ids.browse([])
for r in worked_days_line_ids:
worked_days_lines += worked_days_lines.new(r)
self.worked_days_line_ids = worked_days_lines
if contracts:
input_line_ids = self.get_inputs(contracts, date_from, date_to)
input_lines = self.input_line_ids.browse([])
print input_line_ids, "input_line_ids"
for r in input_line_ids:
input_lines += input_lines.new(r)
self.input_line_ids = input_lines
return
def get_inputs(self, contract_ids, date_from, date_to):
"""This Compute the other inputs to employee payslip.
"""
res = super(HrPayslip, self).get_inputs(contract_ids, date_from, date_to)
contract_obj = self.env['hr.contract']
emp_id = contract_obj.browse(contract_ids[0].id).employee_id
lon_obj = self.env['hr.loan'].search([('employee_id', '=', emp_id.id), ('state', '=', 'approve')])
for loan in lon_obj:
for loan_line in loan.loan_lines:
if date_from <= loan_line.date <= date_to and not loan_line.paid:
for result in res:
if result.get('code') == 'LO':
result['amount'] = loan_line.amount
result['loan_line_id'] = loan_line.id
return res
@api.multi
def action_payslip_done(self):
for line in self.input_line_ids:
if line.loan_line_id:
line.loan_line_id.paid = True
return super(HrPayslip, self).action_payslip_done()

17
ohrms_loan/security/ir.model.access.csv

@ -0,0 +1,17 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_hr_loan_user,hr.loan.group_user,model_hr_loan,base.group_user,1,1,1,0
access_hr_loan_line_user,hr.loan.line.group_user,model_hr_loan_line,base.group_user,1,1,0,0
access_hr_loan_officer,hr.loan.group_hr_user,model_hr_loan,hr.group_hr_user,1,1,1,1
access_hr_loan_line_officer,hr.loan.line.group_hr_user,model_hr_loan_line,hr.group_hr_user,1,1,1,1
access_account_move_uinvoice_officer,account.move.group_hr_user,account.model_account_move,hr.group_hr_user,1,1,1,1
access_account_journal_uinvoice_officer,account.journal.group_hr_user,account.model_account_journal,hr.group_hr_user,1,1,1,1
acces_account_move_line_officer,account.move.line.group_hr_user,account.model_account_move_line,hr.group_hr_user,1,1,1,1
acces_ account_account_type_officer, account.account.type.group_hr_user,account.model_account_account_type,hr.group_hr_user,1,1,1,1
access_hr_loan_manager,hr.loan,model_hr_loan,hr.group_hr_manager,1,1,1,1
access_hr_loan_line_manager,hr.loan.line,model_hr_loan_line,hr.group_hr_manager,1,1,1,1
access_account_move_uinvoice_manager,account.move,account.model_account_move,hr.group_hr_manager,1,1,1,1
access_account_journal_uinvoice_manager,account.journal,account.model_account_journal,hr.group_hr_manager,1,1,1,1
acces_account_move_line_manager,account.move.line,account.model_account_move_line,hr.group_hr_manager,1,1,1,1
acces_ account_account_type_manager, account.account.type,account.model_account_account_type,hr.group_hr_manager,1,1,1,1
access_hr_loan_accountant,hr.loan,model_hr_loan,account.group_account_user,1,1,1,0
access_hr_loan_line_accountant,hr.loan.line,model_hr_loan_line,account.group_account_user,1,1,1,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_hr_loan_user hr.loan.group_user model_hr_loan base.group_user 1 1 1 0
3 access_hr_loan_line_user hr.loan.line.group_user model_hr_loan_line base.group_user 1 1 0 0
4 access_hr_loan_officer hr.loan.group_hr_user model_hr_loan hr.group_hr_user 1 1 1 1
5 access_hr_loan_line_officer hr.loan.line.group_hr_user model_hr_loan_line hr.group_hr_user 1 1 1 1
6 access_account_move_uinvoice_officer account.move.group_hr_user account.model_account_move hr.group_hr_user 1 1 1 1
7 access_account_journal_uinvoice_officer account.journal.group_hr_user account.model_account_journal hr.group_hr_user 1 1 1 1
8 acces_account_move_line_officer account.move.line.group_hr_user account.model_account_move_line hr.group_hr_user 1 1 1 1
9 acces_ account_account_type_officer account.account.type.group_hr_user account.model_account_account_type hr.group_hr_user 1 1 1 1
10 access_hr_loan_manager hr.loan model_hr_loan hr.group_hr_manager 1 1 1 1
11 access_hr_loan_line_manager hr.loan.line model_hr_loan_line hr.group_hr_manager 1 1 1 1
12 access_account_move_uinvoice_manager account.move account.model_account_move hr.group_hr_manager 1 1 1 1
13 access_account_journal_uinvoice_manager account.journal account.model_account_journal hr.group_hr_manager 1 1 1 1
14 acces_account_move_line_manager account.move.line account.model_account_move_line hr.group_hr_manager 1 1 1 1
15 acces_ account_account_type_manager account.account.type account.model_account_account_type hr.group_hr_manager 1 1 1 1
16 access_hr_loan_accountant hr.loan model_hr_loan account.group_account_user 1 1 1 0
17 access_hr_loan_line_accountant hr.loan.line model_hr_loan_line account.group_account_user 1 1 1 0

35
ohrms_loan/security/security.xml

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="rule_hr_loan" model="ir.rule">
<field name="name">Loan Request Multi Company</field>
<field name="model_id" ref="model_hr_loan"/>
<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_loan_manager_rule" model="ir.rule">
<field name="name">Loan Forms 4</field>
<field name="model_id" ref="model_hr_loan"/>
<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_loan_rule" model="ir.rule">
<field name="name">Loan Forms</field>
<field name="domain_force">[('employee_id.user_id','=',user.id)]</field>
<field name="global" eval="True"/>
<field name="model_id" ref="model_hr_loan"/>
<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>

BIN
ohrms_loan/static/description/HRMS-BUTTON.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
ohrms_loan/static/description/accounting_validation.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

BIN
ohrms_loan/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

BIN
ohrms_loan/static/description/cybro-service.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 KiB

BIN
ohrms_loan/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
ohrms_loan/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

169
ohrms_loan/static/description/index.html

@ -0,0 +1,169 @@
<section class="oe_container bg-gray-lighter" xmlns="http://www.w3.org/1999/html">
<div class="oe_row">
<div class="oe_span">
<h2 class="oe_slogan"><a href="https://www.openhrms.com">Open HRMS</a></h2>
<h3 class="oe_slogan">Most advanced open source HR management software</h3>
</div>
</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>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan">Open HRMS Loan</h2>
<h3 class="oe_slogan">Manage Loan 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;"> &#9745; </span>Employee can create loan request.<br/>
<span style="color:green;"> &#9745; </span>Double layer approval, from Accounting & HR Department.<br/>
<span style="color:green;"> &#9745; </span>Current month installment is automatically listed in payslip.<br/>
<span style="color:green;"> &#9745; </span>Loan amount is deducted from the salary.<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">
Open HRMS Loan is a component of Open HRMS suit.
Open HRMS Loan module helps the user to configure different loan policies, assign approval authority, conduct the verification process and sanction loan for 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>
</div>
<div class="" style="text-align: center;">
<p>Install the Module "Open HRMS Loan Accounting" in order to enable Accounting Entries.
Enable the option "Loan Approval From Accounting Department" In accounting settings</p>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="accounting_validation.png">
</div>
</div>
</div>
<div class="" style="text-align: center;">
<p>Add the deduction rule for loan in Salary Structure</p>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="loan_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">Loan Request</h3>
<p>Employee can create loan request</p>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="loan_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">Loan Approval</h3>
<p>Once the HR department has given the Approval, the accounts department take the decision</p>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="loan_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 the payslip, all the pending installments of the month will be listed there.
</p>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="payslip.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">Loan Amount Deduction</h3>
<p>When we check the Loan request again,
the deducted installments will be changed to paid.</p>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="loan_amount_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">
<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/contact/" target="_blank"><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.odoo.com/apps/modules/browse?search=open+hrms" target="_blank"><i
class="fa fa-suitcase"></i> Other Open HRMS Addons </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/" target="_blank"><i
class="fa fa-wrench"></i> Request Customization </a>
</div>
<br>
<a href="https://www.cybrosys.com/" target="_blank">
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
</a>
</div>
</section>

BIN
ohrms_loan/static/description/loan_amount_deduction.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

BIN
ohrms_loan/static/description/loan_approval.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

BIN
ohrms_loan/static/description/loan_request.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
ohrms_loan/static/description/loan_rule.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

BIN
ohrms_loan/static/description/payslip.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

162
ohrms_loan/views/hr_loan.xml

@ -0,0 +1,162 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!--Loan Tree view-->
<record id="hr_loan_tree_view" model="ir.ui.view">
<field name="name">hr.loan.tree</field>
<field name="model">hr.loan</field>
<field name="arch" type="xml">
<tree string="Loan Requests">
<field name="name"/>
<field name="employee_id"/>
<field name="loan_amount"/>
<field name="date"/>
<field name="state"/>
</tree>
</field>
</record>
<!--Loan Form view-->
<record id="hr_loan_form_view" model="ir.ui.view">
<field name="name">hr.loan.form</field>
<field name="model">hr.loan</field>
<field name="arch" type="xml">
<form string="Loan Request">
<header>
<button name="action_submit" type="object" string="Submit" states="draft" class="oe_highlight"/>
<button name="action_cancel" type="object" string="Cancel" states="waiting_approval_1" />
<button name="action_approve" type="object" string="Approve" states="waiting_approval_1" class="oe_highlight" groups="hr.group_hr_manager,hr.group_hr_user"/>
<button name="action_double_approve" type="object" string="Approve" states="waiting_approval_2" class="oe_highlight" groups="account.group_account_user,account.group_account_manager"/>
<button name="action_refuse" type="object" string="Refuse" states="draft,waiting_approval_1,waiting_approval_2" class="oe_highlight" groups="hr.group_hr_manager,hr.group_hr_user"/>
<field name="state" widget="statusbar" statusbar_visible="draft,waiting_approval_1,waiting_approval_2,approve,cancel" />
</header>
<sheet>
<div class="oe_button_box" name="button_box">
</div>
<div class="oe_title">
<h1>
<field name="name" readonly="1"/>
</h1>
</div>
<group col="4">
<field name="employee_id" attrs="{'readonly':[('state','=','approve')]}"/>
<field name="date"/>
<field name="department_id"/>
<field name="job_position"/>
<field name="loan_amount" attrs="{'readonly':[('state','=','approve')]}"/>
<field name="installment" attrs="{'readonly':[('state','=','approve')]}"/>
<field name="payment_date" attrs="{'readonly':[('state','=','approve')]}"/>
<field name="emp_account_id" attrs="{'invisible':[('state', '=','draft')]}"/>
<field name="treasury_account_id" attrs="{'invisible':[('state', '=','draft')]}"/>
<field name="journal_id" attrs="{'invisible':[('state', '=','draft')]}"/>
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
<field name="currency_id" options="{'no_create': True}" groups="base.group_multi_company"/>
</group>
<notebook>
<page string="Installments">
<field name="loan_lines">
<tree string="Installments" editable="bottom">
<field name="date"/>
<field name="amount"/>
<field name="paid" readonly="1" invisible="1"/>
</tree>
</field>
<group class="oe_subtotal_footer oe_right" colspan="2" >
<field name="total_amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="total_paid_amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="balance_amount" class="oe_subtotal_footer_separator" widget="monetary" options="{'currency_field': 'currency_id'}"/>
</group>
<button type="object" name="compute_installment" string="Compute Installment" colspan="2" attrs="{'invisible':[('state','=','approve')]}"
groups="hr.group_hr_manager,hr.group_hr_user" class="oe_stat_button"
icon="fa-clock-o"/>
<div class="oe_clear"/>
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>
<!--loan search view-->
<record id="view_loan_request_search_form" model="ir.ui.view">
<field name="name">hr.loan.search.form</field>
<field name="model">hr.loan</field>
<field name="arch" type="xml">
<search string="Tasks">
<field name="employee_id"/>
<field name="department_id"/>
<group expand="0" string="Group By">
<filter string="Employee" name="employee_id" context="{'group_by':'employee_id'}"/>
<filter string="Department" context="{'group_by':'department_id'}"/>
</group>
</search>
</field>
</record>
<!--loan menu-->
<menuitem name="Loans And Salary Advance"
id="menu_hr_loans_and_advances" parent="hr.menu_hr_root"
sequence="20"/>
<record id="action_hr_loan_request" model="ir.actions.act_window">
<field name="name">Loan Requests</field>
<field name="res_model">hr.loan</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_loan_request_search_form"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a new Loan request.
</p><p>
Use this menu to create loan requests.
</p>
</field>
</record>
<menuitem name="Loan Requests"
id="menu_base_hr_loan_request"
parent = "menu_hr_loans_and_advances"
sequence="1"/>
<menuitem name="Loan Requests"
parent="menu_base_hr_loan_request"
id="menu_hr_loan_request"
action="action_hr_loan_request"/>
<!-- Shortcuts -->
<record id="act_hr_employee_loan_request" model="ir.actions.act_window">
<field name="name">Loans</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr.loan</field>
<field name="src_model">hr.employee</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="context">{'search_default_employee_id': [active_id], 'default_employee_id': active_id}</field>
<field name="domain">[('employee_id','=',active_id)]</field>
<field name="view_id" eval="hr_loan_tree_view"/>
</record>
<!-- HR employee inherit Loans -->
<record id="view_employee_form_loan_inherit" model="ir.ui.view">
<field name="name">hr.employee.loan.form.inherit</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='button_box']" position="inside">
<button name="%(act_hr_employee_loan_request)d"
type="action"
class="oe_stat_button"
icon="fa-calendar"
groups="hr.group_hr_manager,hr.group_hr_user">
<field name="loan_count" widget="statinfo" string="Loans"/>
</button>
</xpath>
</field>
</record>
</odoo>

14
ohrms_loan/views/hr_loan_seq.xml

@ -0,0 +1,14 @@
<?xml version="1.0" ?>
<odoo>
<data noupdate='1'>
<record id="ir_seq_hr_loan" model="ir.sequence">
<field name="name">Loan Request</field>
<field name="code">hr.loan.seq</field>
<field name="prefix">LO/</field>
<field name="padding">4</field>
<field name="number_increment">1</field>
<field name="number_next_actual">1</field>
<field name="implementation">standard</field>
</record>
</data>
</odoo>

13
ohrms_loan/views/hr_payroll.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="hr_payslip_form_inherit_view" model="ir.ui.view">
<field name="name">hr.payslip.inherit.form1</field>
<field name="model">hr.payslip</field>
<field name="inherit_id" ref="hr_payroll.view_hr_payslip_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='input_line_ids']//tree//field[@name='sequence']" position="after">
<field name="loan_line_id" invisible="1"/>
</xpath>
</field>
</record>
</odoo>
Loading…
Cancel
Save