Skip to content

Commit

Permalink
[IMP] fieldservice (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
max3903 authored Sep 3, 2019
1 parent 26ea60e commit de8848c
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 92 deletions.
2 changes: 1 addition & 1 deletion fieldservice/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
'name': 'Field Service',
'summary': 'Manage Field Service Locations, Workers and Orders',
'version': '12.0.1.1.0',
'version': '12.0.1.2.0',
'category': 'Field Service',
'author': 'Open Source Integrators, Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/field-service',
Expand Down
3 changes: 1 addition & 2 deletions fieldservice/models/fsm_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ def _compute_request_late(self):

@api.onchange('location_id')
def _onchange_location_id_customer(self):
if self.env['ir.config_parameter'].get_param(
'fieldservice.auto_populate_the_equipments'):
if self.company_id.auto_populate_equipments_on_order:
fsm_equipment_rec = self.env['fsm.equipment'].search([
('current_location_id', '=', self.location_id.id)])
self.equipment_ids = [(6, 0, fsm_equipment_rec.ids)]
Expand Down
2 changes: 2 additions & 0 deletions fieldservice/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ class ResCompany(models.Model):

auto_populate_persons_on_location = fields.Boolean(
string='Auto-populate Workers on Location based on Territory')
auto_populate_equipments_on_order = fields.Boolean(
string='Auto-populate Equipments on Order based on Location')
31 changes: 7 additions & 24 deletions fieldservice/models/res_config_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,9 @@ class ResConfigSettings(models.TransientModel):
group_fsm_tag = fields.Boolean(
string='Manage Tags',
implied_group='fieldservice.group_fsm_tag')
group_fsm_substatus = fields.Boolean(
string='Manage Substatus',
implied_group='fieldservice.group_fsm_substatus')
group_fsm_equipment = fields.Boolean(
string='Manage Equipment',
implied_group='fieldservice.group_fsm_equipment')
auto_populate_the_equipments = fields.Boolean(
string='Auto-populate the Equipments')
group_fsm_template = fields.Boolean(
string='Manage Template',
implied_group='fieldservice.group_fsm_template')
Expand All @@ -44,6 +39,8 @@ class ResConfigSettings(models.TransientModel):
string='Manage subcontractors and their pricelists')
module_fieldservice_repair = fields.Boolean(
string='Link FSM orders to MRP Repair orders')
module_fieldservice_sale = fields.Boolean(
string='Sell FSM orders')
module_fieldservice_skill = fields.Boolean(
string='Manage Skills')
module_fieldservice_stock = fields.Boolean(
Expand All @@ -54,10 +51,6 @@ class ResConfigSettings(models.TransientModel):
string='Manage Sub-Statuses')
module_fieldservice_recurring = fields.Boolean(
string='Manage Recurring Orders')
auto_populate_persons_on_location = fields.Boolean(
string='Auto-populate Workers on Location based on Territory',
related='company_id.auto_populate_persons_on_location',
readonly=False)
module_fieldservice_project = fields.Boolean(
string='Projects and Tasks')

Expand All @@ -66,27 +59,17 @@ class ResConfigSettings(models.TransientModel):
string='Auto-populate Workers on Location based on Territory',
related='company_id.auto_populate_persons_on_location',
readonly=False)
auto_populate_equipments_on_order = fields.Boolean(
string='Auto-populate equipments on Order based on the Location',
related='company_id.auto_populate_equipments_on_order',
readonly=False)

def get_values(self):
res = super(ResConfigSettings, self).get_values()
res.update(
auto_populate_the_equipments=self.env['ir.config_parameter']
.sudo().get_param('fieldservice.auto_populate_the_equipments'))
return res

def set_values(self):
res = super(ResConfigSettings, self).set_values()
self.env['ir.config_parameter'].sudo().set_param(
"fieldservice.auto_populate_the_equipments",
self.auto_populate_the_equipments)
return res

# Dependencies
@api.onchange('group_fsm_equipment')
def _onchange_group_fsm_equipment(self):
if not self.group_fsm_equipment:
self.auto_populate_the_equipments = False

# Dependencies
@api.onchange('module_fieldservice_repair')
def _onchange_module_fieldservice_repair(self):
if self.module_fieldservice_repair:
Expand Down
5 changes: 0 additions & 5 deletions fieldservice/security/res_groups.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@
<field name="category_id" ref="base.module_category_hidden"/>
</record>

<record id="group_fsm_substatus" model="res.groups">
<field name="name">Manage Field Service Substatus</field>
<field name="category_id" ref="base.module_category_hidden"/>
</record>

<record id="group_fsm_equipment" model="res.groups">
<field name="name">Manage Field Service Equipment</field>
<field name="category_id" ref="base.module_category_hidden"/>
Expand Down
2 changes: 2 additions & 0 deletions fieldservice/views/fsm_equipment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
<field name="current_location_id"/>
<field name="company_id"
groups="base.group_multi_company"/>

<field name="stage_id"/>
</tree>
</field>
</record>
Expand Down
Loading

0 comments on commit de8848c

Please sign in to comment.