Browse Source

[ADD] Initial Commit

pull/72/head
Sreejith P 7 years ago
parent
commit
464114330f
  1. 36
      ohrms_loan_accounting/README.md
  2. 3
      ohrms_loan_accounting/__init__.py
  3. 49
      ohrms_loan_accounting/__manifest__.py
  4. 6
      ohrms_loan_accounting/doc/RELEASE_NOTES.md
  5. 4
      ohrms_loan_accounting/models/__init__.py
  6. 169
      ohrms_loan_accounting/models/hr_loan_acc.py
  7. 22
      ohrms_loan_accounting/models/hr_loan_config.py
  8. BIN
      ohrms_loan_accounting/static/description/HRMS-BUTTON.png
  9. BIN
      ohrms_loan_accounting/static/description/accounting_validation.png
  10. BIN
      ohrms_loan_accounting/static/description/banner.jpg
  11. BIN
      ohrms_loan_accounting/static/description/cybro-service.png
  12. BIN
      ohrms_loan_accounting/static/description/cybro_logo.png
  13. BIN
      ohrms_loan_accounting/static/description/icon.png
  14. 172
      ohrms_loan_accounting/static/description/index.html
  15. BIN
      ohrms_loan_accounting/static/description/loan_amount_deduction.png
  16. BIN
      ohrms_loan_accounting/static/description/loan_approval.png
  17. BIN
      ohrms_loan_accounting/static/description/loan_request.png
  18. BIN
      ohrms_loan_accounting/static/description/loan_rule.png
  19. BIN
      ohrms_loan_accounting/static/description/payslip.png
  20. 21
      ohrms_loan_accounting/views/hr_loan_acc.xml
  21. 28
      ohrms_loan_accounting/views/hr_loan_config.xml

36
ohrms_loan_accounting/README.md

@ -0,0 +1,36 @@
Open HRMS Loan Accounting
=========================
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_accounting/__init__.py

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

49
ohrms_loan_accounting/__manifest__.py

@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
###################################################################################
# A part of Open HRMS 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 Accounting',
'version': '11.0.1.0.0',
'summary': 'Open HRMS Loan Accounting',
'description': """
Create accounting entries for loan requests.
""",
'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', '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,
}

6
ohrms_loan_accounting/doc/RELEASE_NOTES.md

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

4
ohrms_loan_accounting/models/__init__.py

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

169
ohrms_loan_accounting/models/hr_loan_acc.py

@ -0,0 +1,169 @@
# -*- coding: utf-8 -*-
import time
from odoo import models, 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.config_parameter'].sudo().get_param('account.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_lines:
raise except_orm('Warning', 'You must compute installment before Approved')
if loan_approve:
self.write({'state': 'waiting_approval_2'})
else:
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_lines:
raise except_orm('Warning', 'You must compute Loan Request before Approved')
timenow = time.strftime('%Y-%m-%d')
for loan in self:
amount = loan.loan_amount
loan_name = loan.employee_id.name
reference = loan.name
journal_id = loan.journal_id.id
debit_account_id = loan.treasury_account_id.id
credit_account_id = loan.emp_account_id.id
debit_vals = {
'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,
}
credit_vals = {
'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,
}
vals = {
'name': 'Loan For' + ' ' + loan_name,
'narration': loan_name,
'ref': reference,
'journal_id': journal_id,
'date': timenow,
'line_ids': [(0, 0, debit_vals), (0, 0, credit_vals)]
}
move = self.env['account.move'].create(vals)
move.post()
self.write({'state': 'approve'})
return True
@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_lines:
raise except_orm('Warning', 'You must compute Loan Request before Approved')
timenow = time.strftime('%Y-%m-%d')
for loan in self:
amount = loan.loan_amount
loan_name = loan.employee_id.name
reference = loan.name
journal_id = loan.journal_id.id
debit_account_id = loan.treasury_account_id.id
credit_account_id = loan.emp_account_id.id
debit_vals = {
'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,
}
credit_vals = {
'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,
}
vals = {
'name': 'Loan For' + ' ' + loan_name,
'narration': loan_name,
'ref': reference,
'journal_id': journal_id,
'date': timenow,
'line_ids': [(0, 0, debit_vals), (0, 0, credit_vals)]
}
move = self.env['account.move'].create(vals)
move.post()
self.write({'state': 'approve'})
return True
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.
"""
timenow = time.strftime('%Y-%m-%d')
for line in self:
if line.loan_id.state != 'approve':
raise except_orm('Warning', "Loan Request must be approved")
amount = line.amount
loan_name = line.employee_id.name
reference = line.loan_id.name
journal_id = line.loan_id.journal_id.id
debit_account_id = line.loan_id.emp_account_id.id
credit_account_id = line.loan_id.treasury_account_id.id
debit_vals = {
'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,
}
credit_vals = {
'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,
}
vals = {
'name': 'Loan For' + ' ' + loan_name,
'narration': loan_name,
'ref': reference,
'journal_id': journal_id,
'date': timenow,
'line_ids': [(0, 0, debit_vals), (0, 0, credit_vals)]
}
move = self.env['account.move'].create(vals)
move.post()
return True
class HrPayslipAcc(models.Model):
_inherit = 'hr.payslip'
@api.multi
def action_payslip_done(self):
for line in self.input_line_ids:
if line.loan_line_id:
line.loan_line_id.action_paid_amount()
return super(HrPayslipAcc, self).action_payslip_done()

22
ohrms_loan_accounting/models/hr_loan_config.py

@ -0,0 +1,22 @@
from odoo import models, fields, api, _
class AccConfig(models.TransientModel):
_inherit = 'res.config.settings'
loan_approve = fields.Boolean(default=False, string="Approval from Accounting Department",
help="Loan Approval from account manager")
@api.model
def get_values(self):
res = super(AccConfig, self).get_values()
res.update(
loan_approve=self.env['ir.config_parameter'].sudo().get_param('account.loan_approve')
)
return res
@api.multi
def set_values(self):
super(AccConfig, self).set_values()
self.env['ir.config_parameter'].sudo().set_param('account.loan_approve', self.loan_approve)

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
ohrms_loan_accounting/static/description/accounting_validation.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

BIN
ohrms_loan_accounting/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 KiB

BIN
ohrms_loan_accounting/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
ohrms_loan_accounting/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

172
ohrms_loan_accounting/static/description/index.html

@ -0,0 +1,172 @@
<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.cybrosys.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 Accounting</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_accounting/static/description/loan_amount_deduction.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

BIN
ohrms_loan_accounting/static/description/loan_approval.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

BIN
ohrms_loan_accounting/static/description/loan_request.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
ohrms_loan_accounting/static/description/loan_rule.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

BIN
ohrms_loan_accounting/static/description/payslip.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

21
ohrms_loan_accounting/views/hr_loan_acc.xml

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<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.hr_loan_form_view"/>
<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>
</odoo>

28
ohrms_loan_accounting/views/hr_loan_config.xml

@ -0,0 +1,28 @@
<?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">res.config.settings</field>
<field name="inherit_id" ref="account.res_config_settings_view_form"/>
<field name="arch" type="xml">
<div id="recommended_apps" position="after">
<h2 groups="account.group_account_user">Loan Approval</h2>
<div class="row mt16 o_settings_container" id="loan_approval" groups="account.group_account_user">
<div class="col-xs-12 col-md-6 o_setting_box" title="Allows you to Add approval from accounting department." groups="account.group_account_user">
<div class="o_setting_left_pane">
<field name="loan_approve" class="oe_inline"/>
</div>
<div class="o_setting_right_pane">
<label string="Loan Approval" for="loan_approve"/>
<div class="text-muted">
Enable Approval from Accounting Department
</div>
</div>
</div>
</div>
</div>
</field>
</record>
</data>
</odoo>
Loading…
Cancel
Save