bemade_fsm: rework logic on how clients become sites/site contacts
This commit is contained in:
parent
26abe8cbfe
commit
3d97c71f0b
3 changed files with 25 additions and 20 deletions
|
|
@ -20,7 +20,7 @@
|
|||
########################################################################################
|
||||
{
|
||||
'name': 'Improved Field Service Management',
|
||||
'version': '17.0.0.2.1',
|
||||
'version': '17.0.0.3.0',
|
||||
'summary': 'Adds functionality necessary for managing field service operations at Durpro.',
|
||||
'description': 'Adds functionality necessary for managing field service operations at Durpro.',
|
||||
'category': 'Services/Field Service',
|
||||
|
|
|
|||
|
|
@ -53,6 +53,9 @@ class Partner(models.Model):
|
|||
tracking=True
|
||||
)
|
||||
|
||||
is_service_site = fields.Boolean(
|
||||
compute="_compute_is_service_site",
|
||||
)
|
||||
@api.depends(
|
||||
'equipment_ids',
|
||||
'child_ids.company_type',
|
||||
|
|
@ -60,8 +63,7 @@ class Partner(models.Model):
|
|||
)
|
||||
def _compute_owned_equipment_ids(self):
|
||||
for rec in self:
|
||||
ids = rec.equipment_ids | rec.child_ids.filtered(
|
||||
lambda l: l.company_type == 'company').mapped('equipment_ids')
|
||||
ids = rec.equipment_ids | rec.child_ids.mapped('equipment_ids')
|
||||
rec.owned_equipment_ids = ids or False
|
||||
|
||||
@api.depends('site_ids')
|
||||
|
|
@ -79,3 +81,7 @@ class Partner(models.Model):
|
|||
@api.model
|
||||
def _search_is_site_contact(self, operator, value):
|
||||
return [('site_contacts', '!=', False)]
|
||||
|
||||
def _compute_is_service_site(self):
|
||||
for rec in self:
|
||||
rec.is_service_site = bool(rec.equipment_ids)
|
||||
|
|
|
|||
|
|
@ -14,31 +14,30 @@
|
|||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page[@name='internal_notes']" position="before">
|
||||
<page name="field_service" string="Field Service">
|
||||
<field name="is_site_contact" invisible="True"/>
|
||||
<field name="is_service_site" invisible="True"/>
|
||||
<page name="field_service" string="Service Site Responsibilities" invisible="is_service_site or is_company">
|
||||
<field name="owned_equipment_ids" invisible="True"/>
|
||||
<group>
|
||||
<field name="site_contacts"
|
||||
invisible="company_type == 'person'"
|
||||
context="{'tree_view_ref': 'bemade_fsm.fsm_contacts_view_tree'}"/>
|
||||
<field name="work_order_contacts"
|
||||
invisible="company_type == 'person'"
|
||||
context="{'tree_view_ref': 'bemade_fsm.fsm_contacts_view_tree'}"/>
|
||||
<field name="equipment_ids"
|
||||
invisible="company_type == 'person'"
|
||||
context="{'tree_view_ref': 'bemade_fsm.fsm_equipment_view_tree'}"
|
||||
readonly="False"/>
|
||||
<field name="owned_equipment_ids"
|
||||
invisible="company_type == 'person' or owned_equipment_ids == False"
|
||||
context="{'tree_view_ref': 'bemade_fsm.fsm_equipment_view_tree'}"
|
||||
readonly="True"/>
|
||||
<field name="site_ids"
|
||||
invisible="company_type == 'company'">
|
||||
<field name="site_ids">
|
||||
<tree editable="bottom">
|
||||
<field name="name" widget="res_partner_many2one"/>
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
</page>
|
||||
<page name="service_equipment" string="Service Site Info" invisible="is_site_contact">
|
||||
<field name="equipment_ids"
|
||||
context="{'tree_view_ref': 'bemade_fsm.fsm_equipment_view_tree'}"
|
||||
readonly="False"/>
|
||||
<field name="site_contacts"
|
||||
context="{'tree_view_ref': 'bemade_fsm.fsm_contacts_view_tree'}"/>
|
||||
<field name="work_order_contacts"
|
||||
context="{'tree_view_ref': 'bemade_fsm.fsm_contacts_view_tree'}"/>
|
||||
<field name="owned_equipment_ids"
|
||||
context="{'tree_view_ref': 'bemade_fsm.fsm_equipment_view_tree'}"
|
||||
readonly="True"/>
|
||||
</page>
|
||||
</xpath>
|
||||
<div name="button_box" position="inside">
|
||||
<button class="oe_stat_button" type="action" name="%(bemade_fsm.act_res_partner_2_equipment)d"
|
||||
|
|
|
|||
Loading…
Reference in a new issue