Browse Source

Prepare for OCA.

- Update translation.
- Reduce garbage code.
- Update license and copyright headers.
- Improve README.
- Drop CRM stuff.
pull/229/head
Jairo Llopis 9 years ago
parent
commit
4a1c1d4e6d
  1. 71
      partner_contact_department/README.rst
  2. 11
      partner_contact_department/__init__.py
  3. 41
      partner_contact_department/__openerp__.py
  4. 108
      partner_contact_department/i18n/crm_department.pot
  5. 107
      partner_contact_department/i18n/es.po
  6. 13
      partner_contact_department/models/__init__.py
  7. 20
      partner_contact_department/models/crm_department.py
  8. 23
      partner_contact_department/models/crm_lead.py
  9. 37
      partner_contact_department/models/res_partner.py
  10. 8
      partner_contact_department/security/ir.model.access.csv
  11. 30
      partner_contact_department/views/crm_department_view.xml
  12. 64
      partner_contact_department/views/crm_lead_view.xml
  13. 47
      partner_contact_department/views/res_partner_department_view.xml
  14. 36
      partner_contact_department/views/res_partner_view.xml

71
partner_contact_department/README.rst

@ -1,19 +1,74 @@
Department field in CRM contact
===============================
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
This module adds the concept of department to the CRM main objects (lead,
opportunity, partner), and propagate them through the workflow.
==================
Contact department
==================
Department is a drop-down field in lead, opportunity and partner forms. It
refers to contact department in its own company
This module extends the functionality of the address book to support
departments.
Departments available list must be defined first at
Sales > Configuration > Leads & Opportunities > Departments
Department is a drop-down field in partner forms, and it refers to contact
department in its own company.
Configuration
=============
To configure departments, you need to:
* Go to *Sales > Configuration > Address Book > Departments*.
Usage
=====
To use this module, you need to:
* Go to any partner's form.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/134/8.0
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/partner-contact/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed `feedback
<https://github.com/OCA/
partner-contact/issues/new?body=module:%20
partner_contact_department%0Aversion:%20
8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
Images
------
* `Antiun Ingeniería S.L. <http://www.antiun.com>`_: Icon.
Contributors
------------
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
* Antonio Espinosa <antonioea@antiun.com>
* Rafael Blasco <rafabn@antiun.com>
* Jairo Llopis <yajo.sk8@gmail.com>
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.

11
partner_contact_department/__init__.py

@ -1,6 +1,9 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# Copyright (c) 2015 Antiun Ingeniería S.L. (http://www.antiun.com)
# Antonio Espinosa <antonioea@antiun.com>
# © 2015 Antiun Ingeniería S.L. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models

41
partner_contact_department/__openerp__.py

@ -1,42 +1,29 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Odoo Source Management Solution
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# Copyright (c) 2015 Antiun Ingeniería S.L. (http://www.antiun.com)
# Antonio Espinosa <antonioea@antiun.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 2015 Antiun Ingeniería S.L. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Department field in CRM contact',
'version': '1.0',
'name': 'Contact department',
"summary": "Assign contacts to departments",
'version': '8.0.1.0.0',
'category': 'Customer Relationship Management',
'author': 'Serv. Tecnol. Avanzados - Pedro M. Baeza, '
'Antiun Ingeniería S.L.',
'website': 'http://www.serviciosbaeza.com, http://www.antiun.com',
'Antiun Ingeniería S.L., '
"Odoo Community Association (OCA)",
"license": "AGPL-3",
'website': 'http://www.antiun.com',
"application": False,
'depends': [
'crm',
'base',
],
'data': [
'views/crm_department_view.xml',
'views/crm_lead_view.xml',
'views/res_partner_view.xml',
'security/ir.model.access.csv',
'views/res_partner_department_view.xml',
'views/res_partner_view.xml',
],
"installable": True,
}

108
partner_contact_department/i18n/crm_department.pot

@ -1,108 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_partner_department
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-05-27 08:51+0000\n"
"PO-Revision-Date: 2015-05-27 08:51+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: crm_partner_department
#: field:crm.department,children:0
msgid "Children"
msgstr ""
#. module: crm_partner_department
#: field:crm.department,create_uid:0
msgid "Created by"
msgstr ""
#. module: crm_partner_department
#: field:crm.department,create_date:0
msgid "Created on"
msgstr ""
#. module: crm_partner_department
#: view:crm.lead:crm_partner_department.crm_case_form_view_leads_department
#: view:crm.lead:crm_partner_department.crm_case_form_view_oppor_department
#: view:crm.lead:crm_partner_department.view_crm_case_leads_filter_department
#: view:crm.lead:crm_partner_department.view_crm_case_opportunities_filter_department
#: field:crm.lead,department:0
#: model:ir.model,name:crm_partner_department.model_crm_department
#: view:res.partner:crm_partner_department.view_partner_form_department
#: view:res.partner:crm_partner_department.view_res_partner_filter_department
#: field:res.partner,department:0
msgid "Department"
msgstr ""
#. module: crm_partner_department
#: view:crm.department:crm_partner_department.crm_department_tree_view
#: model:ir.actions.act_window,name:crm_partner_department.crm_department_action
#: model:ir.ui.menu,name:crm_partner_department.menu_crm_department
msgid "Departments"
msgstr ""
#. module: crm_partner_department
#: field:crm.department,id:0
msgid "ID"
msgstr ""
#. module: crm_partner_department
#: field:crm.department,write_uid:0
msgid "Last Updated by"
msgstr ""
#. module: crm_partner_department
#: field:crm.department,write_date:0
msgid "Last Updated on"
msgstr ""
#. module: crm_partner_department
#: model:ir.model,name:crm_partner_department.model_crm_lead
msgid "Lead/Opportunity"
msgstr ""
#. module: crm_partner_department
#: field:crm.department,name:0
msgid "Name"
msgstr ""
#. module: crm_partner_department
#: field:crm.department,parent_left:0
msgid "Parent Left"
msgstr ""
#. module: crm_partner_department
#: field:crm.department,parent_right:0
msgid "Parent Right"
msgstr ""
#. module: crm_partner_department
#: field:crm.department,parent_id:0
msgid "Parent id"
msgstr ""
#. module: crm_partner_department
#: model:ir.model,name:crm_partner_department.model_res_partner
msgid "Partner"
msgstr ""
#. module: crm_partner_department
#: view:crm.lead:crm_partner_department.view_crm_case_leads_filter_department
#: view:crm.lead:crm_partner_department.view_crm_case_opportunities_filter_department
msgid "Sales Team"
msgstr ""
#. module: crm_partner_department
#: view:res.partner:crm_partner_department.view_res_partner_filter_department
msgid "Salesperson"
msgstr ""

107
partner_contact_department/i18n/es.po

@ -6,103 +6,88 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-05-27 08:51+0000\n"
"PO-Revision-Date: 2015-05-27 08:51+0000\n"
"POT-Creation-Date: 2015-12-21 16:54+0100\n"
"PO-Revision-Date: 2015-12-21 16:55+0100\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"X-Generator: Poedit 1.8.5\n"
#. module: crm_partner_department
#: field:crm.department,children:0
msgid "Children"
msgstr "Hijos"
#. module: partner_contact_department
#: field:res.partner.department,child_ids:0
msgid "Child departments"
msgstr "Departamentos hijo"
#. module: crm_partner_department
#: field:crm.department,create_uid:0
#. module: partner_contact_department
#: field:res.partner.department,create_uid:0
msgid "Created by"
msgstr "Creado por"
#. module: crm_partner_department
#: field:crm.department,create_date:0
#. module: partner_contact_department
#: field:res.partner.department,create_date:0
msgid "Created on"
msgstr "Creado en"
#. module: crm_partner_department
#: view:crm.lead:crm_partner_department.crm_case_form_view_leads_department
#: view:crm.lead:crm_partner_department.crm_case_form_view_oppor_department
#: view:crm.lead:crm_partner_department.view_crm_case_leads_filter_department
#: view:crm.lead:crm_partner_department.view_crm_case_opportunities_filter_department
#: field:crm.lead,department:0
#: model:ir.model,name:crm_partner_department.model_crm_department
#: view:res.partner:crm_partner_department.view_partner_form_department
#: view:res.partner:crm_partner_department.view_res_partner_filter_department
#: field:res.partner,department:0
#. module: partner_contact_department
#: model:ir.model,name:partner_contact_department.model_res_partner_department
#: view:res.partner:partner_contact_department.view_partner_form_department
#: view:res.partner:partner_contact_department.view_res_partner_filter_department
#: field:res.partner,department_id:0
msgid "Department"
msgstr "Departamento"
#. module: crm_partner_department
#: view:crm.department:crm_partner_department.crm_department_tree_view
#: model:ir.actions.act_window,name:crm_partner_department.crm_department_action
#: model:ir.ui.menu,name:crm_partner_department.menu_crm_department
#. module: partner_contact_department
#: model:ir.actions.act_window,name:partner_contact_department.res_partner_department_action
#: model:ir.ui.menu,name:partner_contact_department.menu_res_partner_department
#: view:res.partner.department:partner_contact_department.res_partner_department_tree_view
msgid "Departments"
msgstr "Departamentos"
#. module: crm_partner_department
#: field:crm.department,id:0
#. module: partner_contact_department
#: field:res.partner.department,id:0
msgid "ID"
msgstr "ID"
#. module: crm_partner_department
#: field:crm.department,write_uid:0
#. module: partner_contact_department
#: field:res.partner.department,write_uid:0
msgid "Last Updated by"
msgstr "Última actualización por"
#. module: crm_partner_department
#: field:crm.department,write_date:0
#. module: partner_contact_department
#: field:res.partner.department,write_date:0
msgid "Last Updated on"
msgstr "Última actualización en"
#. module: crm_partner_department
#: model:ir.model,name:crm_partner_department.model_crm_lead
msgid "Lead/Opportunity"
msgstr "Iniciativa/Oportunidad"
#. module: crm_partner_department
#: field:crm.department,name:0
#. module: partner_contact_department
#: field:res.partner.department,name:0
msgid "Name"
msgstr "Nombre"
#. module: crm_partner_department
#: field:crm.department,parent_left:0
msgid "Parent Left"
msgstr "Padre Izquierdo"
#. module: partner_contact_department
#: field:res.partner.department,parent_id:0
msgid "Parent department"
msgstr "Departamento padre"
#. module: crm_partner_department
#: field:crm.department,parent_right:0
msgid "Parent Right"
msgstr "Padre Derecho"
#. module: partner_contact_department
#: field:res.partner.department,parent_left:0
msgid "Parent left"
msgstr "Padre izquierdo"
#. module: crm_partner_department
#: field:crm.department,parent_id:0
msgid "Parent id"
msgstr "ID Padre"
#. module: partner_contact_department
#: field:res.partner.department,parent_right:0
msgid "Parent right"
msgstr "Padre derecho"
#. module: crm_partner_department
#: model:ir.model,name:crm_partner_department.model_res_partner
#. module: partner_contact_department
#: model:ir.model,name:partner_contact_department.model_res_partner
msgid "Partner"
msgstr "Empresa"
#. module: crm_partner_department
#: view:crm.lead:crm_partner_department.view_crm_case_leads_filter_department
#: view:crm.lead:crm_partner_department.view_crm_case_opportunities_filter_department
msgid "Sales Team"
msgstr "Equipo de ventas"
#. module: crm_partner_department
#: view:res.partner:crm_partner_department.view_res_partner_filter_department
#. module: partner_contact_department
#: view:res.partner:partner_contact_department.view_res_partner_filter_department
msgid "Salesperson"
msgstr "Comercial"

13
partner_contact_department/models/__init__.py

@ -1,8 +1,9 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# Copyright (c) 2015 Antiun Ingeniería S.L. (http://www.antiun.com)
# Antonio Espinosa <antonioea@antiun.com>
# © 2015 Antiun Ingeniería S.L. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import crm_department
from . import crm_lead
from . import res_partner

20
partner_contact_department/models/crm_department.py

@ -1,20 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, fields
class CrmDepartment(models.Model):
_name = 'crm.department'
_order = "parent_left"
_parent_order = "name"
_parent_store = True
_description = "Department"
name = fields.Char(required=True, translate=True)
parent_id = fields.Many2one(comodel_name='crm.department')
children = fields.One2many(comodel_name='crm.department',
inverse_name='parent_id')
parent_left = fields.Integer('Parent Left', select=True)
parent_right = fields.Integer('Parent Right', select=True)

23
partner_contact_department/models/crm_lead.py

@ -1,23 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, fields
class CrmLead(models.Model):
_inherit = 'crm.lead'
department = fields.Many2one(comodel_name='crm.department')
def _lead_create_contact(self, cr, uid, lead, name, is_company,
parent_id=False, context=None):
"""Propagate department to created partner.
"""
partner_id = super(CrmLead, self)._lead_create_contact(
cr, uid, lead, name, is_company, parent_id=parent_id,
context=context)
self.pool['res.partner'].write(
cr, uid, partner_id, {'department': lead.department.id},
context=context)
return partner_id

37
partner_contact_department/models/res_partner.py

@ -1,11 +1,38 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# Copyright (c) 2015 Antiun Ingeniería S.L. (http://www.antiun.com)
# Antonio Espinosa <antonioea@antiun.com>
# © 2015 Antiun Ingeniería S.L. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields
class ResPartner(models.Model):
_inherit = 'res.partner'
department = fields.Many2one(comodel_name='crm.department')
department_id = fields.Many2one(
"res.partner.department",
"Department",
oldname="department")
class ResPartnerDepartment(models.Model):
_name = 'res.partner.department'
_order = "parent_left"
_parent_order = "name"
_parent_store = True
_description = "Department"
name = fields.Char(required=True, translate=True)
parent_id = fields.Many2one(
"res.partner.department",
"Parent department")
child_ids = fields.One2many(
"res.partner.department",
"parent_id",
"Child departments",
oldname="children")
parent_left = fields.Integer(index=True)
parent_right = fields.Integer(index=True)

8
partner_contact_department/security/ir.model.access.csv

@ -1,5 +1,5 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_crm_department_public","crm_department group_public","model_crm_department","base.group_public",1,0,0,0
"access_crm_department_portal","crm_department group_portal","model_crm_department","base.group_portal",1,0,0,0
"access_crm_department_group_partner_manager","crm_department group_partner_manager","model_crm_department","base.group_partner_manager",1,1,1,1
"access_crm_department_group_user","crm_department group_user","model_crm_department","base.group_user",1,0,0,0
"access_res_partner_department_public","res_partner_department group_public","model_res_partner_department","base.group_public",1,0,0,0
"access_res_partner_department_portal","res_partner_department group_portal","model_res_partner_department","base.group_portal",1,0,0,0
"access_res_partner_department_group_partner_manager","res_partner_department group_partner_manager","model_res_partner_department","base.group_partner_manager",1,1,1,1
"access_res_partner_department_group_user","res_partner_department group_user","model_res_partner_department","base.group_user",1,0,0,0

30
partner_contact_department/views/crm_department_view.xml

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="crm_department_action" model="ir.actions.act_window">
<field name="name">Departments</field>
<field name="res_model">crm.department</field>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
</record>
<record id="crm_department_tree_view" model="ir.ui.view">
<field name="name">CRM department tree</field>
<field name="model">crm.department</field>
<field name="arch" type="xml">
<tree string="Departments" editable="top">
<field name="name"/>
<field name="parent_id"/>
</tree>
</field>
</record>
<menuitem action="crm_department_action"
id="menu_crm_department"
name="Departments"
parent="base.menu_crm_config_lead"
sequence="3"/>
</data>
</openerp>

64
partner_contact_department/views/crm_lead_view.xml

@ -1,64 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="crm_case_form_view_leads">
<field name="name">Add department field</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_form_view_leads"/>
<field name="arch" type="xml">
<field name="phone" position="before">
<field name="department"
placeholder="Department"
options='{"no_open": True}'/>
</field>
</field>
</record>
<record model="ir.ui.view" id="view_crm_case_leads_filter">
<field name="name">Add department field for searching and grouping</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.view_crm_case_leads_filter"/>
<field name="arch" type="xml">
<field name="section_id" position="after">
<field name="department"/>
</field>
<filter string="Sales Team" position="after">
<filter string="Department"
domain="[]"
context="{'group_by': 'department'}"/>
</filter>
</field>
</record>
<record model="ir.ui.view" id="crm_case_form_view_oppor">
<field name="name">Add department field</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_form_view_oppor"/>
<field name="arch" type="xml">
<field name="phone" position="before">
<field name="department"
placeholder="Department"
options='{"no_open": True}'/>
</field>
</field>
</record>
<record model="ir.ui.view" id="view_crm_case_opportunities_filter">
<field name="name">Add department field for searching and grouping</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.view_crm_case_opportunities_filter"/>
<field name="arch" type="xml">
<field name="section_id" position="after">
<field name="department"/>
</field>
<filter string="Sales Team" position="after">
<filter string="Department"
domain="[]"
context="{'group_by': 'department'}"/>
</filter>
</field>
</record>
</data>
</openerp>

47
partner_contact_department/views/res_partner_department_view.xml

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza
© 2015 Antiun Ingeniería S.L. - Antonio Espinosa
© 2015 Antiun Ingeniería S.L. - Jairo Llopis
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<openerp>
<data>
<record id="res_partner_department_action" model="ir.actions.act_window">
<field name="name">Departments</field>
<field name="res_model">res.partner.department</field>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
</record>
<record id="res_partner_department_tree_view" model="ir.ui.view">
<field name="name">CRM department tree</field>
<field name="model">res.partner.department</field>
<field name="arch" type="xml">
<tree string="Departments" editable="top">
<field name="name"/>
<field name="parent_id"/>
</tree>
</field>
</record>
<record id="res_partner_department_form_view" model="ir.ui.view">
<field name="name">CRM department form</field>
<field name="model">res.partner.department</field>
<field name="arch" type="xml">
<form>
<group>
<field name="name"/>
<field name="parent_id"/>
<field name="child_ids"/>
</group>
</form>
</field>
</record>
<menuitem action="res_partner_department_action"
id="menu_res_partner_department"
parent="base.menu_config_address_book"/>
</data>
</openerp>

36
partner_contact_department/views/res_partner_view.xml

@ -1,4 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza
© 2015 Antiun Ingeniería S.L. - Antonio Espinosa
© 2015 Antiun Ingeniería S.L. - Jairo Llopis
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<openerp>
<data>
@ -7,14 +12,16 @@
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<field name="phone" position="before">
<field name="department"
<xpath expr="//sheet/group//field[@name='function']" position="after">
<field name="department_id"
placeholder="Department"
attrs="{'invisible': [('is_company','=', True)]}"
options='{"no_open": True}'/>
</field>
<xpath expr="//field[@name='child_ids']/form//field[@name='phone']" position="before">
<field name="department"
</xpath>
<xpath expr="//field[@name='child_ids']/form//field[@name='function']"
position="after">
<field name="is_company" invisible="True"/>
<field name="department_id"
placeholder="Department"
attrs="{'invisible': [('is_company','=', True)]}"
options='{"no_open": True}'/>
@ -22,34 +29,21 @@
</field>
</record>
<!-- Uncomment this to add a new column to tree view
<record model="ir.ui.view" id="view_partner_tree_department">
<field name="name">Partner tree with department</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_tree"/>
<field name="arch" type="xml">
<field name="phone" position="before">
<field name="department"/>
</field>
</field>
</record>
-->
<record model="ir.ui.view" id="view_res_partner_filter_department">
<field name="name">Partner search with department</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_res_partner_filter"/>
<field name="arch" type="xml">
<field name="category_id" position="after">
<field name="department"/>
<field name="department_id"/>
</field>
<filter string="Salesperson" position="after">
<filter string="Department"
domain="[('is_company', '=', False)]"
context="{'group_by': 'department'}"/>
context="{'group_by': 'department_id'}"/>
</filter>
</field>
</record>
</data>
</openerp>
</openerp>
Loading…
Cancel
Save