diff --git a/partner_contact_department/README.rst b/partner_contact_department/README.rst new file mode 100644 index 000000000..85d5a154f --- /dev/null +++ b/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 +`_. 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 `_. + +Contributors +------------ + +* Pedro M. Baeza +* Antonio Espinosa +* Rafael Blasco +* Jairo Llopis +* Vicent Cubells + +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. diff --git a/partner_contact_department/__init__.py b/partner_contact_department/__init__.py new file mode 100644 index 000000000..44de80558 --- /dev/null +++ b/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 diff --git a/partner_contact_department/__openerp__.py b/partner_contact_department/__openerp__.py new file mode 100644 index 000000000..080b98a55 --- /dev/null +++ b/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, +} diff --git a/partner_contact_department/i18n/de.po b/partner_contact_department/i18n/de.po new file mode 100644 index 000000000..779e6c5fe --- /dev/null +++ b/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 , 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 \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" diff --git a/partner_contact_department/i18n/es.po b/partner_contact_department/i18n/es.po new file mode 100644 index 000000000..7c422d0cc --- /dev/null +++ b/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 , 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 \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" diff --git a/partner_contact_department/i18n/fi.po b/partner_contact_department/i18n/fi.po new file mode 100644 index 000000000..004f29ba6 --- /dev/null +++ b/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ä" diff --git a/partner_contact_department/i18n/it.po b/partner_contact_department/i18n/it.po new file mode 100644 index 000000000..5bae950e7 --- /dev/null +++ b/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 "" diff --git a/partner_contact_department/i18n/sl.po b/partner_contact_department/i18n/sl.po new file mode 100644 index 000000000..717fc20c1 --- /dev/null +++ b/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č , 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č \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" diff --git a/partner_contact_department/models/__init__.py b/partner_contact_department/models/__init__.py new file mode 100644 index 000000000..6393dbaea --- /dev/null +++ b/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 diff --git a/partner_contact_department/models/res_partner.py b/partner_contact_department/models/res_partner.py new file mode 100644 index 000000000..94946ae8f --- /dev/null +++ b/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.')) diff --git a/partner_contact_department/security/ir.model.access.csv b/partner_contact_department/security/ir.model.access.csv new file mode 100644 index 000000000..9a73e7a61 --- /dev/null +++ b/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 diff --git a/partner_contact_department/static/description/icon.png b/partner_contact_department/static/description/icon.png new file mode 100644 index 000000000..add81b17a Binary files /dev/null and b/partner_contact_department/static/description/icon.png differ diff --git a/partner_contact_department/tests/__init__.py b/partner_contact_department/tests/__init__.py new file mode 100644 index 000000000..7630da7d4 --- /dev/null +++ b/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 diff --git a/partner_contact_department/tests/test_recursion.py b/partner_contact_department/tests/test_recursion.py new file mode 100644 index 000000000..90204dd0b --- /dev/null +++ b/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}) diff --git a/partner_contact_department/views/res_partner_department_view.xml b/partner_contact_department/views/res_partner_department_view.xml new file mode 100644 index 000000000..f07ab520c --- /dev/null +++ b/partner_contact_department/views/res_partner_department_view.xml @@ -0,0 +1,44 @@ + + + + + + + Departments + res.partner.department + form + tree + + + + CRM department tree + res.partner.department + + + + + + + + + + CRM department form + res.partner.department + +
+ + + + + +
+
+
+ + + +
diff --git a/partner_contact_department/views/res_partner_view.xml b/partner_contact_department/views/res_partner_view.xml new file mode 100644 index 000000000..e97e209a8 --- /dev/null +++ b/partner_contact_department/views/res_partner_view.xml @@ -0,0 +1,47 @@ + + + + + + + Partner form with department + res.partner + + + + + + + + + + + + + + Partner search with department + res.partner + + + + + + + + + + + +