@ -0,0 +1,36 @@ |
|||||
|
OHRMS Loan Management |
||||
|
===================== |
||||
|
|
||||
|
Manage Loan Requests. |
||||
|
|
||||
|
|
||||
|
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> |
||||
|
|
||||
|
Maintainer |
||||
|
---------- |
||||
|
|
||||
|
This module is maintained by Cybrosys Technologies. |
||||
|
|
||||
|
For support and more information, please visit https://www.cybrosys.com. |
||||
|
|
@ -0,0 +1,6 @@ |
|||||
|
## Module ohrms_loan_accounting |
||||
|
|
||||
|
#### 30.03.2018 |
||||
|
#### Version 10.0.1.0.0 |
||||
|
##### ADD |
||||
|
- Initial commit for OpenHrms Project |
@ -0,0 +1,2 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
import models |
@ -0,0 +1,49 @@ |
|||||
|
# -*- 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 Loan Accounting', |
||||
|
'version': '10.0.1.0.0', |
||||
|
'summary': 'HR Loan Accounting', |
||||
|
'description': """ |
||||
|
Create accounting entries for loan requests. |
||||
|
""", |
||||
|
'category': 'Generic Modules/Human Resources', |
||||
|
'author': "Cybrosys Techno Solutions", |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'website': "https://www.openhrms.com", |
||||
|
'depends': [ |
||||
|
'hr_payroll', 'hr', 'account', 'ohrms_loan', |
||||
|
], |
||||
|
'data': [ |
||||
|
'views/hr_loan_config.xml', |
||||
|
'views/hr_loan_acc.xml', |
||||
|
|
||||
|
], |
||||
|
'demo': [], |
||||
|
'images': ['static/description/banner.jpg'], |
||||
|
'license': 'AGPL-3', |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': False, |
||||
|
} |
@ -0,0 +1,4 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
import hr_loan_config |
||||
|
import hr_loan_acc |
||||
|
|
@ -0,0 +1,177 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
import time |
||||
|
from odoo import models, fields, api |
||||
|
from odoo.exceptions import except_orm |
||||
|
|
||||
|
|
||||
|
class HrLoanAcc(models.Model): |
||||
|
_inherit = 'hr.loan' |
||||
|
|
||||
|
@api.multi |
||||
|
def action_approve(self): |
||||
|
"""This create account move for request. |
||||
|
""" |
||||
|
loan_approve = self.env['ir.values'].get_default('account.config.settings', 'loan_approve') |
||||
|
contract_obj = self.env['hr.contract'].search([('employee_id', '=', self.employee_id.id)]) |
||||
|
if not contract_obj: |
||||
|
raise except_orm('Warning', 'You must Define a contract for employee') |
||||
|
if not self.loan_line_ids: |
||||
|
raise except_orm('Warning', 'You must compute Loan Request before Approved') |
||||
|
if loan_approve: |
||||
|
self.write({'state': 'waiting_approval_2'}) |
||||
|
else: |
||||
|
raise except_orm('Warning', 'Enable the option for loan approval from accounting department') |
||||
|
|
||||
|
@api.multi |
||||
|
def action_double_approve(self): |
||||
|
"""This create account move for request in case of double approval. |
||||
|
""" |
||||
|
if not self.emp_account_id or not self.treasury_account_id or not self.journal_id: |
||||
|
raise except_orm('Warning', "You must enter employee account & Treasury account and journal to approve ") |
||||
|
if not self.loan_line_ids: |
||||
|
raise except_orm('Warning', 'You must compute Loan Request before Approved') |
||||
|
move_obj = self.env['account.move'] |
||||
|
timenow = time.strftime('%Y-%m-%d') |
||||
|
line_ids = [] |
||||
|
debit_sum = 0.0 |
||||
|
credit_sum = 0.0 |
||||
|
for loan in self: |
||||
|
amount = loan.loan_amount |
||||
|
loan_name = loan.employee_id.name |
||||
|
reference = loan.name |
||||
|
journal_id = loan.journal_id.id |
||||
|
move = { |
||||
|
'name': 'Loan For' + ' ' + loan_name, |
||||
|
'narration': loan_name, |
||||
|
'ref': reference, |
||||
|
'journal_id': journal_id, |
||||
|
'date': timenow, |
||||
|
'state': 'posted', |
||||
|
} |
||||
|
|
||||
|
debit_account_id = loan.treasury_account_id.id |
||||
|
credit_account_id = loan.emp_account_id.id |
||||
|
if debit_account_id: |
||||
|
debit_line = (0, 0, { |
||||
|
'name': loan_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, |
||||
|
'loan_id': loan.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': loan_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, |
||||
|
'loan_id': loan.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.move_id = move_id.id |
||||
|
self.write({'state': 'approve'}) |
||||
|
return self.write({'move_id': move_id.id}) |
||||
|
|
||||
|
|
||||
|
class AccountMoveLine(models.Model): |
||||
|
_inherit = "account.move.line" |
||||
|
|
||||
|
loan_id = fields.Many2one('hr.loan', string="Loan") |
||||
|
|
||||
|
|
||||
|
class HrLoanLineAcc(models.Model): |
||||
|
_inherit = "hr.loan.line" |
||||
|
|
||||
|
@api.one |
||||
|
def action_paid_amount(self): |
||||
|
"""This create the account move line for payment of each installment. |
||||
|
""" |
||||
|
result = super(HrLoanLineAcc, self).action_paid_amount() |
||||
|
move_obj = self.env['account.move'] |
||||
|
timenow = time.strftime('%Y-%m-%d') |
||||
|
line_ids = [] |
||||
|
debit_sum = 0.0 |
||||
|
credit_sum = 0.0 |
||||
|
|
||||
|
for line in self: |
||||
|
if line.loan_id.state != 'approve': |
||||
|
raise except_orm('Warning', "Loan Request must be approved") |
||||
|
amount = line.paid_amount |
||||
|
loan_name = line.employee_id.name |
||||
|
print "loan_name",loan_name |
||||
|
reference = line.loan_id.name |
||||
|
journal_id = line.loan_id.journal_id.id |
||||
|
move = { |
||||
|
'name': 'Loan For' + ' ' + loan_name, |
||||
|
'narration': loan_name, |
||||
|
'ref': reference, |
||||
|
'journal_id': journal_id, |
||||
|
'date': timenow, |
||||
|
'state': 'posted', |
||||
|
} |
||||
|
|
||||
|
debit_account_id = line.loan_id.emp_account_id.id |
||||
|
credit_account_id = line.loan_id.treasury_account_id.id |
||||
|
|
||||
|
if debit_account_id: |
||||
|
debit_line = (0, 0, { |
||||
|
'name': loan_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, |
||||
|
'loan_id': line.loan_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': loan_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, |
||||
|
'loan_id': line.loan_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) |
||||
|
return result |
||||
|
return True |
||||
|
|
||||
|
|
||||
|
class HrPayslipAcc(models.Model): |
||||
|
_inherit = 'hr.payslip' |
||||
|
|
||||
|
@api.multi |
||||
|
def action_payslip_done(self): |
||||
|
rules = [] |
||||
|
for line in self.loan_ids: |
||||
|
if line.paid: |
||||
|
if self.struct_id: |
||||
|
for line_id in self.struct_id.rule_ids: |
||||
|
rules.append(line_id.code) |
||||
|
if self.struct_id.parent_id: |
||||
|
for line_ids in self.struct_id.parent_id.rule_ids: |
||||
|
rules.append(line_ids.code) |
||||
|
if 'LO' in rules: |
||||
|
line.action_paid_amount() |
||||
|
else: |
||||
|
raise except_orm('Warning', "Add Salary rule for loan in salary structure") |
||||
|
return super(HrPayslipAcc, self).action_payslip_done() |
@ -0,0 +1,13 @@ |
|||||
|
from odoo import models, fields, api, _ |
||||
|
|
||||
|
|
||||
|
class AccConfig(models.TransientModel): |
||||
|
_inherit = 'account.config.settings' |
||||
|
|
||||
|
loan_approve = fields.Boolean(default=False, string="Approval from Accounting Department", |
||||
|
help="Loan Approval from account manager") |
||||
|
|
||||
|
@api.multi |
||||
|
def set_loan_approve(self): |
||||
|
return self.env['ir.values'].sudo().set_default( |
||||
|
'account.config.settings', 'loan_approve', self.loan_approve) |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 114 KiB |
After Width: | Height: | Size: 116 KiB |
After Width: | Height: | Size: 221 KiB |
After Width: | Height: | Size: 31 KiB |
@ -0,0 +1,159 @@ |
|||||
|
<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 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;"> ☑ </span>Employee can create loan request.<br/> |
||||
|
<span style="color:green;"> ☑ </span>Double layer approval, from Accounting & HR Department.<br/> |
||||
|
<span style="color:green;"> ☑ </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"> |
||||
|
HR Loan is a component of Open HRMS suit. |
||||
|
HR 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 "HR 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 will be listed there, |
||||
|
we can manually select the installments that have to 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="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 state.</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"><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: 123 KiB |
After Width: | Height: | Size: 100 KiB |
After Width: | Height: | Size: 121 KiB |
After Width: | Height: | Size: 98 KiB |
After Width: | Height: | Size: 95 KiB |
@ -0,0 +1,43 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<record id="act_hr_loan_request" model="ir.actions.act_window"> |
||||
|
<field name="name">Loans</field> |
||||
|
<field name="type">ir.actions.act_window</field> |
||||
|
<field name="res_model">account.move.line</field> |
||||
|
<field name="src_model">hr.loan</field> |
||||
|
<field name="view_type">form</field> |
||||
|
<field name="view_mode">tree,form</field> |
||||
|
<field name="context">{'search_default_loan_id': [active_id], 'default_loan_id': active_id}</field> |
||||
|
<field name="domain">[('loan_id','=',active_id)]</field> |
||||
|
</record> |
||||
|
|
||||
|
<record id="hr_loan_inherited" model="ir.ui.view"> |
||||
|
<field name="name">HR LOAN</field> |
||||
|
<field name="model">hr.loan</field> |
||||
|
<field name="inherit_id" ref="ohrms_loan.view_hr_loan_form"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//field[@name='emp_account_id']" position="attributes"> |
||||
|
<attribute name="invisible">0</attribute> |
||||
|
</xpath> |
||||
|
<xpath expr="//field[@name='treasury_account_id']" position="attributes"> |
||||
|
<attribute name="invisible">0</attribute> |
||||
|
</xpath> |
||||
|
<xpath expr="//field[@name='journal_id']" position="attributes"> |
||||
|
<attribute name="invisible">0</attribute> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
<record model="ir.ui.view" id="view_move_line_form_inherit"> |
||||
|
<field name="name">view.move.line.form.inherit</field> |
||||
|
<field name="model">account.move.line</field> |
||||
|
<field name="inherit_id" ref="account.view_move_line_form"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<data> |
||||
|
<xpath expr="//field[@name='ref']" position="after"> |
||||
|
<field name="loan_id"/> |
||||
|
</xpath> |
||||
|
</data> |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,21 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<data> |
||||
|
<record id="view_account_config_inherit" model="ir.ui.view"> |
||||
|
<field name="name">Accounting settings</field> |
||||
|
<field name="model">account.config.settings</field> |
||||
|
<field name="inherit_id" ref="account.view_account_config_settings"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//div[@name='invoice_taxes']" position="after"> |
||||
|
<group string="Loan Approval"> |
||||
|
<label for="id" string="Loan Approval"/> |
||||
|
<div> |
||||
|
<field name="loan_approve" class="oe_inline"/> |
||||
|
<label for="loan_approve"/> |
||||
|
</div> |
||||
|
</group> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
</data> |
||||
|
</odoo> |