Skip to content

Commit

Permalink
[OCA]12567 Location structure needs to reflect hierarchy of Buildings (
Browse files Browse the repository at this point in the history
…OCA#22)

* [IMP] Extend fsm.location object
  • Loading branch information
Sandip Mangukiya authored and murtuzasaleh committed Mar 16, 2020
1 parent f7f11e2 commit f47ae3d
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 5 deletions.
1 change: 1 addition & 0 deletions fieldservice/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ Contributors
* Wolfgang Hall <whall@opensourceintegrators.com>
* Maxime Chambreuil <mchambreuil@opensourceintegrators.com>
* Steve Campbell <scampbell@opensourceintegrators.com>
* Sandip Mangukiya <smangukiya@opensourceintegrators.com>

Other credits
~~~~~~~~~~~~~
Expand Down
1 change: 1 addition & 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 Down
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
86 changes: 81 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,99 @@
<group>
<group>
<field name="name"/>
<field name="partner_id"/>
<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

0 comments on commit f47ae3d

Please sign in to comment.