diff --git a/website_hr_department/README.rst b/website_hr_department/README.rst new file mode 100644 index 0000000000..c172e159ee --- /dev/null +++ b/website_hr_department/README.rst @@ -0,0 +1,31 @@ +Our Departments Page +==================== + +This module was written to extend the functionality of the website by adding +a new page displaying the departments. Departments can be displayed with or +without: + +* A breadcrumb, +* The departments tree, +* The employees members of a department as a list or as a grid. + +Credits +======= + +Contributors +------------ + +* Laurent Mignon + +Maintainer +---------- + +.. image:: http://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. \ No newline at end of file diff --git a/website_hr_department/__init__.py b/website_hr_department/__init__.py new file mode 100644 index 0000000000..9e5827f90e --- /dev/null +++ b/website_hr_department/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- +from . import controllers +from . import models diff --git a/website_hr_department/__openerp__.py b/website_hr_department/__openerp__.py new file mode 100644 index 0000000000..1aa8716cff --- /dev/null +++ b/website_hr_department/__openerp__.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# This file is part of website_hr_department, an Odoo module. +# +# Copyright (c) 2015 ACSONE SA/NV () +# +# website_hr_department is free software: you can redistribute it and/or +# modify it under the terms of the GNU Affero General Public License +# as published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# website_hr_department 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 website_hr_department. +# If not, see . +# +############################################################################## +{ + 'name': "Departments Page", + 'summary': """ + Display the structure of your departments and their members. + """, + 'author': "ACSONE SA/NV", + 'website': "http://acsone.eu", + 'category': 'Website', + 'version': '0.1', + 'license': 'AGPL-3', + 'depends': [ + 'website_hr', + ], + 'data': [ + 'security/ir.model.access.csv', + 'security/website_hr_department.xml', + 'data/websiste_hr_department_data.xml', + 'views/website_hr_department.xml', + ], +} diff --git a/website_hr_department/controllers.py b/website_hr_department/controllers.py new file mode 100644 index 0000000000..68fb8383cf --- /dev/null +++ b/website_hr_department/controllers.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# This file is part of website_hr_department, an Odoo module. +# +# Copyright (c) 2015 ACSONE SA/NV () +# +# website_hr_department is free software: you can redistribute it and/or +# modify it under the terms of the GNU Affero General Public License +# as published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# website_hr_department 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 website_hr_department. +# If not, see . +# +############################################################################## + +from openerp import http +from openerp.addons.website_hr.controllers.main import website_hr + + +class WebsiteHr(website_hr): + + @http.route(['/page/departments', + '/page/departments/' + ], type='http', auth="public", website=True) + def departments(self, department=None, **post): + request = http.request + hr_department = request.env['hr.department'] + departments = hr_department.search([('parent_id', '=', False)]) + + hr_employee = request.env['hr.employee'] + employees = [] + breadcrumb = [] + if department: + employees = hr_employee.search( + [('department_id', '=', department.id)]) + breadcrumb.append(department) + parent = department.parent_id + while parent: + breadcrumb.append(parent) + parent = parent.parent_id + breadcrumb.reverse() + values = { + 'employees': employees, + 'departments': departments, + 'department': department, + 'breadcrumb': breadcrumb, + } + return request.website.render( + 'website_hr_department.departments', values) diff --git a/website_hr_department/data/websiste_hr_department_data.xml b/website_hr_department/data/websiste_hr_department_data.xml new file mode 100644 index 0000000000..89f8f8edb0 --- /dev/null +++ b/website_hr_department/data/websiste_hr_department_data.xml @@ -0,0 +1,22 @@ + + + + + + Departments + /page/departments + + 40 + + + Website Departments + self + /page/departments + + + + open + + + + diff --git a/website_hr_department/models.py b/website_hr_department/models.py new file mode 100644 index 0000000000..02965aeec6 --- /dev/null +++ b/website_hr_department/models.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# This file is part of website_hr_department, an Odoo module. +# +# Copyright (c) 2015 ACSONE SA/NV () +# +# website_hr_department is free software: you can redistribute it and/or +# modify it under the terms of the GNU Affero General Public License +# as published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# website_hr_department 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 website_hr_department. +# If not, see . +# +############################################################################## + +from openerp import models, fields + + +class hr_department(models.Model): + _inherit = 'hr.department' + + website_published = fields.Boolean( + 'Available in the website', copy=False, default=False) + public_info = fields.Html('Public Info') diff --git a/website_hr_department/security/ir.model.access.csv b/website_hr_department/security/ir.model.access.csv new file mode 100644 index 0000000000..342f448c9d --- /dev/null +++ b/website_hr_department/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_hr_department_public,hr.department.public,hr.model_hr_department,base.group_public,1,0,0,0 diff --git a/website_hr_department/security/website_hr_department.xml b/website_hr_department/security/website_hr_department.xml new file mode 100644 index 0000000000..16d0ab1ee6 --- /dev/null +++ b/website_hr_department/security/website_hr_department.xml @@ -0,0 +1,15 @@ + + + + + hr_department: Public + + [('website_published', '=', True)] + + + + + + + + diff --git a/website_hr_department/static/description/icon.png b/website_hr_department/static/description/icon.png new file mode 100644 index 0000000000..94deece0f0 Binary files /dev/null and b/website_hr_department/static/description/icon.png differ diff --git a/website_hr_department/static/src/css/website_hr_department.css b/website_hr_department/static/src/css/website_hr_department.css new file mode 100644 index 0000000000..3eedeb2f27 --- /dev/null +++ b/website_hr_department/static/src/css/website_hr_department.css @@ -0,0 +1,84 @@ +.employees h2 { + text-align: center; +} + +/* ---- Employees grid styles---- */ +.employee.oe_grid { + text-align: center; +} + +.employee.oe_grid .employee_image img{ + display: inline; +} + +/* ---- Employees list styles ---- */ +.employee.oe_list { + border: 1px solid rgba(100, 100, 100, 0.2); +} + +.employee.oe_list { + position: relative; +} +.employee.oe_list .employee_image { + position: absolute; + left: 15px; + right: 15px; + top: 15px; + bottom: 55px; + text-align: center; +} +.employee.oe_list .employee_image img { + max-width: 100%; + max-height: 100%; + margin: auto; + position: absolute; + top: 0; + left: 0; + bottom: 0; + right: 0; + z-index: 4; +} +.employee.oe_list section { + position: absolute; + left: 0; + right: 0; + bottom: 0; + overflow: hidden; + padding: 0 15px 24px 10px; + min-height: 56px; + border-top: 1px solid rgba(255, 255, 255, 0.2); + background: rgba(255, 255, 255, 0.75); + z-index: 5; +} + +.employee.oe_list .oe_subdescription { + font-size: 0.8em; + overflow: hidden; + margin-bottom: 10px; +} + +@media (min-width: 400px) { + .employee.oe_list { + border: none; + border-bottom: 1px solid rgba(100, 100, 100, 0.2); + width: 100%; + min-height: 100px; + position: relative; + padding-bottom: 5px; + } + .employee.oe_list .employee_image { + top: 0; + bottom: 0; + left: 0; + right: 0; + width: 170px; + } + .employee.oe_list section { + position: relative; + border: 0; + top: 0; + bottom: auto; + left: 180px; + background: transparent; + } +} \ No newline at end of file diff --git a/website_hr_department/views/website_hr_department.xml b/website_hr_department/views/website_hr_department.xml new file mode 100644 index 0000000000..9699b4756a --- /dev/null +++ b/website_hr_department/views/website_hr_department.xml @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + +