Browse Source

Making the 'personal contact' informations depentens of the module 'personal_contact_information'

12.0
Yannick Vaucher 9 years ago
committed by kongrattapong
parent
commit
3e18b7e4d9
  1. 3
      partner_contact_in_several_companies/__openerp__.py
  2. 10
      partner_contact_in_several_companies/models/res_partner.py
  3. 21
      partner_contact_in_several_companies/views/res_partner.xml

3
partner_contact_in_several_companies/__openerp__.py

@ -23,7 +23,8 @@
'installable': True,
'auto_install': False,
"depends": [
"base"
"base",
"partner_contact_personal_information_page",
],
"data": [
"views/res_partner.xml",

10
partner_contact_in_several_companies/models/res_partner.py

@ -36,8 +36,8 @@ class ResPartner(models.Model):
Actually, is easier to override a dictionary value to indicate it
should be ignored...
"""
if mode != 'search' \
and 'search_show_all_positions' in self.env.context:
if (mode != 'search' and
'search_show_all_positions' in self.env.context):
result = self.with_context(
search_show_all_positions={'is_set': False})
else:
@ -48,9 +48,9 @@ class ResPartner(models.Model):
def search(self, args, offset=0, limit=None, order=None, count=False):
""" Display only standalone contact matching ``args`` or having
attached contact matching ``args`` """
if self.env.context.get('search_show_all_positions', {}).get('is_set') \
and not self.env.context[
'search_show_all_positions']['set_value']:
ctx = self.env.context
if (ctx.get('search_show_all_positions', {}).get('is_set') and
not ctx['search_show_all_positions']['set_value']):
args = expression.normalize_domain(args)
attached_contact_args = expression.AND(
(args, [('contact_type', '=', 'attached')])

21
partner_contact_in_several_companies/views/res_partner.xml

@ -2,25 +2,6 @@
<odoo>
<data>
<!-- Declared the same in every module that may need it -->
<record id="base.personal_contact_information" model="ir.ui.view">
<field name="name">Personal information page for contacts form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="priority">2</field>
<field name="arch" type="xml">
<data>
<xpath expr="//page[@name='internal_notes']" position="after">
<page name="personal_information_page"
string="Personal Information"
attrs="{'invisible': [('is_company','=',True)]}">
<group name="personal_information_group"/>
</page>
</xpath>
</data>
</field>
</record>
<record id="view_res_partner_filter_contact" model="ir.ui.view">
<field name="name">res.partner.select.contact</field>
<field name="model">res.partner</field>
@ -162,7 +143,7 @@
<record id="personal_contact_information" model="ir.ui.view">
<field name="name">Contacts in several partners: personal info</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.personal_contact_information"/>
<field name="inherit_id" ref="partner_contact_personal_information_page.personal_information"/>
<field name="arch" type="xml">
<data>
<xpath expr="//page[@name='personal_information_page']/group[@name='personal_information_group']"

Loading…
Cancel
Save