Browse Source
[MIG] partner_contact_job_position
[MIG] partner_contact_job_position
* Changed icon * Change author and web * Check recursionpull/328/head
cubells
8 years ago
committed by
Pedro M. Baeza
10 changed files with 125 additions and 102 deletions
-
11partner_contact_job_position/README.rst
-
7partner_contact_job_position/__init__.py
-
14partner_contact_job_position/__openerp__.py
-
7partner_contact_job_position/models/__init__.py
-
16partner_contact_job_position/models/res_partner.py
-
BINpartner_contact_job_position/static/description/icon.png
-
5partner_contact_job_position/tests/__init__.py
-
30partner_contact_job_position/tests/test_recursion.py
-
68partner_contact_job_position/views/res_partner_job_position_view.xml
-
69partner_contact_job_position/views/res_partner_view.xml
@ -1,9 +1,6 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- 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 |
|
||||
|
# © 2014-2016 Tecnativa S.L. - Jairo Llopis |
||||
|
# © 2016 Tecnativa S.L. - Vicent Cubells |
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
from . import models |
from . import models |
@ -1,9 +1,6 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- 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 |
|
||||
|
# © 2014-2016 Tecnativa S.L. - Jairo Llopis |
||||
|
# © 2016 Tecnativa S.L. - Vicent Cubells |
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
from . import res_partner |
from . import res_partner |
Before Width: 128 | Height: 128 | Size: 22 KiB After Width: 128 | Height: 128 | Size: 11 KiB |
@ -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 |
@ -0,0 +1,30 @@ |
|||||
|
# -*- 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.job_obj = cls.env['res.partner.job_position'] |
||||
|
|
||||
|
# Instances |
||||
|
cls.grand_parent = cls.job_obj.create(vals=dict(name='Grand parent')) |
||||
|
cls.parent = cls.job_obj.create(vals=dict( |
||||
|
name='Parent', |
||||
|
parent_id=cls.grand_parent.id |
||||
|
)) |
||||
|
|
||||
|
def test_recursion(self): |
||||
|
""" Testing recursion """ |
||||
|
self.child = self.job_obj.create(vals=dict( |
||||
|
name='Grand parent', |
||||
|
parent_id=self.parent.id |
||||
|
)) |
||||
|
# Creating a parent's child using grand-parent |
||||
|
with self.assertRaises(ValidationError): |
||||
|
self.grand_parent.write(vals={'parent_id': self.child.id}) |
@ -1,42 +1,40 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||
<openerp> |
|
||||
<data> |
|
||||
|
<odoo> |
||||
|
|
||||
<record id="res_partner_job_position_action" model="ir.actions.act_window"> |
|
||||
<field name="name">Job Positions</field> |
|
||||
<field name="res_model">res.partner.job_position</field> |
|
||||
<field name="view_type">form</field> |
|
||||
<field name="view_mode">tree</field> |
|
||||
</record> |
|
||||
|
<record id="res_partner_job_position_action" model="ir.actions.act_window"> |
||||
|
<field name="name">Job Positions</field> |
||||
|
<field name="res_model">res.partner.job_position</field> |
||||
|
<field name="view_type">form</field> |
||||
|
<field name="view_mode">tree</field> |
||||
|
</record> |
||||
|
|
||||
<record id="res_partner_job_position_tree_view" model="ir.ui.view"> |
|
||||
<field name="name">Job position tree</field> |
|
||||
<field name="model">res.partner.job_position</field> |
|
||||
<field name="arch" type="xml"> |
|
||||
<tree string="Job positions" editable="top"> |
|
||||
<field name="name"/> |
|
||||
<field name="parent_id"/> |
|
||||
</tree> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
<record id="res_partner_job_position_form_view" model="ir.ui.view"> |
|
||||
<field name="name">Job position form</field> |
|
||||
<field name="model">res.partner.job_position</field> |
|
||||
<field name="arch" type="xml"> |
|
||||
<form string="Job positions"> |
|
||||
<group> |
|
||||
|
<record id="res_partner_job_position_tree_view" model="ir.ui.view"> |
||||
|
<field name="name">Job position tree</field> |
||||
|
<field name="model">res.partner.job_position</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<tree string="Job positions" editable="top"> |
||||
<field name="name"/> |
<field name="name"/> |
||||
<field name="parent_id"/> |
<field name="parent_id"/> |
||||
<field name="child_ids"/> |
|
||||
</group> |
|
||||
</form> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
</tree> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
<record id="res_partner_job_position_form_view" model="ir.ui.view"> |
||||
|
<field name="name">Job position form</field> |
||||
|
<field name="model">res.partner.job_position</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<form string="Job positions"> |
||||
|
<group> |
||||
|
<field name="name"/> |
||||
|
<field name="parent_id"/> |
||||
|
<field name="child_ids"/> |
||||
|
</group> |
||||
|
</form> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
<menuitem action="res_partner_job_position_action" |
|
||||
id="menu_res_partner_job_position" |
|
||||
parent="base.menu_config_address_book"/> |
|
||||
|
<menuitem action="res_partner_job_position_action" |
||||
|
id="menu_res_partner_job_position" |
||||
|
parent="base.menu_config_address_book"/> |
||||
|
|
||||
</data> |
|
||||
</openerp> |
|
||||
|
</odoo> |
@ -1,41 +1,40 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||
<openerp> |
|
||||
<data> |
|
||||
|
<odoo> |
||||
|
|
||||
<record model="ir.ui.view" id="view_partner_form_job_position"> |
|
||||
<field name="name">Partner form with job position</field> |
|
||||
<field name="model">res.partner</field> |
|
||||
<field name="inherit_id" ref="base.view_partner_form"/> |
|
||||
<field name="arch" type="xml"> |
|
||||
<field name="function" position="before"> |
|
||||
<field name="job_position_id" |
|
||||
attrs="{'invisible': [('is_company','=', True)]}" |
|
||||
options='{"no_open": True}'/> |
|
||||
|
<record model="ir.ui.view" id="view_partner_form_job_position"> |
||||
|
<field name="name">Partner form with job position</field> |
||||
|
<field name="model">res.partner</field> |
||||
|
<field name="inherit_id" ref="base.view_partner_form"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<field name="function" position="before"> |
||||
|
<field name="job_position_id" |
||||
|
attrs="{'invisible': [('is_company','=', True)]}" |
||||
|
options='{"no_open": True}'/> |
||||
|
</field> |
||||
|
<xpath expr="//field[@name='child_ids']/form//field[@name='function']" |
||||
|
position="before"> |
||||
|
<field name="job_position_id" |
||||
|
attrs="{'invisible': [('is_company','=', True)]}" |
||||
|
options='{"no_open": True}'/> |
||||
|
</xpath> |
||||
</field> |
</field> |
||||
<xpath expr="//field[@name='child_ids']/form//field[@name='function']" |
|
||||
position="before"> |
|
||||
<field name="job_position_id" |
|
||||
attrs="{'invisible': [('is_company','=', True)]}" |
|
||||
options='{"no_open": True}'/> |
|
||||
</xpath> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
</record> |
||||
|
|
||||
<record model="ir.ui.view" id="view_res_partner_filter_job_position"> |
|
||||
<field name="name">Partner search with job position</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="job_position_id"/> |
|
||||
|
<record model="ir.ui.view" id="view_res_partner_filter_job_position"> |
||||
|
<field name="name">Partner search with job position</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="job_position_id"/> |
||||
|
</field> |
||||
|
<filter name="salesperson" position="after"> |
||||
|
<filter name="job_position" |
||||
|
string="Job position" |
||||
|
domain="[('is_company','=', True)]" |
||||
|
context="{'group_by': 'job_position_id'}"/> |
||||
|
</filter> |
||||
</field> |
</field> |
||||
<filter string="Salesperson" position="after"> |
|
||||
<filter string="Job position" |
|
||||
domain="[('is_company','=', True)]" |
|
||||
context="{'group_by': 'job_position_id'}"/> |
|
||||
</filter> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
</record> |
||||
|
|
||||
</data> |
|
||||
</openerp> |
|
||||
|
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue