Browse Source

[ADD] Initial Commit

pull/78/head
Sreejith 7 years ago
parent
commit
54979ba915
  1. 47
      hr_custody/README.rst
  2. 6
      hr_custody/RELEASE_NOTES.md
  3. 24
      hr_custody/__init__.py
  4. 50
      hr_custody/__manifest__.py
  5. 25
      hr_custody/models/__init__.py
  6. 208
      hr_custody/models/custody.py
  7. 118
      hr_custody/models/hr_employee.py
  8. 48
      hr_custody/models/wizard_reason.py
  9. 23
      hr_custody/reports/__init__.py
  10. 84
      hr_custody/reports/custody_report.py
  11. 27
      hr_custody/reports/custody_report.xml
  12. 16
      hr_custody/security/custody_security.xml
  13. 13
      hr_custody/security/ir.model.access.csv
  14. BIN
      hr_custody/static/description/HRMS-BUTTON.png
  15. BIN
      hr_custody/static/description/banner.jpg
  16. BIN
      hr_custody/static/description/custody_management.png
  17. BIN
      hr_custody/static/description/cybro-service.png
  18. BIN
      hr_custody/static/description/cybro_logo.png
  19. BIN
      hr_custody/static/description/icon.png
  20. 92
      hr_custody/static/description/index.html
  21. 222
      hr_custody/views/custody_view.xml
  22. 15
      hr_custody/views/hr_custody_notification.xml
  23. 20
      hr_custody/views/hr_employee_view.xml
  24. 24
      hr_custody/views/notification_mail.xml
  25. 30
      hr_custody/views/wizard_reason_view.xml

47
hr_custody/README.rst

@ -0,0 +1,47 @@
OHRMS Custody Management
=====================
Functionality to give and track the assets of a company to employees.
- Creates a new menu item Custody Management under Employees
- Can create custody contract with an employee
- Can take the report of custody
Depends
=======
[hr, mail, hr_employee_updation] addon Odoo
Tech
====
* [Python] - Models
* [XML] - Odoo views
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: Avinash Nk <avinash@cybrosys.in>
Jesni Banu <jesni@cybrosys.in>
Maintainer
----------
This module is maintained by Cybrosys Technologies.
For support and more information, please visit https://www.cybrosys.com.

6
hr_custody/RELEASE_NOTES.md

@ -0,0 +1,6 @@
## Module hr_custody
#### 30.03.2018
#### Version 10.0.1.0.0
##### ADD
- Initial commit for OpenHrms Project

24
hr_custody/__init__.py

@ -0,0 +1,24 @@
# -*- 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: <<< Avinash Nk, Jesni Banu>>> (<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/>.
#
###################################################################################
from . import models
from . import reports

50
hr_custody/__manifest__.py

@ -0,0 +1,50 @@
# -*- 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: Avinash Nk, Jesni Banu (<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 Custody',
'version': '10.0.1.0.0',
'summary': """Manage the company properties when it is in the custody of an employee""",
'description': 'Manage the company properties when it is in the custody of an employee',
'category': 'Human Resources',
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
'website': "https://www.openhrms.com",
'depends': ['hr', 'mail', 'hr_employee_updation'],
'data': [
'security/ir.model.access.csv',
'security/custody_security.xml',
'views/wizard_reason_view.xml',
'views/custody_view.xml',
'views/hr_custody_notification.xml',
'views/hr_employee_view.xml',
'views/notification_mail.xml',
'reports/custody_report.xml'
],
'images': ['static/description/banner.jpg'],
'license': 'AGPL-3',
'demo': [],
'installable': True,
'auto_install': False,
'application': False,
}

25
hr_custody/models/__init__.py

@ -0,0 +1,25 @@
# -*- 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: Avinash Nk, Jesni Banu (<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/>.
#
###################################################################################
from . import custody
from . import hr_employee
from . import wizard_reason

208
hr_custody/models/custody.py

@ -0,0 +1,208 @@
# -*- 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: Avinash Nk, Jesni Banu (<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/>.
#
###################################################################################
from datetime import datetime, timedelta
from odoo import models, fields, api, _
from odoo.exceptions import Warning, UserError
from odoo.tools import image_resize_images
class HrCustody(models.Model):
"""
Hr custody contract creation model.
"""
_name = 'hr.custody'
_description = 'Hr Custody Management'
_inherit = ['mail.thread', 'ir.needaction_mixin']
def mail_reminder(self):
now = datetime.now() + timedelta(days=1)
date_now = now.date()
match = self.search([('state', '=', 'approved')])
for i in match:
if i.return_date:
exp_date = fields.Date.from_string(i.return_date)
if exp_date <= date_now:
base_url = self.env['ir.config_parameter'].get_param('web.base.url')
url = base_url + _('/web#id=%s&view_type=form&model=hr.custody&menu_id=') % i.id
mail_content = _('Hi %s,<br>As per the %s you took %s on %s for the reason of %s. S0 here we '
'remind you that you have to return that on or before %s. Otherwise, you can '
'renew the reference number(%s) by extending the return date through following '
'link.<br> <div style = "text-align: center; margin-top: 16px;"><a href = "%s"'
'style = "padding: 5px 10px; font-size: 12px; line-height: 18px; color: #FFFFFF; '
'border-color:#875A7B;text-decoration: none; display: inline-block; '
'margin-bottom: 0px; font-weight: 400;text-align: center; vertical-align: middle; '
'cursor: pointer; white-space: nowrap; background-image: none; '
'background-color: #875A7B; border: 1px solid #875A7B; border-radius:3px;">'
'Renew %s</a></div>') % \
(i.employee.name, i.name, i.custody_name.name, i.date_request, i.purpose,
date_now, i.name, url, i.name)
main_content = {
'subject': _('REMINDER On %s') % i.name,
'author_id': self.env.user.partner_id.id,
'body_html': mail_content,
'email_to': i.employee.work_email,
}
mail_id = self.env['mail.mail'].create(main_content)
mail_id.mail_message_id.body = mail_content
mail_id.send()
if i.employee.user_id:
mail_id.mail_message_id.write({'needaction_partner_ids': [(4, i.employee.user_id.partner_id.id)]})
mail_id.mail_message_id.write({'partner_ids': [(4, i.employee.user_id.partner_id.id)]})
@api.model
def create(self, vals):
vals['name'] = self.env['ir.sequence'].next_by_code('hr.custody')
return super(HrCustody, self).create(vals)
@api.multi
def sent(self):
self.state = 'to_approve'
@api.multi
def send_mail(self):
template = self.env.ref('hr_custody.custody_email_notification_template')
self.env['mail.template'].browse(template.id).send_mail(self.id)
self.mail_send = True
@api.multi
def set_to_draft(self):
self.state = 'draft'
@api.multi
def renew_approve(self):
for custody in self.env['hr.custody'].search([('custody_name', '=', self.custody_name.id)]):
if custody.state == "approved":
raise UserError(_("Custody is not available now"))
self.return_date = self.renew_date
self.renew_date = ''
self.state = 'approved'
@api.multi
def renew_refuse(self):
for custody in self.env['hr.custody'].search([('custody_name', '=', self.custody_name.id)]):
if custody.state == "approved":
raise UserError(_("Custody is not available now"))
self.renew_date = ''
self.state = 'approved'
@api.multi
def approve(self):
for custody in self.env['hr.custody'].search([('custody_name', '=', self.custody_name.id)]):
if custody.state == "approved":
raise UserError(_("Custody is not available now"))
self.state = 'approved'
@api.multi
def set_to_return(self):
self.state = 'returned'
self.return_date = fields.datetime.now()
# return date validation
@api.constrains('return_date')
def validate_return_date(self):
if self.return_date < self.date_request:
raise Warning('Please Give Valid Return Date')
name = fields.Char(string='Code', copy=False)
company_id = fields.Many2one('res.company', 'Company', readonly=True,
default=lambda self: self.env.user.company_id)
rejected_reason = fields.Text(string='Rejected Reason', copy=False, readonly=1)
renew_rejected_reason = fields.Text(string='Renew Rejected Reason', copy=False, readonly=1)
date_request = fields.Date(string='Requested Date', required=True, track_visibility='always', readonly=True,
states={'draft': [('readonly', False)]})
employee = fields.Many2one('hr.employee', string='Employee', required=True, readonly=True,
states={'draft': [('readonly', False)]})
purpose = fields.Char(string='Reason', track_visibility='always', required=True, readonly=True,
states={'draft': [('readonly', False)]})
custody_name = fields.Many2one('custody.property', string='Property', required=True, readonly=True,
states={'draft': [('readonly', False)]})
return_date = fields.Date(string='Return Date', required=True, track_visibility='always', readonly=True,
states={'draft': [('readonly', False)]})
renew_date = fields.Date(string='Renewal Return Date', track_visibility='always', readonly=True, copy=False)
notes = fields.Html(string='Notes')
renew_return_date = fields.Boolean(default=False, copy=False)
renew_reject = fields.Boolean(default=False, copy=False)
state = fields.Selection([('draft', 'Draft'), ('to_approve', 'Waiting For Approval'), ('approved', 'Approved'),
('returned', 'Returned'), ('rejected', 'Refused')], string='Status', default='draft',
track_visibility='always')
mail_send = fields.Boolean(string="Mail Send")
class HrPropertyName(models.Model):
"""
Hr property creation model.
"""
_name = 'custody.property'
_description = 'Property Name'
name = fields.Char(string='Property Name', required=True)
image = fields.Binary(
"Image", attachment=True,
help="This field holds the image used for this provider, limited to 1024x1024px")
image_medium = fields.Binary(
"Medium-sized image", attachment=True,
help="Medium-sized image of this provider. It is automatically "
"resized as a 128x128px image, with aspect ratio preserved. "
"Use this field in form views or some kanban views.")
image_small = fields.Binary(
"Small-sized image", attachment=True,
help="Small-sized image of this provider. It is automatically "
"resized as a 64x64px image, with aspect ratio preserved. "
"Use this field anywhere a small image is required.")
desc = fields.Html(string='Description')
company_id = fields.Many2one('res.company', 'Company',
default=lambda self: self.env.user.company_id)
@api.model
def create(self, vals):
image_resize_images(vals)
return super(HrPropertyName, self).create(vals)
@api.multi
def write(self, vals):
image_resize_images(vals)
return super(HrPropertyName, self).write(vals)
class HrReturnDate(models.TransientModel):
"""Hr custody contract renewal wizard"""
_name = 'wizard.return.date'
_description = 'Hr Custody Name'
returned_date = fields.Date(string='Renewal Date', required=1)
# renewal date validation
@api.constrains('returned_date')
def validate_return_date(self):
context = self._context
custody_obj = self.env['hr.custody'].search([('id', '=', context.get('custody_id'))])
if self.returned_date <= custody_obj.date_request:
raise Warning('Please Give Valid Renewal Date')
@api.multi
def proceed(self):
context = self._context
custody_obj = self.env['hr.custody'].search([('id', '=', context.get('custody_id'))])
custody_obj.write({'renew_return_date': True,
'renew_date': self.returned_date,
'state': 'to_approve'})

118
hr_custody/models/hr_employee.py

@ -0,0 +1,118 @@
# -*- 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: Avinash Nk, Jesni Banu (<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/>.
#
###################################################################################
from odoo import models, fields, api, _
class HrCustody(models.Model):
_inherit = 'hr.employee'
custody_count = fields.Integer(compute='_custody_count', string='# Custody')
equipment_count = fields.Integer(compute='_equipment_count', string='# Equipments')
# count of all custody contracts
@api.multi
def _custody_count(self):
for each in self:
custody_ids = self.env['hr.custody'].search([('employee', '=', each.id)])
each.custody_count = len(custody_ids)
# count of all custody contracts that are in approved state
@api.multi
def _equipment_count(self):
for each in self:
equipment_obj = self.env['hr.custody'].search([('employee', '=', each.id), ('state', '=', 'approved')])
equipment_ids = []
for each1 in equipment_obj:
if each1.custody_name.id not in equipment_ids:
equipment_ids.append(each1.custody_name.id)
each.equipment_count = len(equipment_ids)
# smart button action for returning the view of all custody contracts related to the current employee
@api.multi
def custody_view(self):
for each1 in self:
custody_obj = self.env['hr.custody'].search([('employee', '=', each1.id)])
custody_ids = []
for each in custody_obj:
custody_ids.append(each.id)
view_id = self.env.ref('hr_custody.hr_custody_form_view').id
if custody_ids:
if len(custody_ids) <= 1:
value = {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'hr.custody',
'view_id': view_id,
'type': 'ir.actions.act_window',
'name': _('Custody'),
'res_id': custody_ids and custody_ids[0]
}
else:
value = {
'domain': str([('id', 'in', custody_ids)]),
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'hr.custody',
'view_id': False,
'type': 'ir.actions.act_window',
'name': _('Custody'),
'res_id': custody_ids
}
return value
# smart button action for returning the view of all custody contracts that are in approved state,
# related to the current employee
@api.multi
def equipment_view(self):
for each1 in self:
equipment_obj = self.env['hr.custody'].search([('employee', '=', each1.id), ('state', '=', 'approved')])
equipment_ids = []
for each in equipment_obj:
if each.custody_name.id not in equipment_ids:
equipment_ids.append(each.custody_name.id)
view_id = self.env.ref('hr_custody.custody_custody_form_view').id
if equipment_ids:
if len(equipment_ids) <= 1:
value = {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'custody.property',
'view_id': view_id,
'type': 'ir.actions.act_window',
'name': _('Equipments'),
'res_id': equipment_ids and equipment_ids[0]
}
else:
value = {
'domain': str([('id', 'in', equipment_ids)]),
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'custody.property',
'view_id': False,
'type': 'ir.actions.act_window',
'name': _('Equipments'),
'res_id': equipment_ids
}
return value

48
hr_custody/models/wizard_reason.py

@ -0,0 +1,48 @@
# -*- 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: Avinash Nk, Jesni Banu (<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/>.
#
###################################################################################
from odoo import models, fields, api, _
class WizardReason(models.TransientModel):
"""
Hr custody contract refuse wizard.
"""
_name = 'wizard.reason'
@api.multi
def send_reason(self):
context = self._context
reject_obj = self.env[context.get('model_id')].search([('id', '=', context.get('reject_id'))])
if 'renew' in context.keys():
reject_obj.write({'state': 'approved',
'renew_reject': True,
'renew_rejected_reason': self.reason})
else:
if context.get('model_id') == 'hr.holidays':
reject_obj.write({'rejected_reason': self.reason})
reject_obj.action_refuse()
else:
reject_obj.write({'state': 'rejected',
'rejected_reason': self.reason})
reason = fields.Text(string="Reason")

23
hr_custody/reports/__init__.py

@ -0,0 +1,23 @@
# -*- 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: Avinash Nk, Jesni Banu (<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/>.
#
###################################################################################
from . import custody_report

84
hr_custody/reports/custody_report.py

@ -0,0 +1,84 @@
# -*- 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: Avinash Nk, Jesni Banu (<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/>.
#
###################################################################################
from odoo import models, fields, tools
class CustodyHistory(models.Model):
_name = "report.custody"
_description = "Custody Analysis"
_auto = False
name = fields.Char(string='Code')
date_request = fields.Date(string='Requested Date')
employee = fields.Many2one('hr.employee', string='Employee')
purpose = fields.Char(string='Reason')
custody_name = fields.Many2one('custody.property', string='Custody Name')
return_date = fields.Date(string='Return Date')
renew_date = fields.Date(string='Renewal Return Date')
renew_return_date = fields.Boolean(string='Renewal Return Date')
state = fields.Selection([('draft', 'Draft'), ('to_approve', 'Waiting For Approval'), ('approved', 'Approved'),
('returned', 'Returned'), ('rejected', 'Refused')], string='Status')
_order = 'name desc'
def _select(self):
select_str = """
SELECT
(select 1 ) AS nbr,
t.id as id,
t.name as name,
t.date_request as date_request,
t.employee as employee,
t.purpose as purpose,
t.custody_name as custody_name,
t.return_date as return_date,
t.renew_date as renew_date,
t.renew_return_date as renew_return_date,
t.state as state
"""
return select_str
def _group_by(self):
group_by_str = """
GROUP BY
t.id,
name,
date_request,
employee,
purpose,
custody_name,
return_date,
renew_date,
renew_return_date,
state
"""
return group_by_str
def init(self):
tools.sql.drop_view_if_exists(self._cr, 'report_custody')
self._cr.execute("""
CREATE view report_custody as
%s
FROM hr_custody t
%s
""" % (self._select(), self._group_by()))

27
hr_custody/reports/custody_report.xml

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<record id="view_report_custody" model="ir.ui.view">
<field name="name">report.custody.pivot</field>
<field name="model">report.custody</field>
<field name="arch" type="xml">
<pivot string="Ticket Analysis" display_quantity="true" disable_linking="True">
<field name="name" type="row"/>
</pivot>
</field>
</record>
<record id="action_report_custody" model="ir.actions.act_window">
<field name="name">Custody Analysis</field>
<field name="res_model">report.custody</field>
<field name="view_type">form</field>
<field name="view_mode">pivot</field>
<field name="context">{'group_by_no_leaf':1,'group_by':[]}</field>
<field name="help">This report allows you to analyse all Custody Requests. </field>
</record>
<menuitem name="Custody Analysis" action="action_report_custody" id="menu_custody_analysis"
groups="hr.group_hr_manager"
parent="hr_employee_updation.employee_report_menu" sequence="1"/>
</data>
</odoo>

16
hr_custody/security/custody_security.xml

@ -0,0 +1,16 @@
<?xml version="1.0" ?>
<odoo>
<record id="property_rule_custody" model="ir.rule">
<field name="name">Custody Multi Company</field>
<field name="model_id" ref="model_custody_property"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record id="property_rule_custody_req" model="ir.rule">
<field name="name">Custody Request Multi Company</field>
<field name="model_id" ref="model_hr_custody"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
</odoo>

13
hr_custody/security/ir.model.access.csv

@ -0,0 +1,13 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_hr_custody_hr","hr.custody.hr","model_hr_custody","hr.group_hr_manager",1,1,1,1
"access_hr_custody_hr_manager","hr.custody.user","model_hr_custody","hr.group_hr_user",1,1,1,1
"access_hr_custody_hr_employee","hr.custody.employee","model_hr_custody","base.group_user",1,1,1,0
"access_hr_custody_hr1","hr.custody.hr1","model_custody_property","hr.group_hr_manager",1,1,1,1
"access_hr_custody_hr_manager1","hr.custody.user1","model_custody_property","hr.group_hr_user",1,1,1,1
"access_hr_custody_hr_employee1","hr.custody.employee1","model_custody_property","base.group_user",1,1,1,0
"access_hr_custody_hr2","hr.custody.hr2","model_wizard_return_date","hr.group_hr_manager",1,1,1,1
"access_hr_custody_hr3","hr.custody.hr3","model_report_custody","hr.group_hr_manager",1,1,1,1
"access_hr_custody_hr_manager2","hr.custody.user2","model_wizard_return_date","hr.group_hr_user",1,1,1,1
"access_hr_custody_hr_manager3","hr.custody.user3","model_report_custody","hr.group_hr_user",1,1,1,1
"access_hr_custody_hr_employee2","hr.custody.employee2","model_wizard_return_date","base.group_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_custody_hr hr.custody.hr model_hr_custody hr.group_hr_manager 1 1 1 1
3 access_hr_custody_hr_manager hr.custody.user model_hr_custody hr.group_hr_user 1 1 1 1
4 access_hr_custody_hr_employee hr.custody.employee model_hr_custody base.group_user 1 1 1 0
5 access_hr_custody_hr1 hr.custody.hr1 model_custody_property hr.group_hr_manager 1 1 1 1
6 access_hr_custody_hr_manager1 hr.custody.user1 model_custody_property hr.group_hr_user 1 1 1 1
7 access_hr_custody_hr_employee1 hr.custody.employee1 model_custody_property base.group_user 1 1 1 0
8 access_hr_custody_hr2 hr.custody.hr2 model_wizard_return_date hr.group_hr_manager 1 1 1 1
9 access_hr_custody_hr3 hr.custody.hr3 model_report_custody hr.group_hr_manager 1 1 1 1
10 access_hr_custody_hr_manager2 hr.custody.user2 model_wizard_return_date hr.group_hr_user 1 1 1 1
11 access_hr_custody_hr_manager3 hr.custody.user3 model_report_custody hr.group_hr_user 1 1 1 1
12 access_hr_custody_hr_employee2 hr.custody.employee2 model_wizard_return_date base.group_user 1 1 1 0

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
hr_custody/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

BIN
hr_custody/static/description/custody_management.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 KiB

BIN
hr_custody/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
hr_custody/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

92
hr_custody/static/description/index.html

@ -0,0 +1,92 @@
<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">Custody Management</h2>
<h3 class="oe_slogan">Manages Custody Handling Process</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> Managing custody handling process.<br/>
<span style="color:green;"> &#9745; </span> Option to renewal.<br/>
<span style="color:green;"> &#9745; </span> Option to take reports.<br/>
</div>
</div>
</section>
<section class="oe_container ">
<div class="oe_row oe_spaced">
<div class="oe_picture">
<h3 class="oe_slogan">Overview</h3>
<p class="oe_mt32 text-justify" style="text-align: center;">
Blues over resource tracking? No more worries.
OHRMS Custody Management system constitutes the ultimate
solution for a transparent custody of company resources.
</p>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="custody_management.png">
</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>
<section class="oe_container oe_dark">
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2>
<div class="oe_slogan" style="margin-top:10px !important;">
<div>
<a class="btn btn-primary btn-lg mt8"
style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com"><i
class="fa fa-envelope"></i> Email </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/contact/"><i
class="fa fa-phone"></i> Contact Us </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/odoo-customization-and-installation/"><i
class="fa fa-check-square"></i> Request Customization </a>
</div>
<br>
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
</div>
</section>

222
hr_custody/views/custody_view.xml

@ -0,0 +1,222 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="seq_hr_custody_seq" model="ir.sequence">
<field name="name">Custody Code</field>
<field name="code">hr.custody</field>
<field name="prefix">CR</field>
<field eval="4" name="padding" />
<field eval="False" name="company_id"/>
</record>
<record model='ir.ui.view' id='wizard_return_date_form'>
<field name="name">wizard.return.date.form</field>
<field name="model">wizard.return.date</field>
<field name="arch" type="xml">
<form string="Renewal Request">
<group>
<group>
<field name="returned_date"/>
</group>
</group>
<footer>
<button name="proceed" string="Proceed" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<record model='ir.ui.view' id='custody_custody_form_view'>
<field name="name">custody.property.form</field>
<field name="model">custody.property</field>
<field name="arch" type="xml">
<form string="Equipments">
<sheet>
<field name="image" widget='image' class="oe_avatar" options='{"preview_image": "image_medium"}'/>
<div class="oe_title">
<h1><field name="name" placeholder="Name"/></h1>
</div>
<group>
<group>
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
</group>
<group></group>
</group>
<notebook>
<page name="desc" string="Description">
<field name="desc"/>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record model='ir.actions.act_window' id='wizard_return_date_act'>
<field name="name">Custody Request</field>
<field name="res_model">wizard.return.date</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="wizard_return_date_form"/>
<field name="target">new</field>
</record>
<record id="hr_custody_form_view" model="ir.ui.view">
<field name="name">hr.custody.form</field>
<field name="model">hr.custody</field>
<field name="arch" type="xml">
<form string="Custody">
<header>
<button string="Send For Approval" type="object" name="sent"
attrs="{'invisible': [('state','not in',('draft'))]}"/>
<button string="Approve" groups="hr.group_hr_manager" type="object" name="approve"
attrs="{'invisible': ['|',('state','not in',('to_approve')),
('renew_return_date','=',True)]}"/>
<button string="Renewal Approval" groups="hr.group_hr_manager" type="object" name="renew_approve"
attrs="{'invisible': ['|',('state','not in',('to_approve')),
('renew_return_date','=',False)]}"/>
<button string="Refuse" groups="hr.group_hr_manager" type="action" name="%(hr_custody.wizard_reason_act)d"
attrs="{'invisible': ['|',('state','not in',('to_approve')),
('renew_return_date','=',True)]}" class="btn-primary" context="{'reject_id':id,'model_id':'hr.custody'}"/>
<button class="btn-primary" name="%(hr_custody.wizard_reason_act)d" string="Refuse" groups="hr.group_hr_manager" type="action"
attrs="{'invisible': ['|',('state','not in',('to_approve')),
('renew_return_date','=',False)]}" context="{'reject_id':id,'model_id':'hr.custody','renew': 'renew'}"/>
<button string="Set to Draft" type="object" name="set_to_draft"
attrs="{'invisible': [('state','not in',('rejected'))]}"/>
<button string="Return" type="object" name="set_to_return" groups="hr.group_hr_manager"
attrs="{'invisible': [('state','not in',('approved'))]}"/>
<button string="Send Mail" type="object" name="send_mail" groups="hr.group_hr_manager"
attrs="{'invisible': ['|',('mail_send', '=', False),('state','not in',('approved'))]}"/>
<button string="Send Mail" type="object" class="oe_highlight" name="send_mail" groups="hr.group_hr_manager"
attrs="{'invisible': ['|',('mail_send', '=', True),('state','not in',('approved'))]}"/>
<button string="Renew" type="action" name="%(wizard_return_date_act)d"
context="{'custody_id':id}"
attrs="{'invisible': ['|',('state','not in',('approved')),
('renew_return_date','=',True)]}"/>
<field name="state" widget="statusbar" statusbar_visible="draft,to_approve,approved,returned"/>
</header>
<sheet>
<h1>
<field name="name" readonly="1" nolabel="1"/>
</h1>
<group>
<group>
<field name="custody_name" options="{'no_open':True,'no_create':True}"
domain="[('company_id','child_of',[company_id])]"/>
<field name="renew_return_date" invisible="1"/>
<field name="renew_reject" invisible="1"/>
<field name="mail_send" invisible="1"/>
<field name="employee"/>
<field name="purpose"/>
</group>
<group>
<field name="date_request"/>
<field name="return_date" attrs="{'invisible': [('renew_return_date','=',True),
('renew_date','not in',[None,False]),('renew_reject','=',False)]}"/>
<field name="renew_date" attrs="{'invisible': ['|',('renew_return_date','=',False),
('state','!=','to_approve')]}"/>
<field name="rejected_reason" attrs="{'invisible': [('state','not in',('rejected'))]}"/>
<field name="renew_rejected_reason" attrs="{'invisible': ['|',('renew_reject','=',False),('state','not in',('approved'))]}"/>
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
</group>
</group>
<notebook>
<page string="Notes">
<field name="notes"/>
</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>
<record id="hr_custody_tree_view" model="ir.ui.view">
<field name="name">hr.custody.tree</field>
<field name="model">hr.custody</field>
<field name="arch" type="xml">
<tree decoration-info="state == 'draft'" colors="red:current_date > return_date;grey:state == 'rejected';green:state == 'approved';
black:state == 'to_approve';grey:state == 'returned';">
<field name="name"/>
<field name="custody_name"/>
<field name="employee"/>
<field name="purpose"/>
<field name="date_request"/>
<field name="return_date"/>
<field name="state"/>
</tree>
</field>
</record>
<record id="hr_property_tree_view" model="ir.ui.view">
<field name="name">hr_property_tree_view.tree</field>
<field name="model">custody.property</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
</tree>
</field>
</record>
<record id="hr_custody_search_view" model="ir.ui.view">
<field name="name">hr.custody.search</field>
<field name="model">hr.custody</field>
<field name="arch" type="xml">
<search string="Custody">
<field name="name"/>
<field name="custody_name"/>
<field name="employee"/>
<field name="purpose"/>
<field name="date_request"/>
<field name="return_date"/>
<field name="state"/>
<separator/>
<group expand="0" string="Group By">
<filter string="Status" domain="[]" context="{'group_by':'state'}"/>
<filter string="Employee" domain="[]" context="{'group_by':'employee'}"/>
<filter string="Custody Name" domain="[]" context="{'group_by':'custody_name'}"/>
</group>
</search>
</field>
</record>
<record id="action_hr_custody" model="ir.actions.act_window">
<field name="name">Custody</field>
<field name="res_model">hr.custody</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="hr_custody_search_view"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to Create a New Record.
</p>
</field>
</record>
<record id="action_hr_property" model="ir.actions.act_window">
<field name="name">Property</field>
<field name="res_model">custody.property</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to Create a New Record.
</p>
</field>
</record>
<menuitem id="hr_custody_main_menu" parent="hr.menu_hr_root"
name="Custody Management" sequence="20"/>
<menuitem action="action_hr_custody" id="hr_custody_menu" parent="hr_custody.hr_custody_main_menu"
name="Custody Request" sequence="1"/>
<menuitem action="action_hr_property" id="hr_property_menu" parent="hr_custody.hr_custody_main_menu"
name="Property" sequence="5" groups="hr.group_hr_user"/>
</data>
</odoo>

15
hr_custody/views/hr_custody_notification.xml

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record model="ir.cron" id="hr_custody_data_reminder">
<field name="name">HR Custody Return Notification</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False"/>
<field name="model" eval="'hr.custody'"/>
<field name="function" eval="'mail_reminder'"/>
<field name="args" eval="'()'" />
</record>
</data>
</odoo>

20
hr_custody/views/hr_employee_view.xml

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record model="ir.ui.view" id="custody_hr_employee_inherit_form_view">
<field name="name">hr.employee.form.inherit.view</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name="arch" type="xml">
<div class="oe_button_box" position="inside">
<button class="oe_stat_button" name="custody_view" type="object" icon="fa-list-ol">
<field string="Custody" name="custody_count" widget="statinfo"/>
</button>
<button class="oe_stat_button" name="equipment_view" type="object" icon="fa-tablet">
<field string="Equipments" name="equipment_count" widget="statinfo"/>
</button>
</div>
</field>
</record>
</data>
</odoo>

24
hr_custody/views/notification_mail.xml

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="custody_email_notification_template" model="mail.template">
<field name="name">Custody e-mail template</field>
<field name="email_from">${object.company_id and object.company_id.email or ''}</field>
<field name="subject">Notification to return company asset-${object.custody_name.name}</field>
<field name="email_to">${object.email|safe}</field>
<field name="lang">${object.lang}</field>
<field name="model_id" ref="hr_custody.model_hr_custody"/>
<field name="auto_delete" eval="True"/>
<field name="body_html">
<![CDATA[
<p>Dear ${(object.employee.name)},<br/><br/>
You are in possession of the company asset
<strong>"${(object.custody_name.name)}"</strong>
since <strong>${(object.return_date)}.</strong><br/><br/>
Please kindly return the property as soon as possible.<br/><br/></p>
Regards,<br/><br/>
${(object.company_id.name)}]]>
</field>
</record>
</data>
</odoo>

30
hr_custody/views/wizard_reason_view.xml

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record model='ir.ui.view' id='wizard_reason_form'>
<field name="name">wizard.reason.form</field>
<field name="model">wizard.reason</field>
<field name="arch" type="xml">
<form string="Update Reason">
<group>
<field name="reason" required="True"/>
</group>
<footer>
<button name="send_reason" string="Proceed" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<record model='ir.actions.act_window' id='wizard_reason_act'>
<field name="name">Update Reason</field>
<field name="res_model">wizard.reason</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="wizard_reason_form"/>
<field name="target">new</field>
</record>
</data>
</odoo>
Loading…
Cancel
Save