feat(workorders): move address to contact and auto-compute zone
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
from . import dsrpt_communication_type
|
||||
from . import dsrpt_contact
|
||||
from . import dsrpt_contact_address
|
||||
from . import dsrpt_contact_communication
|
||||
from . import contact_event
|
||||
from . import contact_source
|
||||
|
||||
@@ -38,6 +38,11 @@ class Contact(models.Model):
|
||||
'contact_id',
|
||||
string='Events'
|
||||
)
|
||||
address_ids = fields.One2many(
|
||||
'dsrpt.contact.address',
|
||||
'contact_id',
|
||||
string='Addresses'
|
||||
)
|
||||
# call_ids moved to dsrpt_calls module to avoid circular dependencies
|
||||
|
||||
# Computed fields
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ContactAddress(models.Model):
|
||||
_name = "dsrpt.contact.address"
|
||||
_description = "Contact Address"
|
||||
_order = "id desc"
|
||||
_rec_name = "description"
|
||||
|
||||
contact_id = fields.Many2one("dsrpt.contact", required=True, ondelete="cascade", index=True)
|
||||
description = fields.Char(required=True)
|
||||
latitude = fields.Float(digits=(10, 6))
|
||||
longitude = fields.Float(digits=(10, 6))
|
||||
@@ -5,6 +5,8 @@ access_dsrpt_communication_type_user,dsrpt.communication.type.user,model_dsrpt_c
|
||||
access_dsrpt_communication_type_admin,dsrpt.communication.type.admin,model_dsrpt_communication_type,group_dsrpt_address_book_admin,1,1,1,1
|
||||
access_dsrpt_contact_communication_user,dsrpt.contact.communication.user,model_dsrpt_contact_communication,group_dsrpt_address_book_user,1,1,1,1
|
||||
access_dsrpt_contact_communication_admin,dsrpt.contact.communication.admin,model_dsrpt_contact_communication,group_dsrpt_address_book_admin,1,1,1,1
|
||||
access_dsrpt_contact_address_user,dsrpt.contact.address.user,model_dsrpt_contact_address,group_dsrpt_address_book_user,1,1,1,1
|
||||
access_dsrpt_contact_address_admin,dsrpt.contact.address.admin,model_dsrpt_contact_address,group_dsrpt_address_book_admin,1,1,1,1
|
||||
access_contact_event_user,contact.event.user,model_contact_event,group_dsrpt_address_book_user,1,1,1,0
|
||||
access_contact_event_admin,contact.event.admin,model_contact_event,group_dsrpt_address_book_admin,1,1,1,1
|
||||
access_contact_source_user,contact.source.user,model_contact_source,group_dsrpt_address_book_user,1,1,1,0
|
||||
|
||||
|
@@ -96,7 +96,18 @@
|
||||
<group name="requests_placeholder"/>
|
||||
</group>
|
||||
|
||||
<!-- Third row: Communications (full width) -->
|
||||
<!-- Third row: Addresses (full width) -->
|
||||
<group col="1" string="Addresses">
|
||||
<field name="address_ids" nolabel="1" context="{'default_contact_id': id}">
|
||||
<list editable="bottom">
|
||||
<field name="description"/>
|
||||
<field name="latitude"/>
|
||||
<field name="longitude"/>
|
||||
</list>
|
||||
</field>
|
||||
</group>
|
||||
|
||||
<!-- Fourth row: Communications (full width) -->
|
||||
<group col="1" string="Communications">
|
||||
<field name="communication_ids" nolabel="1" context="{'default_contact_id': id}">
|
||||
<list editable="bottom">
|
||||
@@ -107,7 +118,7 @@
|
||||
</field>
|
||||
</group>
|
||||
|
||||
<!-- Fourth row: Calls (full width) - will be added by dsrpt_calls module -->
|
||||
<!-- Fifth row: Calls (full width) - will be added by dsrpt_calls module -->
|
||||
<group col="1" name="calls_section"/>
|
||||
</sheet>
|
||||
<chatter/>
|
||||
|
||||
Reference in New Issue
Block a user