Browse Source

Merge pull request #327 from Tecnativa/9.0-mig-partner_contact_department

9.0 [MIG] partner_contact_department migration
pull/342/head
Pedro M. Baeza 8 years ago
committed by GitHub
parent
commit
8cf09a3338
  1. 72
      partner_contact_department/README.rst
  2. 6
      partner_contact_department/__init__.py
  3. 25
      partner_contact_department/__openerp__.py
  4. 94
      partner_contact_department/i18n/de.po
  5. 104
      partner_contact_department/i18n/es.po
  6. 93
      partner_contact_department/i18n/fi.po
  7. 94
      partner_contact_department/i18n/it.po
  8. 104
      partner_contact_department/i18n/sl.po
  9. 6
      partner_contact_department/models/__init__.py
  10. 43
      partner_contact_department/models/res_partner.py
  11. 5
      partner_contact_department/security/ir.model.access.csv
  12. BIN
      partner_contact_department/static/description/icon.png
  13. 5
      partner_contact_department/tests/__init__.py
  14. 31
      partner_contact_department/tests/test_recursion.py
  15. 44
      partner_contact_department/views/res_partner_department_view.xml
  16. 47
      partner_contact_department/views/res_partner_view.xml

72
partner_contact_department/README.rst

@ -0,0 +1,72 @@
.. 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
==================
Contact department
==================
This module extends the functionality of the address book to support
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.
* You will find the new *Department* field below *Job Position*.
.. 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/9.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.
Credits
=======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
* Antonio Espinosa <antonioea@antiun.com>
* Rafael Blasco <rafabn@antiun.com>
* Jairo Llopis <yajo.sk8@gmail.com>
* Vicent Cubells <vicent.cubells@tecnativa.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.

6
partner_contact_department/__init__.py

@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# © 2014-2015 Tecnativa S.L. - Jairo Llopis
# © 2016 Tecnativa S.L. - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models

25
partner_contact_department/__openerp__.py

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# © 2014-2015 Tecnativa S.L. - Jairo Llopis
# © 2016 Tecnativa S.L. - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Contact department',
"summary": "Assign contacts to departments",
'version': '9.0.1.0.0',
'category': 'Customer Relationship Management',
'author': 'Tecnativa, '
'Odoo Community Association (OCA)',
"license": "AGPL-3",
'website': 'http://www.tecnativa.com',
"application": False,
'depends': [
'base',
],
'data': [
'security/ir.model.access.csv',
'views/res_partner_department_view.xml',
'views/res_partner_view.xml',
],
"installable": True,
}

94
partner_contact_department/i18n/de.po

@ -0,0 +1,94 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_contact_department
#
# Translators:
# Rudolf Schnapka <rs@techno-flex.de>, 2016
msgid ""
msgstr ""
"Project-Id-Version: partner-contact (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-19 01:46+0000\n"
"PO-Revision-Date: 2016-01-18 16:40+0000\n"
"Last-Translator: Rudolf Schnapka <rs@techno-flex.de>\n"
"Language-Team: German (http://www.transifex.com/oca/OCA-partner-contact-8-0/language/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: partner_contact_department
#: field:res.partner.department,child_ids:0
msgid "Child departments"
msgstr "Unter-Abteilungen"
#. module: partner_contact_department
#: field:res.partner.department,create_uid:0
msgid "Created by"
msgstr "Angelegt durch"
#. module: partner_contact_department
#: field:res.partner.department,create_date:0
msgid "Created on"
msgstr "Angelegt am"
#. 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 "Abteilung"
#. 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 "Abteilungen"
#. module: partner_contact_department
#: field:res.partner.department,id:0
msgid "ID"
msgstr "ID"
#. module: partner_contact_department
#: field:res.partner.department,write_uid:0
msgid "Last Updated by"
msgstr "Zuletzt aktualisiert durch"
#. module: partner_contact_department
#: field:res.partner.department,write_date:0
msgid "Last Updated on"
msgstr "Zuletzt aktualisiert am"
#. module: partner_contact_department
#: field:res.partner.department,name:0
msgid "Name"
msgstr "Bezeichnung"
#. module: partner_contact_department
#: field:res.partner.department,parent_id:0
msgid "Parent department"
msgstr "Übergeordnete Abteilung"
#. module: partner_contact_department
#: field:res.partner.department,parent_left:0
msgid "Parent left"
msgstr "Links übergeordnet"
#. module: partner_contact_department
#: field:res.partner.department,parent_right:0
msgid "Parent right"
msgstr "Rechts übergeordnet"
#. module: partner_contact_department
#: model:ir.model,name:partner_contact_department.model_res_partner
msgid "Partner"
msgstr "Partner"
#. module: partner_contact_department
#: view:res.partner:partner_contact_department.view_res_partner_filter_department
msgid "Salesperson"
msgstr "Verkäufer"

104
partner_contact_department/i18n/es.po

@ -0,0 +1,104 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_contact_department
#
# Translators:
# Oihane Crucelaegui <oihanecruce@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: partner-contact (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-25 11:58+0000\n"
"PO-Revision-Date: 2016-07-14 09:05+0000\n"
"Last-Translator: Oihane Crucelaegui <oihanecruce@gmail.com>\n"
"Language-Team: Spanish (http://www.transifex.com/oca/OCA-partner-contact-8-0/language/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: partner_contact_department
#: field:res.partner.department,child_ids:0
msgid "Child departments"
msgstr "Departamentos hijo"
#. module: partner_contact_department
#: field:res.partner.department,create_uid:0
msgid "Created by"
msgstr "Creado por"
#. module: partner_contact_department
#: field:res.partner.department,create_date:0
msgid "Created on"
msgstr "Creado en"
#. 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: 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: partner_contact_department
#: field:res.partner.department,display_name:0
msgid "Display Name"
msgstr "Nombre mostrado"
#. module: partner_contact_department
#: field:res.partner.department,id:0
msgid "ID"
msgstr "ID"
#. module: partner_contact_department
#: field:res.partner.department,__last_update:0
msgid "Last Modified on"
msgstr "Última modificación el"
#. module: partner_contact_department
#: field:res.partner.department,write_uid:0
msgid "Last Updated by"
msgstr "Última actualización por"
#. module: partner_contact_department
#: field:res.partner.department,write_date:0
msgid "Last Updated on"
msgstr "Última actualización en"
#. module: partner_contact_department
#: field:res.partner.department,name:0
msgid "Name"
msgstr "Nombre"
#. module: partner_contact_department
#: field:res.partner.department,parent_id:0
msgid "Parent department"
msgstr "Departamento padre"
#. module: partner_contact_department
#: field:res.partner.department,parent_left:0
msgid "Parent left"
msgstr "Padre izquierdo"
#. module: partner_contact_department
#: field:res.partner.department,parent_right:0
msgid "Parent right"
msgstr "Padre derecho"
#. module: partner_contact_department
#: model:ir.model,name:partner_contact_department.model_res_partner
msgid "Partner"
msgstr "Empresa"
#. module: partner_contact_department
#: view:res.partner:partner_contact_department.view_res_partner_filter_department
msgid "Salesperson"
msgstr "Comercial"

93
partner_contact_department/i18n/fi.po

@ -0,0 +1,93 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_contact_department
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: partner-contact (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-19 01:46+0000\n"
"PO-Revision-Date: 2015-12-22 15:56+0000\n"
"Last-Translator: <>\n"
"Language-Team: Finnish (http://www.transifex.com/oca/OCA-partner-contact-8-0/language/fi/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fi\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: partner_contact_department
#: field:res.partner.department,child_ids:0
msgid "Child departments"
msgstr ""
#. module: partner_contact_department
#: field:res.partner.department,create_uid:0
msgid "Created by"
msgstr "Luonut"
#. module: partner_contact_department
#: field:res.partner.department,create_date:0
msgid "Created on"
msgstr "Luotu"
#. 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 ""
#. 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 ""
#. module: partner_contact_department
#: field:res.partner.department,id:0
msgid "ID"
msgstr "ID"
#. module: partner_contact_department
#: field:res.partner.department,write_uid:0
msgid "Last Updated by"
msgstr "Viimeksi päivitetty"
#. module: partner_contact_department
#: field:res.partner.department,write_date:0
msgid "Last Updated on"
msgstr "Viimeksi päivittänyt"
#. module: partner_contact_department
#: field:res.partner.department,name:0
msgid "Name"
msgstr "Nimi"
#. module: partner_contact_department
#: field:res.partner.department,parent_id:0
msgid "Parent department"
msgstr ""
#. module: partner_contact_department
#: field:res.partner.department,parent_left:0
msgid "Parent left"
msgstr ""
#. module: partner_contact_department
#: field:res.partner.department,parent_right:0
msgid "Parent right"
msgstr ""
#. module: partner_contact_department
#: model:ir.model,name:partner_contact_department.model_res_partner
msgid "Partner"
msgstr "Kumppani"
#. module: partner_contact_department
#: view:res.partner:partner_contact_department.view_res_partner_filter_department
msgid "Salesperson"
msgstr "Myyjä"

94
partner_contact_department/i18n/it.po

@ -0,0 +1,94 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_contact_department
#
# Translators:
# Paolo Valier, 2016
msgid ""
msgstr ""
"Project-Id-Version: partner-contact (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-13 00:57+0000\n"
"PO-Revision-Date: 2016-03-13 17:22+0000\n"
"Last-Translator: Paolo Valier\n"
"Language-Team: Italian (http://www.transifex.com/oca/OCA-partner-contact-8-0/language/it/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: it\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: partner_contact_department
#: field:res.partner.department,child_ids:0
msgid "Child departments"
msgstr ""
#. module: partner_contact_department
#: field:res.partner.department,create_uid:0
msgid "Created by"
msgstr "Creato da"
#. module: partner_contact_department
#: field:res.partner.department,create_date:0
msgid "Created on"
msgstr "Creato il"
#. 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 ""
#. 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 ""
#. module: partner_contact_department
#: field:res.partner.department,id:0
msgid "ID"
msgstr "ID"
#. module: partner_contact_department
#: field:res.partner.department,write_uid:0
msgid "Last Updated by"
msgstr "Ultimo aggiornamento di"
#. module: partner_contact_department
#: field:res.partner.department,write_date:0
msgid "Last Updated on"
msgstr "Ultimo aggiornamento il"
#. module: partner_contact_department
#: field:res.partner.department,name:0
msgid "Name"
msgstr "Nome"
#. module: partner_contact_department
#: field:res.partner.department,parent_id:0
msgid "Parent department"
msgstr ""
#. module: partner_contact_department
#: field:res.partner.department,parent_left:0
msgid "Parent left"
msgstr ""
#. module: partner_contact_department
#: field:res.partner.department,parent_right:0
msgid "Parent right"
msgstr ""
#. module: partner_contact_department
#: model:ir.model,name:partner_contact_department.model_res_partner
msgid "Partner"
msgstr "Partner"
#. module: partner_contact_department
#: view:res.partner:partner_contact_department.view_res_partner_filter_department
msgid "Salesperson"
msgstr ""

104
partner_contact_department/i18n/sl.po

@ -0,0 +1,104 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_contact_department
#
# Translators:
# Matjaž Mozetič <m.mozetic@matmoz.si>, 2015-2016
msgid ""
msgstr ""
"Project-Id-Version: partner-contact (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-05-07 07:18+0000\n"
"PO-Revision-Date: 2016-05-07 07:15+0000\n"
"Last-Translator: Matjaž Mozetič <m.mozetic@matmoz.si>\n"
"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-partner-contact-8-0/language/sl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: sl\n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
#. module: partner_contact_department
#: field:res.partner.department,child_ids:0
msgid "Child departments"
msgstr "Podrejeni oddelki"
#. module: partner_contact_department
#: field:res.partner.department,create_uid:0
msgid "Created by"
msgstr "Ustvaril"
#. module: partner_contact_department
#: field:res.partner.department,create_date:0
msgid "Created on"
msgstr "Ustvarjeno"
#. 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 "Oddelek"
#. 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 "Oddelki"
#. module: partner_contact_department
#: field:res.partner.department,display_name:0
msgid "Display Name"
msgstr "Prikazni naziv"
#. module: partner_contact_department
#: field:res.partner.department,id:0
msgid "ID"
msgstr "ID"
#. module: partner_contact_department
#: field:res.partner.department,__last_update:0
msgid "Last Modified on"
msgstr "Zadnjič spremenjeno"
#. module: partner_contact_department
#: field:res.partner.department,write_uid:0
msgid "Last Updated by"
msgstr "Zadnji posodobil"
#. module: partner_contact_department
#: field:res.partner.department,write_date:0
msgid "Last Updated on"
msgstr "Zadnjič posodobljeno"
#. module: partner_contact_department
#: field:res.partner.department,name:0
msgid "Name"
msgstr "Naziv"
#. module: partner_contact_department
#: field:res.partner.department,parent_id:0
msgid "Parent department"
msgstr "Nadrejeni oddelek"
#. module: partner_contact_department
#: field:res.partner.department,parent_left:0
msgid "Parent left"
msgstr "Levo nadrejeni"
#. module: partner_contact_department
#: field:res.partner.department,parent_right:0
msgid "Parent right"
msgstr "Desno nadrejeni"
#. module: partner_contact_department
#: model:ir.model,name:partner_contact_department.model_res_partner
msgid "Partner"
msgstr "Partner"
#. module: partner_contact_department
#: view:res.partner:partner_contact_department.view_res_partner_filter_department
msgid "Salesperson"
msgstr "Prodajalec"

6
partner_contact_department/models/__init__.py

@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# © 2014-2015 Tecnativa S.L. - Jairo Llopis
# © 2016 Tecnativa S.L. - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import res_partner

43
partner_contact_department/models/res_partner.py

@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
# © 2014-2015 Tecnativa S.L. - Jairo Llopis
# © 2016 Tecnativa S.L. - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields, api, _
from openerp.exceptions import ValidationError
class ResPartner(models.Model):
_inherit = 'res.partner'
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",
ondelete='restrict')
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)
@api.constrains('parent_id')
def _check_parent_id(self):
if not self._check_recursion():
raise ValidationError(
_('Error! You cannot create recursive departments.'))

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

@ -0,0 +1,5 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"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

BIN
partner_contact_department/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 22 KiB

5
partner_contact_department/tests/__init__.py

@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016 Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl-3.0).
from . import test_recursion

31
partner_contact_department/tests/test_recursion.py

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
# © 2016 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl-3.0).
from openerp.tests import common
from openerp.exceptions import ValidationError
class TestRecursion(common.SavepointCase):
@classmethod
def setUpClass(cls):
super(TestRecursion, cls).setUpClass()
cls.department_obj = cls.env['res.partner.department']
# Instances
cls.dpt1 = cls.department_obj.create(vals=dict(name='Dpt. 1'))
cls.dpt2 = cls.department_obj.create(
vals=dict(
name='Dpt. 2',
parent_id=cls.dpt1.id
))
def test_recursion(self):
""" Testing recursion """
self.dpt3 = self.department_obj.create(vals=dict(
name='Dpt. 3',
parent_id=self.dpt2.id
))
# Creating a parent's child department using dpt1.
with self.assertRaises(ValidationError):
self.dpt1.write(vals={'parent_id': self.dpt3.id})

44
partner_contact_department/views/res_partner_department_view.xml

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- © 2014-2015 Tecnativa S.L. - Jairo Llopis
© 2016 Tecnativa S.L. - Vicent Cubells
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<odoo>
<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"/>
</odoo>

47
partner_contact_department/views/res_partner_view.xml

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- © 2014-2015 Tecnativa S.L. - Jairo Llopis
© 2016 Tecnativa S.L. - Vicent Cubells
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<odoo>
<record model="ir.ui.view" id="view_partner_form_department">
<field name="name">Partner form with department</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//sheet/group//field[@name='function']" position="after">
<field name="department_id"
placeholder="Department"
attrs="{'invisible': [('is_company','=', True)]}"
options='{"no_open": True}'/>
</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}'/>
</xpath>
</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_id"/>
</field>
<filter name="salesperson" position="after">
<filter name="department"
string="Department"
domain="[('is_company', '=', False)]"
context="{'group_by': 'department_id'}"/>
</filter>
</field>
</record>
</odoo>
Loading…
Cancel
Save