Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge OCA changes #2

Merged
merged 7 commits into from
Oct 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
[![Runbot Status](https://runbot.odoo-community.org/runbot/badge/flat/264/11.0.svg)](https://runbot.odoo-community.org/runbot/repo/github-com-oca-field-service-264)
[![Build Status](https://travis-ci.org/OCA/field-service.svg?branch=11.0)](https://travis-ci.org/OCA/field-service)

# Field Service
# Field Service Management

[Field service management](https://en.wikipedia.org/wiki/Field_service_management) (FSM) coordinates company resources employed at, or en route to, client sites, rather than on the company's premises. FSM most commonly refers to companies who need to manage installation, service or repairs of systems or equipment.

Examples of field service use cases are:

- In telecommunications and cable industry, technicians who install cable or run phone lines into residences or business establishments.
- In healthcare, mobile nurses who provide in-home care for elderly or disabled.
- In gas utilities, engineers who are dispatched to investigate and repair suspected leaks.
- In heavy engineering, mining, industrial and manufacturing, technicians dispatched for preventative maintenance and repair.
- In property maintenance, including landscaping, irrigation, and home and office cleaning.
- In HVAC industry, technicians have the expertise and equipment to investigate units in residential, commercial and industrial environments.

Odoo modules for field service management.

[//]: # (addons)

Expand Down
2 changes: 2 additions & 0 deletions fieldservice/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
'author': 'Open Source Integrators, Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/field-service',
'depends': [
'base_geolocalize',
'mail',
'web_timeline',
],
Expand All @@ -25,6 +26,7 @@
'views/res_partner.xml',
'views/fsm_location.xml',
'views/fsm_person.xml',
'views/fsm_vehicle.xml',
'views/fsm_order.xml',
'views/fsm_route.xml',
'views/menu.xml',
Expand Down
1 change: 1 addition & 0 deletions fieldservice/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
fsm_tag,
fsm_location,
fsm_person,
fsm_vehicle,
fsm_order,
fsm_route,
)
18 changes: 18 additions & 0 deletions fieldservice/models/fsm_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,24 @@ class FSMLocation(models.Model):
partner_id = fields.Many2one('res.partner', string='Related Partner',
required=True, ondelete='restrict',
auto_join=True)
owner_id = fields.Many2one('res.partner', string='Related Owner',
required=True, ondelete='restrict',
auto_join=True)
customer_id = fields.Many2one('res.partner', string='Related Customer',
required=True, ondelete='restrict',
auto_join=True)
tag_ids = fields.Many2many('fsm.tag',
string='Tags')
building = fields.Char(string='Building', size=35)
floor = fields.Char(string='Floor', size=35)
unit = fields.Char(string='Unit', size=35)
room = fields.Char(string='Room', size=35)
description = fields.Char(string='Description')
territory = fields.Char(string='Territory', size=35)
branch = fields.Char(string='Branch', size=35)
district = fields.Char(string='District', size=35)
region = fields.Char(string='Region', size=35)
timezone = fields.Char(string='Timezone', size=35)

@api.model
def create(self, vals):
Expand Down
5 changes: 5 additions & 0 deletions fieldservice/models/fsm_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ class FSMRoute(models.Model):
fsm_person_id = fields.Many2one('fsm.person',
string='Assigned To',
required=True)
fsm_vehicle_id = fields.Many2one('fsm.vehicle',
string='Assigned Vehicle')
date = fields.Date(string='Date', required=True)

_sql_constraints = [
('fsm_route_person_date_uniq',
'unique (fsm_person_id, date)',
"You cannot create 2 routes for the same person on the same day!"),
('fsm_route_vehicle_date_uniq',
'unique (fsm_vehicle_id, date)',
"You cannot create 2 routes for the same vehicle on the same day!"),
]

@api.model
Expand Down
16 changes: 16 additions & 0 deletions fieldservice/models/fsm_vehicle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (C) 2018 - TODAY, Brian McMaster
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class FSMVehicle(models.Model):
_name = 'fsm.vehicle'
_description = 'Field Service Vehicle'

name = fields.Char(string='Name', required='True')
fsm_person_id = fields.Many2one('fsm.person', string='Assigned Driver')

_sql_constraints = [
('name_uniq', 'unique (name)', "Vehicle name already exists!"),
]
2 changes: 2 additions & 0 deletions fieldservice/security/ir.model.access.csv
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ access_fsm_order_user,fsm.order.user,model_fsm_order,fieldservice.group_fsm_user
access_fsm_order_dispatcher,fsm.order.dispatcher,model_fsm_order,fieldservice.group_fsm_dispatcher,1,1,1,0
access_fsm_route_user,fsm.route.user,model_fsm_route,fieldservice.group_fsm_user,1,1,0,0
access_fsm_route_dispatcher,fsm.route.dispatcher,model_fsm_route,fieldservice.group_fsm_dispatcher,1,1,1,1
access_fsm_vehicle_fsm_user,fsm.vehicle.user,model_fsm_vehicle,fieldservice.group_fsm_user,1,0,0,0
access_fsm_vehicle_fsm_manager,fsm.vehicle.manager,model_fsm_vehicle,fieldservice.group_fsm_manager,1,1,1,1
91 changes: 86 additions & 5 deletions fieldservice/views/fsm_location.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<!-- Field Service Location -->
<!-- Field Service Location Tree View-->
<record id="fsm_location_tree_view" model="ir.ui.view">
<field name="name">fsm.location.tree</field>
<field name="model">fsm.location</field>
<field name="arch" type="xml">
<tree string="Locations">
<field name="name"/>
<field name="owner_id"/>
<field name="customer_id"/>
<field name="building"/>
<field name="floor"/>
<field name="unit"/>
<field name="room"/>
<field name="partner_latitude"/>
<field name="partner_longitude"/>
</tree>
</field>
</record>

<!-- Field Service Location Form View-->
<record id="fsm_location_form_view" model="ir.ui.view">
<field name="name">fsm.location.form</field>
<field name="model">fsm.location</field>
Expand All @@ -21,32 +30,104 @@
<group>
<group>
<field name="name"/>
<field name="id" invisible="1"/>
<field name="partner_id"
readonly="1"
required="0"
groups="base.group_no_one"
attrs="{'invisible': [('id', '=', False)]}"/>
<field name="owner_id"/>
<field name="customer_id"/>
</group>
<group>
<field name="building"/>
<field name="floor"/>
<field name="unit"/>
<field name="room"/>
<field name="partner_latitude"/>
<field name="partner_longitude"/>
</group>
<group></group>
</group>
<notebook>
<page string="Directions">
<field name="direction" nolabel="1" widget="html"/>
</page>
<page string="Address Information">
<group>
<group>
<field name="territory"/>
<field name="branch"/>
<field name="district"/>
<field name="region"/>
</group>
<group>
<field name="street"/>
<field name="street2"/>
<field name="city"/>
<field name="state_id"/>
<field name="zip"/>
<field name="country_id"/>
</group>
</group>
<newline/>
<group>
<field name="description"/>
<field name="timezone"/>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>

<!-- Field Service Location Search View-->
<record id="fsm_location_search_view" model="ir.ui.view">
<field name="name">fsm.location.search</field>
<field name="model">fsm.location</field>
<field name="arch" type="xml">
<search string="Search FSM Location">
<field name="name" filter_domain="['|', ('name','ilike',self)]" string="FSM Location"/>
<field name="partner_id"/>
<field name="owner_id"/>
<field name="customer_id"/>
<field name="building"/>
<field name="floor"/>
<field name="unit"/>
<field name="room"/>
<field name="partner_latitude"/>
<field name="partner_longitude"/>
<field name="territory"/>
<field name="branch"/>
<field name="district"/>
<field name="region"/>
<field name="street"/>
<field name="street2"/>
<field name="city"/>
<field name="state_id"/>
<field name="zip"/>
<field name="country_id"/>
<field name="description"/>
<field name="timezone"/>
<group expand="0" string="Group By">
<filter string="Owner" domain="[]" context="{'group_by':'owner_id'}"/>
<filter string="Customer" domain="[]" context="{'group_by':'customer_id'}"/>
</group>
</search>
</field>
</record>

<record id="action_fsm_location" model="ir.actions.act_window">
<field name="name">Service Locations</field>
<field name="res_model">fsm.location</field>
<field name="view_id" ref="fsm_location_tree_view"/>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="fsm_location_search_view"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Create a Service Locations.
</p>
<p>
Module not yet enabled.
</p>
</field>
</record>

Expand Down
1 change: 1 addition & 0 deletions fieldservice/views/fsm_route.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<group>
<group>
<field name="fsm_person_id"/>
<field name="fsm_vehicle_id" groups="fieldservice.group_fsm_vehicle"/>
</group>
<group>
<field name="date"/>
Expand Down
48 changes: 48 additions & 0 deletions fieldservice/views/fsm_vehicle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<!-- Field Service Vehicle -->
<record id="fsm_vehicle_tree_view" model="ir.ui.view">
<field name="name">fsm.vehicle.tree</field>
<field name="model">fsm.vehicle</field>
<field name="arch" type="xml">
<tree string="Vehicles">
<field name="name"/>
<field name="fsm_person_id"/>
</tree>
</field>
</record>

<record id="fsm_vehicle_form_view" model="ir.ui.view">
<field name="name">fsm.vehicle.form</field>
<field name="model">fsm.vehicle</field>
<field name="arch" type="xml">
<form string="Vehicle">
<sheet>
<group>
<group>
<field name="name"/>
</group>
<group>
<field name="fsm_person_id"/>
</group>
</group>
</sheet>
</form>
</field>
</record>

<!-- Field Service Vehicles -->
<record id="action_fsm_vehicle" model="ir.actions.act_window">
<field name="name">Field Service Vehicles</field>
<field name="res_model">fsm.vehicle</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">
Add a Field Service Vehicle here.
</p>
</field>
</record>

</odoo>
7 changes: 7 additions & 0 deletions fieldservice/views/menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@
parent="data"
sequence="30"/>

<menuitem id="menu_fsm_vehicle"
name="Vehicles"
action="action_fsm_vehicle"
parent="data"
sequence="40"
groups="group_fsm_vehicle"/>

<!-- Reporting Menu -->
<menuitem id="menu_fsm_report_order"
name="Orders"
Expand Down