Browse Source

Initial Commit

pull/11/merge
SHEREEF PT 8 years ago
parent
commit
6f770bd8bf
  1. 24
      advance_salary/__init__.py
  2. 45
      advance_salary/__openerp__.py
  3. 26
      advance_salary/models/__init__.py
  4. 25
      advance_salary/models/hr_advance_payslip.py
  5. 234
      advance_salary/models/salary_advance.py
  6. 39
      advance_salary/models/salary_structure.py
  7. 7
      advance_salary/security/ir.model.access.csv
  8. BIN
      advance_salary/static/description/adv_salary.png
  9. BIN
      advance_salary/static/description/banner.jpg
  10. BIN
      advance_salary/static/description/cybro_logo.png
  11. BIN
      advance_salary/static/description/employee_form.png
  12. BIN
      advance_salary/static/description/icon.png
  13. 113
      advance_salary/static/description/index.html
  14. BIN
      advance_salary/static/description/salary_config.png
  15. BIN
      advance_salary/static/description/salary_structure.png
  16. 32
      advance_salary/views/advance_rule_menu.xml
  17. 18
      advance_salary/views/journal_entry.xml
  18. 69
      advance_salary/views/salary_advance_menu.xml
  19. 32
      advance_salary/views/salary_structure_view.xml

24
advance_salary/__init__.py

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2015-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Author: Sreejith P(<http://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import models

45
advance_salary/__openerp__.py

@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2015-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Author: Sreejith P(<http://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': "Advance Salary",
'version': "8.0.1.0.0",
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'summary': 'Advance salary payment option to the Employee.',
'website': 'https://www.cybrosys.com',
'license': "AGPL-3",
'category': "Human resources",
'depends': ['hr', 'hr_payroll', 'hr_contract'],
'data': [
"security/ir.model.access.csv",
"views/salary_structure_view.xml",
"views/salary_advance_menu.xml",
"views/advance_rule_menu.xml",
"views/journal_entry.xml",
],
'installable': True,
'active': False,
'images': ['static/description/banner.jpg'],
'auto_install': False,
}

26
advance_salary/models/__init__.py

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2015-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Author: Sreejith P(<http://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import salary_structure
import hr_advance_payslip
import salary_advance

25
advance_salary/models/hr_advance_payslip.py

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
from datetime import datetime
from openerp import models
class SalaryRuleInput(models.Model):
_inherit = 'hr.payslip'
def get_inputs(self, cr, uid, contract_ids, date_from, date_to, context=None):
res = super(SalaryRuleInput, self).get_inputs(cr, uid, contract_ids, date_from, date_to, context=None)
contract_obj = self.pool.get('hr.contract')
emp_id = contract_obj.browse(cr, uid, contract_ids[0], context=context).employee_id.name
adv_salary = self.pool.get('salary.advance').search(cr, uid, [('employee_id', '=', emp_id)])
for each_employee in adv_salary:
current_date = datetime.strptime(date_from, '%Y-%m-%d').date().month
date = self.pool.get('salary.advance').browse(cr, uid, each_employee, context).date
existing_date = datetime.strptime(date, '%Y-%m-%d').date().month
if current_date == existing_date:
adv_browse = self.pool.get('salary.advance').browse(cr, uid, each_employee, context)
state = adv_browse.state
amount = adv_browse.advance
for result in res:
if state == 'approved' and amount != 0 and result.get('code') == 'SAR':
result['amount'] = amount
return res

234
advance_salary/models/salary_advance.py

@ -0,0 +1,234 @@
# -*- coding: utf-8 -*-
from datetime import datetime
from openerp import models, fields, api, _
from openerp.osv import osv
from openerp.exceptions import Warning
def _employee_get(obj, cr, uid, context=None):
if context is None:
context = {}
ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context)
if ids:
return ids[0]
return False
def _get_currency(self, cr, uid, context=None):
user = self.pool.get('res.users').browse(cr, uid, [uid], context=context)[0]
return user.company_id.currency_id.id
class SalaryAdvancePayment(models.Model):
_name = "salary.advance"
name = fields.Char(string='Name', readonly=True, select=True, default=lambda self: 'Adv/')
employee_id = fields.Many2one('hr.employee', string='Employee', required=True, default='_employee_get')
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='_get_currency')
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', required=True)
exceed_condition = fields.Boolean(string='Exceed than maximum')
department = fields.Many2one('hr.department', string='Department')
state = fields.Selection([('draft', 'Draft'),
('approved', 'Approved'),
('cancel', 'Cancel')], string='Status')
@api.onchange('currency_id')
def onchange_currency_id(self, currency_id=False, company_id=False):
res = {'value': {'journal_id': False}}
journal_ids = self.pool.get('account.journal').search(self._cr, self._uid, [('type', '=', 'purchase'),
('currency', '=', currency_id),
('company_id', '=', company_id)])
if journal_ids:
res['value']['journal_id'] = journal_ids[0]
return res
@api.onchange('company_id')
def onchange_company_id(self):
company = self.company_id
domain = [('company_id.id', '=', company.id), ]
result = {
'domain': {
'payment_method': domain,
},
}
return result
def onchange_employee_id(self, cr, uid, ids, employee_id, context=None):
emp_obj = self.pool.get('hr.employee')
department_id = False
if employee_id:
employee = emp_obj.browse(cr, uid, employee_id, context=context)
department_id = employee.department_id.id
return {'value': {'department': department_id}}
@api.model
def create(self, vals):
vals['name'] = self.env['ir.sequence'].get('adv')
emp_id = vals.get('employee_id')
contract_obj = self.env['hr.contract']
emp_obj = self.env['hr.employee']
search_contract = contract_obj.search([('employee_id', '=', emp_id)])
address = emp_obj.browse([emp_id]).address_home_id
if not address.id:
raise osv.except_osv('Error!', 'Define home address for employee')
salary_advance_search = self.search([('employee_id', '=', emp_id)])
for each_advance in salary_advance_search:
current_month = datetime.strptime(vals.get('date'), '%Y-%m-%d').date().month
existing_month = datetime.strptime(each_advance.date, '%Y-%m-%d').date().month
if current_month == existing_month or current_month < existing_month:
raise osv.except_osv('Error!', 'Advance can be requested once in a month')
if not search_contract:
raise osv.except_osv('Error!', 'Define a contract for the employee')
for each_contract in search_contract:
struct_id = each_contract.struct_id
if not struct_id.max_percent or not struct_id.advance_date:
raise osv.except_osv('Error!', 'Max percentage or advance days are not provided')
adv = vals.get('advance')
amt = (each_contract.struct_id.max_percent * each_contract.wage) / 100
if adv > each_contract.wage:
raise osv.except_osv('Error!', 'Advance amount is greater than Wage')
if adv > amt and vals.get('exceed_condition') == False:
raise osv.except_osv('Error!', 'Advance amount is greater than allotted')
vals.update({'state': 'draft'})
res_id = super(SalaryAdvancePayment, self).create(vals)
return res_id
@api.multi
def write(self, vals):
emp_id = self.employee_id.id
date = self.date
advance = self.advance
if 'employee_id' in vals:
emp_id = vals.get('employee_id')
if 'date' in vals:
date = vals.get('date')
if 'advance' in vals:
advance = vals.get('advance')
contract = self.env['hr.contract']
search_contract = contract.search([('employee_id', '=', emp_id)])
emp_obj = self.env['hr.employee']
address = emp_obj.browse([emp_id]).address_home_id
if not address.id:
raise osv.except_osv('Error!', 'Define home address for employee')
salary_advance_search = self.search([('employee_id', '=', emp_id)])
for each_advance in salary_advance_search:
current_month = datetime.strptime(date, '%Y-%m-%d').date().month
existing_month = datetime.strptime(each_advance.date, '%Y-%m-%d').date().month
if each_advance.id != self.id and (current_month == existing_month or current_month < existing_month):
raise osv.except_osv('Error!', 'Advance can be requested once in a month')
if not search_contract:
raise osv.except_osv('Error!', 'Define a contract for the employee')
for each_contract in search_contract:
if not each_contract.struct_id.max_percent or not each_contract.struct_id.advance_date:
raise osv.except_osv('Error!', 'Max percentage or advance days are not provided')
amt = (each_contract.struct_id.max_percent * each_contract.wage) / 100
if advance > each_contract.wage:
raise osv.except_osv('Error!', 'Advance amount is greater than Wage')
if advance > amt and vals.get('exceed_condition') == False:
raise osv.except_osv('Error!', 'Advance amount is greater than allotted')
super(SalaryAdvancePayment, self).write(vals)
return True
def compute_advance_totals(self, account_move_lines):
total = 0.0
for i in account_move_lines:
total -= i['price']
return total, account_move_lines
def line_get_convert(self, x, part, date):
partner_id = self.env['res.partner']._find_accounting_partner(part).id
res = {
'date_maturity': x.get('date_maturity', False),
'partner_id': partner_id,
'name': x.get('name'),
'date': date,
'debit': x['price'] > 0 and x['price'],
'credit': x['price'] < 0 and -x['price'],
'account_id': x['account_id'],
'analytic_lines': x.get('analytic_lines', False),
'amount_currency': x['price'] > 0 and abs(x.get('amount_currency', False)) or -abs(
x.get('amount_currency', False)),
'currency_id': x.get('currency_id', False),
'ref': x.get('ref', False),
'product_id': x.get('product_id', False),
'product_uom_id': x.get('uos_id', False),
'analytic_account_id': x.get('account_analytic_id', False),
}
return res
def account_adv_get(self, salary_adv_obj):
return self.env['account.move'].account_move_prepare(salary_adv_obj.journal.id, date=False,
ref=self.employee_id.name, company_id=False)
@api.one
def approve(self):
self.employee_id.write({'advance_amount': self.advance})
move_obj = self.env['account.move']
company_id = self.env['res.users'].browse(self._uid).company_id
salary_adv_obj = self.env['advance.rules'].search([('company_id', '=', company_id.id)])
if not salary_adv_obj:
raise Warning(
_("No Salary Advance Rule Defined For the Login User Company."))
else:
move_id = move_obj.create(self.account_adv_get(salary_adv_obj))
acc_debit = salary_adv_obj.debit.id
adv_line = {
'type': 'src',
'name': 'Salary Advance',
'price_unit': self.advance,
'price': self.advance,
'account_id': acc_debit,
'currency_id': self.currency_id.id,
}
total, adv_line = self.compute_advance_totals([adv_line])
credit_acc = self.payment_method.default_credit_account_id.id
adv_line.append({
'type': 'dest',
'name': 'Salary Advance',
'price': total,
'account_id': credit_acc,
'ref': self.ids[0]
})
journal = move_id.journal_id
company_currency = self.env.user.company_id.currency_id.id
total, total_currency, adv_line = self.compute_expense_totals(self, company_currency, self.name, adv_line)
lines = map(lambda x: (0, 0, self.line_get_convert(x, self.employee_id.address_home_id, self.date)),
adv_line)
if journal.entry_posted:
move_obj.button_validate(move_id.id)
move_id.write({'line_id': lines})
self.write({'state': 'approved'})
def compute_expense_totals(self, cr, uid, adv, company_currency, ref, account_move_lines, context=None):
cur_obj = self.pool.get('res.currency')
total = 0.0
total_currency = 0.0
for i in account_move_lines:
if adv.currency_id.id != company_currency:
i['currency_id'] = adv.currency_id.id
i['amount_currency'] = i['price']
i['price'] = cur_obj.compute(cr, uid, adv.currency_id.id,
company_currency, i['price'],
context=context)
else:
i['amount_currency'] = False
i['currency_id'] = False
total -= i['price']
total_currency -= i['amount_currency'] or i['price']
return total, total_currency, account_move_lines
@api.one
def cancel(self):
self.write({'state': 'cancel'})
class EmployeeAdvance(models.Model):
_inherit = 'hr.employee'
advance_amount = fields.Float("Advance Amount")

39
advance_salary/models/salary_structure.py

@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
from openerp import models, fields, api
from openerp.osv import osv
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')
class AdvanceRule(models.Model):
_name = "advance.rules"
name = fields.Char(string='Name', required=True)
debit = fields.Many2one('account.account', string='Debit Account', domain="[('type','=','other')]", required=True)
credit = fields.Many2one('account.account', string='Credit Account', domain="[('type','=','other')]", required=True)
journal = fields.Many2one('account.journal', string='Journal', required=True)
company_id = fields.Many2one('res.company', string='Company', default=lambda self: self.env.user.company_id)
analytic_journal = fields.Many2one('account.analytic.journal', string='Analytic Journal')
@api.model
def create(self, vals):
company_id = vals.get('company_id')
advance_rule_search = self.search([('company_id', '=', company_id)])
if advance_rule_search:
raise osv.except_osv('Error!', 'Advance rule for this Company already exist')
res_id = super(AdvanceRule, self).create(vals)
return res_id
@api.multi
def write(self, vals):
company_id = self.company_id
if 'company_id' in vals:
company_id = vals.get('company_id')
advance_rule_search = self.search([('company_id', '=', company_id)])
if advance_rule_search and advance_rule_search.id != self.id:
raise osv.except_osv('Error!', 'Advance rule for this Company already exist')
super(AdvanceRule, self).write(vals)
return True

7
advance_salary/security/ir.model.access.csv

@ -0,0 +1,7 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_salary_advance,access_advance,model_salary_advance,,1,1,1,1
access_hr_contract,hr.contract,hr_contract.model_hr_contract,base.group_hr_user,1,0,0,0
access_hr_salary,hr.salary,hr_payroll.model_hr_payroll_structure,base.group_hr_user,1,0,0,0
access_hr_contract_user,hr.contract,hr_contract.model_hr_contract,base.group_user,1,0,0,0
access_hr_salary_user,hr.salary,hr_payroll.model_hr_payroll_structure,base.group_user,1,0,0,0
access_advance_rule,access_rule,model_advance_rules,base.group_hr_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_salary_advance access_advance model_salary_advance 1 1 1 1
3 access_hr_contract hr.contract hr_contract.model_hr_contract base.group_hr_user 1 0 0 0
4 access_hr_salary hr.salary hr_payroll.model_hr_payroll_structure base.group_hr_user 1 0 0 0
5 access_hr_contract_user hr.contract hr_contract.model_hr_contract base.group_user 1 0 0 0
6 access_hr_salary_user hr.salary hr_payroll.model_hr_payroll_structure base.group_user 1 0 0 0
7 access_advance_rule access_rule model_advance_rules base.group_hr_manager 1 1 1 1

BIN
advance_salary/static/description/adv_salary.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

BIN
advance_salary/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

BIN
advance_salary/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
advance_salary/static/description/employee_form.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

BIN
advance_salary/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

113
advance_salary/static/description/index.html

@ -0,0 +1,113 @@
<section class="oe_container">
<div class="oe_spaced">
<h2 class="oe_slogan">Advance salary</h2>
<h3 class="oe_slogan">This module will help you to provide advanced salary for the employee.</h3>
<h4 class="oe_slogan">Author : Cybrosys Techno Solutions , www.cybrosys.com</h4>
<div style="padding-left:66px;">
<h4>Features:</h4>
<ul>
<li style="list-style:none !important;"><span style="color:green;"> &#8594;</span>&nbsp;&nbsp; Adds a salary rule</li>
<li style="list-style:none !important;"><span style="color:green;"> &#8594;</span>&nbsp;&nbsp; Menu for advance salary configuration.</li>
</ul>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_spaced">
<div class="oe_picture">
<h3 class="oe_slogan">Overview</h3>
<p class="oe_mt32">
A module that provides provision to pay advance salary to the employee.
</p>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<h4 class="oe_slogan">Salary structure</h4>
<div class="oe_span12">
<p class='oe_mt32'>
&#x261B; Add "salary advance rule" to the salary structure.<br>
&#x261B; Provide limit of advance salary.<br>
&#x261B; Provide the minimum days to give advance salary<br>
</p>
<div class="oe_row_img oe_centered">
<img class="oe_picture oe_screenshot" src="salary_structure.png">
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<h4 class="oe_slogan">Advance salary configuration</h4>
<div class="oe_span12">
<p class='oe_mt32'>
&#x261B; Define a Advance salary rule. In case of multi company keep separate config for each company<br>
</p>
<div class="oe_row_img oe_centered">
<img class="oe_picture oe_screenshot" src="salary_config.png">
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<h4 class="oe_slogan">Advance salary</h4>
<div class="oe_span12">
<p class='oe_mt32'>
&#x261B; Select Employee.<br>
&#x261B; Select Payment method.<br>
&#x261B; Give the amount on Advance field.<br>
</p>
<div class="oe_row_img oe_centered">
<img class="oe_picture oe_screenshot" src="adv_salary.png">
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<h4 class="oe_slogan">Employee Form</h4>
<div class="oe_span12">
<p class='oe_mt32'>
&#x261B; Select Home address.<br>
</p>
<div class="oe_row_img oe_centered">
<img class="oe_picture oe_screenshot" src="employee_form.png">
</div>
</div>
</div>
</section>
<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="http://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="http://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="http://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>
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td>
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td>
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td>
</div>
</div>
</section>

BIN
advance_salary/static/description/salary_config.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

BIN
advance_salary/static/description/salary_structure.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

32
advance_salary/views/advance_rule_menu.xml

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="action_advance_rule" model="ir.actions.act_window">
<field name="name">Advance rule</field>
<field name="res_model">advance.rules</field>
<field name="view_type">form</field>
</record>
<record id="view_advance_rule_form" model="ir.ui.view">
<field name="name">advance.rule.form</field>
<field name="model">advance.rules</field>
<field name="arch" type="xml">
<form string="Advance Rules">
<sheet>
<group>
<group>
<field name="name"/>
<field name="debit"/>
<field name="journal"/>
</group>
<group>
<field name="credit"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<menuitem id="menu_advance_rule" action="action_advance_rule" parent="hr.menu_hr_configuration" name="Salary Advances" sequence="17" groups="base.group_hr_manager"/>
</data>
</openerp>

18
advance_salary/views/journal_entry.xml

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="jourmal_entries_inherited_view" model="ir.ui.view">
<field name="name">account_move_voucher_inherit_view</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='line_id']/tree/field[@name='invoice']" position="attributes">
<attribute name="string">Invoice No</attribute>
</xpath>
<xpath expr="//field[@name='line_id']/tree/field[@name='partner_id']" position="attributes">
<attribute name="string">Customer/Supplier</attribute>
</xpath>
</field>
</record>
</data>
</openerp>

69
advance_salary/views/salary_advance_menu.xml

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="adv_no" model="ir.sequence.type">
<field name="name">Advance</field>
<field name="code">adv</field>
</record>
<record id="adv_no1" model="ir.sequence">
<field name="name">Advance_Num</field>
<field name="code">adv</field>
<field name="prefix">Adv</field>
<field name="padding">3</field>
</record>
<record id="action_salary_advance" model="ir.actions.act_window">
<field name="name">Salary Advance</field>
<field name="res_model">salary.advance</field>
<field name="view_type">form</field>
</record>
<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="approve" string="Approve" type="object" states="draft" class="oe_highlight" groups="base.group_hr_manager"/>
<button name="cancel" string="Cancel" type="object" states="draft" class="oe_highlight" groups="base.group_hr_manager"/>
<field name="state" widget="statusbar" statusbar_visible="draft,approved"/>
</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"/>
</group>
<group>
<field name="advance"/>
<field name="payment_method"/>
<field name="currency_id" groups="base.group_multi_currency"/>
<field name="company_id" groups="base.group_multi_company"/>
</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>
<menuitem id="parent_menu_salary_advance" name="Advance" parent="hr.menu_hr_root" sequence="7"/>
<menuitem id="menu_salary_advance" action="action_salary_advance" parent="parent_menu_salary_advance" name="Salary Advance" sequence="1" />
</data>
</openerp>

32
advance_salary/views/salary_structure_view.xml

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<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.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>
</openerp>
Loading…
Cancel
Save