| @ -0,0 +1,23 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################## | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| #    Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). | |||
| #    Author: Nilmar Shereef(<https://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 | |||
| @ -0,0 +1,46 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################## | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| #    Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). | |||
| #    Author: Nilmar Shereef(<https://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': 'Employee Vehicle Request', | |||
|     'version': '10.0.1.0.0', | |||
|     'summary': """Manage Vehicle Requests From Employee""", | |||
|     'description': """This module is used for manage vehicle requests from employee. | |||
|                    This module also checking the vehicle availability at the requested time slot.""", | |||
|     'category': "Generic Modules/Human Resources", | |||
|     'author': 'Cybrosys Techno Solutions', | |||
|     'company': 'Cybrosys Techno Solutions', | |||
|     'website': "https://www.cybrosys.com", | |||
|     'depends': ['base', 'hr', 'fleet'], | |||
|     'data': [ | |||
|         'data/data.xml', | |||
|         'security/security.xml', | |||
|         'security/ir.model.access.csv', | |||
|         'views/employee_fleet_view.xml', | |||
|     ], | |||
|     'images': ['static/description/banner.jpg'], | |||
|     'license': 'LGPL-3', | |||
|     'demo': [], | |||
|     'installable': True, | |||
|     'auto_install': False, | |||
|     'application': False, | |||
| } | |||
| @ -0,0 +1,15 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <odoo> | |||
|     <data> | |||
|         <record id="fleet.fleet_rule_vehicle_visibility_user" model="ir.rule"> | |||
|             <field name="name">User can only see his/her vehicle</field> | |||
|             <field name="model_id" ref="fleet.model_fleet_vehicle"/> | |||
|             <field name="groups" eval="[(4, ref('base.group_user'))]"/> | |||
|             <field name="perm_read" eval="True"/> | |||
|             <field name="perm_write" eval="True"/> | |||
|             <field name="perm_create" eval="True"/> | |||
|             <field name="perm_unlink" eval="False"/> | |||
| 	        <field name="domain_force">[]</field> | |||
|         </record> | |||
|     </data> | |||
| </odoo> | |||
| @ -0,0 +1,23 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################## | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| #    Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). | |||
| #    Author: Nilmar Shereef(<https://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 employee_fleet | |||
| @ -0,0 +1,178 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################## | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| #    Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). | |||
| #    Author: Nilmar Shereef(<https://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/>. | |||
| # | |||
| ############################################################################## | |||
| 
 | |||
| from datetime import datetime | |||
| from odoo import models, fields, api, _ | |||
| from odoo.exceptions import Warning | |||
| 
 | |||
| 
 | |||
| class FleetReservedTime(models.Model): | |||
|     _name = "fleet.reserved" | |||
|     _description = "Reserved Time" | |||
| 
 | |||
|     employee = fields.Many2one('hr.employee', string='Employee') | |||
|     date_from = fields.Datetime(string='Reserved Date From') | |||
|     date_to = fields.Datetime(string='Reserved Date To') | |||
|     reserved_obj = fields.Many2one('fleet.vehicle') | |||
| 
 | |||
| 
 | |||
| class FleetVehicleInherit(models.Model): | |||
|     _inherit = 'fleet.vehicle' | |||
| 
 | |||
|     check_availability = fields.Boolean(default=True, copy=False) | |||
|     reserved_time = fields.One2many('fleet.reserved', 'reserved_obj', String='Reserved Time', readonly=1, | |||
|                                     ondelete='cascade') | |||
| 
 | |||
| 
 | |||
| class EmployeeFleet(models.Model): | |||
|     _name = 'employee.fleet' | |||
|     _description = 'Employee Vehicle Request' | |||
|     _inherit = ['mail.thread', 'ir.needaction_mixin'] | |||
| 
 | |||
|     @api.model | |||
|     def create(self, vals): | |||
|         vals['name'] = self.env['ir.sequence'].next_by_code('employee.fleet') | |||
|         return super(EmployeeFleet, self).create(vals) | |||
| 
 | |||
|     @api.multi | |||
|     def send(self): | |||
|         fleet_obj = self.env['fleet.vehicle'].search([]) | |||
|         check_availability = 0 | |||
|         for i in fleet_obj: | |||
|             for each in i.reserved_time: | |||
|                 if each.date_from <= self.date_from <= each.date_to: | |||
|                     check_availability = 1 | |||
|                 elif self.date_from < each.date_from: | |||
|                     if each.date_from <= self.date_to <= each.date_to: | |||
|                         check_availability = 1 | |||
|                     elif self.date_to > each.date_to: | |||
|                         check_availability = 1 | |||
|                     else: | |||
|                         check_availability = 0 | |||
|                 else: | |||
|                     check_availability = 0 | |||
|         if check_availability == 0: | |||
|             reserved_id = self.fleet.reserved_time.create({'employee': self.employee.id, | |||
|                                                            'date_from': self.date_from, | |||
|                                                            'date_to': self.date_to, | |||
|                                                            'reserved_obj': self.fleet.id, | |||
|                                                            }) | |||
|             self.write({'reserved_fleet_id': reserved_id.id}) | |||
|             self.state = 'waiting' | |||
|         else: | |||
|             raise Warning('Sorry This vehicle is already requested by another employee') | |||
| 
 | |||
|     @api.multi | |||
|     def approve(self): | |||
|         self.fleet.fleet_status = True | |||
|         self.state = 'confirm' | |||
|         mail_content = _('Hi %s,<br>Your vehicle request for the reference %s is approved.') % \ | |||
|                         (self.employee.name, self.name) | |||
|         main_content = { | |||
|             'subject': _('%s: Approved') % self.name, | |||
|             'author_id': self.env.user.partner_id.id, | |||
|             'body_html': mail_content, | |||
|             'email_to': self.employee.work_email, | |||
|         } | |||
|         mail_id = self.env['mail.mail'].create(main_content) | |||
|         mail_id.mail_message_id.body = mail_content | |||
|         mail_id.send() | |||
|         if self.employee.user_id: | |||
|             mail_id.mail_message_id.write({'needaction_partner_ids': [(4, self.employee.user_id.partner_id.id)]}) | |||
|             mail_id.mail_message_id.write({'partner_ids': [(4, self.employee.user_id.partner_id.id)]}) | |||
| 
 | |||
|     @api.multi | |||
|     def reject(self): | |||
|         self.reserved_fleet_id.unlink() | |||
|         self.state = 'reject' | |||
|         mail_content = _('Hi %s,<br>Sorry, Your vehicle request for the reference %s is Rejected.') % \ | |||
|                         (self.employee.name, self.name) | |||
| 
 | |||
|         main_content = { | |||
|             'subject': _('%s: Approved') % self.name, | |||
|             'author_id': self.env.user.partner_id.id, | |||
|             'body_html': mail_content, | |||
|             'email_to': self.employee.work_email, | |||
|         } | |||
|         mail_id = self.env['mail.mail'].create(main_content) | |||
|         mail_id.mail_message_id.body = mail_content | |||
|         mail_id.send() | |||
|         if self.employee.user_id: | |||
|             mail_id.mail_message_id.write({'needaction_partner_ids': [(4, self.employee.user_id.partner_id.id)]}) | |||
|             mail_id.mail_message_id.write({'partner_ids': [(4, self.employee.user_id.partner_id.id)]}) | |||
| 
 | |||
|     @api.multi | |||
|     def cancel(self): | |||
|         if self.reserved_fleet_id: | |||
|             self.reserved_fleet_id.unlink() | |||
|         self.state = 'cancel' | |||
| 
 | |||
|     @api.multi | |||
|     def returned(self): | |||
|         self.reserved_fleet_id.unlink() | |||
|         self.returned_date = fields.datetime.now() | |||
|         self.state = 'return' | |||
| 
 | |||
|     @api.constrains('date_rom', 'date_to') | |||
|     def onchange_date_to(self): | |||
|         for each in self: | |||
|             if each.date_from > each.date_to: | |||
|                 raise Warning('Date To must be greater than Date From') | |||
| 
 | |||
|     @api.onchange('date_from', 'date_to') | |||
|     def check_availability(self): | |||
|         self.fleet = '' | |||
|         fleet_obj = self.env['fleet.vehicle'].search([]) | |||
|         for i in fleet_obj: | |||
|             for each in i.reserved_time: | |||
|                 if each.date_from <= self.date_from <= each.date_to: | |||
|                     i.write({'check_availability': False}) | |||
|                 elif self.date_from < each.date_from: | |||
|                     if each.date_from <= self.date_to <= each.date_to: | |||
|                         i.write({'check_availability': False}) | |||
|                     elif self.date_to > each.date_to: | |||
|                         i.write({'check_availability': False}) | |||
|                     else: | |||
|                         i.write({'check_availability': True}) | |||
|                 else: | |||
|                     i.write({'check_availability': True}) | |||
| 
 | |||
|     reserved_fleet_id = fields.Many2one('fleet.reserved', invisible=1, copy=False) | |||
|     name = fields.Char(string='Request Number', copy=False) | |||
|     employee = fields.Many2one('hr.employee', string='Employee', required=1, readonly=True, | |||
|                                states={'draft': [('readonly', False)]}) | |||
|     req_date = fields.Date(string='Requested Date', default=datetime.now(), required=1, readonly=True, | |||
|                            states={'draft': [('readonly', False)]}, help="Requested Date") | |||
|     fleet = fields.Many2one('fleet.vehicle', string='Vehicle', required=1, readonly=True, | |||
|                             states={'draft': [('readonly', False)]}) | |||
|     date_from = fields.Datetime(string='From', required=1, readonly=True, | |||
|                                 states={'draft': [('readonly', False)]}) | |||
|     date_to = fields.Datetime(string='To', required=1, readonly=True, | |||
|                               states={'draft': [('readonly', False)]}) | |||
|     returned_date = fields.Datetime(string='Returned Date', readonly=1) | |||
|     purpose = fields.Text(string='Purpose', required=1, readonly=True, | |||
|                           states={'draft': [('readonly', False)]}, help="Purpose") | |||
|     state = fields.Selection([('draft', 'Draft'), ('waiting', 'Waiting for Approval'), ('cancel', 'Cancel'), | |||
|                               ('confirm', 'Approved'), ('reject', 'Rejected'), ('return', 'Returned')], | |||
|                              string="State", default="draft") | |||
| 
 | |||
| 
 | 
| @ -0,0 +1,11 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <odoo> | |||
|     <data> | |||
|          <record model="res.groups" id="base.group_user"> | |||
|             <field name="implied_ids" eval="[(4, ref('fleet.fleet_group_user'))]"/> | |||
|          </record> | |||
|          <record model="res.groups" id="hr.group_hr_manager"> | |||
|             <field name="implied_ids" eval="[(4, ref('fleet.fleet_group_manager'))]"/> | |||
|          </record> | |||
|     </data> | |||
| </odoo> | |||
| After Width: | Height: | Size: 132 KiB | 
| After Width: | Height: | Size: 50 KiB | 
| After Width: | Height: | Size: 34 KiB | 
| @ -0,0 +1,118 @@ | |||
| <section class="oe_container"> | |||
|     <div class="oe_row oe_spaced"> | |||
|         <h2 class="oe_slogan">Employee Vehicle Request</h2> | |||
|         <h3 class="oe_slogan">This Module Helps You To Manage Vehicle Requests From Employee</h3> | |||
|         <h4 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a> </h4> | |||
|     </div> | |||
|     <div class="oe_row oe_spaced" style="padding-left:65px;"> | |||
|         <h4>Features:</h4> | |||
|         <div> | |||
|             <span style="color:green;"> ☑ </span> Employee can request for any vehicle.<br/> | |||
|             <span style="color:green;"> ☑ </span> Checking availability of vehicles.<br/> | |||
|             <span style="color:green;"> ☑ </span> Validation for Send Request.<br/> | |||
|             <span style="color:green;"> ☑ </span> Validation for Requested Dates.<br/> | |||
|             <span style="color:green;"> ☑ </span> Advanced Search View.<br/> | |||
|         </div> | |||
|     </div> | |||
| </section> | |||
| 
 | |||
| <section class="oe_container oe_dark"> | |||
|     <div class="oe_row oe_spaced"> | |||
|         <div class="oe_picture"> | |||
|             <h3 class="oe_slogan">Overview</h3> | |||
|             <p class="oe_mt32" style="text-align: center;"> | |||
|                This module is used to manage vehicle requests from each employee. According to this module | |||
|                 two employees can't request the same vehicle at same time. Because this module will check | |||
|                 the vehicle availability. Also this module gives the validation for send request and requested dates. | |||
|             </p> | |||
|         </div> | |||
|     </div> | |||
| </section> | |||
| 
 | |||
| <section class="oe_container"> | |||
|     <div class="oe_row oe_spaced"> | |||
|         <h3 class="oe_slogan">Vehicle Request</h3> | |||
|         <div style="text-align: center"> | |||
|             <p> | |||
|                 <h4>Employee -> Vehicle Request -> Vehicle Request</h4> | |||
|             <p> | |||
|         </div> | |||
|         <div style="text-align: center"> | |||
|             <a href="https://www.cybrosys.com"> | |||
|                 <div class="oe_demo oe_picture oe_screenshot"> | |||
|                     <img style="border:10px solid white;height: 400px;" src="vehicle1.png"> | |||
|                 </div> | |||
|             </a> | |||
|             <span style="text-align: center;padding-left:65px;">☛ Here any employee can request available vehicle for a time period. | |||
|                 He should mention the time period and purpose. Then he can send this request to hr manager. Here also | |||
|             module checking the availability of vehicle.</span> | |||
|         </div> | |||
|     </div> | |||
| </section> | |||
| 
 | |||
| <section class="oe_container oe_dark"> | |||
|     <div class="oe_row oe_spaced"> | |||
|         <h3 class="oe_slogan">Approval</h3> | |||
|         <div class="" style="text-align: center"> | |||
|             <div class="oe_demo oe_picture oe_screenshot"> | |||
|                 <img style="border:10px solid white;height: 400px;" src="vehicle2.png"> | |||
|             </div> | |||
|         </div> | |||
|         <br> | |||
|          <div class="" style="text-align: center"> | |||
|              <div class="" style="text-align: center;padding-left:65px;"> | |||
|                 <p> | |||
|                    Here Hr Manager can approve the vehicle request. Or she can refuse the request. Also Employee | |||
|                  can cancel this request from this stage before approval or rejection. | |||
|                 <p> | |||
|             </div> | |||
|         </div> | |||
|     </div> | |||
| </section> | |||
| 
 | |||
| <section class="oe_container"> | |||
|     <div class="oe_row oe_spaced"> | |||
|        <h3 class="oe_slogan">Validation Messages</h3> | |||
|         <div style="text-align: center"> | |||
|             <div class="oe_demo oe_picture oe_screenshot"> | |||
|                 <img style="border:10px solid white;" src="validation1.png"> | |||
|             </div> | |||
|             <span style="text-align: center">☛ Requested Period Validation</span> | |||
|         </div> | |||
|         <div style="text-align: center"> | |||
|             <div class="oe_demo oe_picture oe_screenshot"> | |||
|                 <img style="border:10px solid white;" src="validation2.png"> | |||
|             </div> | |||
|             <span style="text-align: center">☛Checking the availability of vehicle</span> | |||
|         </div> | |||
|     </div> | |||
| </section> | |||
| 
 | |||
| <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> | |||
|           <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> | |||
| 
 | |||
| 
 | |||
| 
 | |||
| After Width: | Height: | Size: 7.5 KiB | 
| After Width: | Height: | Size: 8.8 KiB | 
| After Width: | Height: | Size: 62 KiB | 
| After Width: | Height: | Size: 65 KiB | 
| @ -0,0 +1,117 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <odoo> | |||
|     <data> | |||
|         <record id="sequence_employee_fleet" model="ir.sequence"> | |||
|             <field name="name">Vehicle Request Code</field> | |||
|             <field name="code">employee.fleet</field> | |||
|             <field eval="4" name="padding" /> | |||
|             <field name="prefix">VR</field> | |||
|         </record> | |||
| 
 | |||
|         <record model="ir.ui.view" id="fleet_vehicle_inherit_form_view"> | |||
|             <field name="name">fleet.vehicle.form.inherit.view</field> | |||
|             <field name="model">fleet.vehicle</field> | |||
|             <field name="inherit_id" ref="fleet.fleet_vehicle_view_form"/> | |||
|             <field name="arch" type="xml"> | |||
|                 <field name="car_value" position="after"> | |||
|                     <field name="check_availability" invisible="1"/> | |||
|                     <field name="reserved_time" invisible="1"/> | |||
|                 </field> | |||
|             </field> | |||
|         </record> | |||
| 
 | |||
|         <record model='ir.ui.view' id='employee_fleet_form_view'> | |||
|             <field name="name">employee.fleet.form</field> | |||
|             <field name="model">employee.fleet</field> | |||
|             <field name="arch" type="xml"> | |||
|                 <form string="Employee Fleet Request"> | |||
|                     <header> | |||
|                         <button name='send' string="Send Request" type="object" states="draft"/> | |||
|                         <button name='approve' string="Approve" type="object" states="waiting" groups="hr.group_hr_manager,hr.group_hr_user"/> | |||
|                         <button name='reject' string="Reject" type="object" states="waiting" groups="hr.group_hr_manager,hr.group_hr_user"/> | |||
|                         <button name='cancel' string="Cancel" type="object" states="draft,waiting"/> | |||
|                         <button name='returned' string="Return" type="object" states="confirm" groups="hr.group_hr_manager,hr.group_hr_user"/> | |||
|                         <field name="state" widget="statusbar" statusbar_visible="draft,waiting,confirm,return"/> | |||
|                     </header> | |||
|                     <sheet> | |||
|                         <h1> | |||
|                             <field name="name" readonly="1"/> | |||
|                         </h1> | |||
|                         <group> | |||
|                             <group> | |||
|                                 <field name="employee" options="{'no_create': True}"/> | |||
|                                 <field name="date_from"/> | |||
|                                 <field name="date_to"/> | |||
|                                 <field name="returned_date" attrs="{'invisible': [('state','!=','return')]}"/> | |||
|                             </group> | |||
|                             <group> | |||
|                                 <field name="req_date"/> | |||
|                                 <field name="fleet" domain="[('check_availability','=',True)]" options="{'no_create': True}"/> | |||
|                                 <field name="purpose"/> | |||
|                             </group> | |||
|                         </group> | |||
|                     </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 model='ir.ui.view' id='employee_fleet_tree_view'> | |||
|             <field name="name">employee.fleet.tree</field> | |||
|             <field name="model">employee.fleet</field> | |||
|             <field name="arch" type="xml"> | |||
|                 <tree decoration-info="state == 'draft'" colors="grey:state == 'cancel';green:state == 'confirm'; | |||
|                 red:state == 'reject';grey:state == 'return';"> | |||
|                     <field name="name"/> | |||
|                     <field name="employee"/> | |||
|                     <field name="fleet"/> | |||
|                     <field name="date_from"/> | |||
|                     <field name="date_to"/> | |||
|                     <field name="state"/> | |||
|                 </tree> | |||
|             </field> | |||
|         </record> | |||
| 
 | |||
|         <record model='ir.ui.view' id='employee_fleet_search_view'> | |||
|             <field name="name">employee.fleet.search</field> | |||
|             <field name="model">employee.fleet</field> | |||
|             <field name="arch" type="xml"> | |||
|                 <search string="Custody"> | |||
|                     <field name="name"/> | |||
|                     <field name="employee"/> | |||
|                     <field name="fleet"/> | |||
|                     <field name="date_from"/> | |||
|                     <field name="date_to"/> | |||
|                     <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="Vehicle" domain="[]" context="{'group_by':'fleet'}"/> | |||
|                     </group> | |||
|                 </search> | |||
|             </field> | |||
|         </record> | |||
| 
 | |||
|         <record id="action_employee_fleet" model="ir.actions.act_window"> | |||
|             <field name="name">Vehicle Request</field> | |||
|             <field name="type">ir.actions.act_window</field> | |||
|             <field name="res_model">employee.fleet</field> | |||
|             <field name="view_type">form</field> | |||
|             <field name="view_mode">tree,form</field> | |||
|             <field name="search_view_id" ref="employee_fleet_search_view"/> | |||
|             <field name="help" type="html"> | |||
|                 <p class="oe_view_nocontent_create"> | |||
|                     Click to create a New Vehicle Request. | |||
|                 </p> | |||
|             </field> | |||
|         </record> | |||
| 
 | |||
|         <menuitem id="employee_fleet_menu" name="Vehicle Request" parent="hr.menu_hr_root" sequence="4"/> | |||
|         <menuitem id="employee_fleet_sub_menu" name="Vehicle Request" parent="employee_fleet_menu" sequence="1" | |||
|                   action="action_employee_fleet"/> | |||
|     </data> | |||
| </odoo> | |||