Stephan Keller
5 years ago
committed by
Surachet Saejueng
10 changed files with 176 additions and 125 deletions
-
7partner_industry_secondary/__manifest__.py
-
2partner_industry_secondary/migrations/12.0.1.0.0/post-migration.py
-
12partner_industry_secondary/models/res_config_settings.py
-
21partner_industry_secondary/models/res_partner.py
-
20partner_industry_secondary/models/res_partner_industry.py
-
4partner_industry_secondary/security/partner_industry_security.xml
-
30partner_industry_secondary/tests/test_res_partner_industry.py
-
60partner_industry_secondary/views/res_config_settings.xml
-
13partner_industry_secondary/views/res_partner_industry_view.xml
-
132partner_industry_secondary/views/res_partner_view.xml
@ -1,7 +1,7 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
|
<?xml version="1.0" encoding="utf-8" ?> |
||||
<odoo> |
<odoo> |
||||
<record id="group_use_partner_industry_for_person" model="res.groups"> |
<record id="group_use_partner_industry_for_person" model="res.groups"> |
||||
<field name="name">Use industry for individuals</field> |
<field name="name">Use industry for individuals</field> |
||||
<field name="category_id" ref="base.module_category_hidden"/> |
|
||||
|
<field name="category_id" ref="base.module_category_hidden" /> |
||||
</record> |
</record> |
||||
</odoo> |
</odoo> |
@ -1,35 +1,45 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
|
<?xml version="1.0" encoding="utf-8" ?> |
||||
<!-- Copyright 2018 Eficent Business and IT Consulting Services, S.L. |
<!-- Copyright 2018 Eficent Business and IT Consulting Services, S.L. |
||||
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). --> |
||||
<odoo> |
<odoo> |
||||
|
|
||||
<record id="res_config_settings_view_form" model="ir.ui.view"> |
|
||||
<field name="name">res.config.settings.view.form</field> |
|
||||
<field name="model">res.config.settings</field> |
|
||||
<field name="inherit_id" ref="base_setup.res_config_settings_view_form"/> |
|
||||
<field name="arch" type="xml"> |
|
||||
<xpath expr="//div[@name='multi_company']" position="after"> |
|
||||
<h2>Partner Industries</h2> |
|
||||
<div class="row mt16 o_settings_container" name="partner_industries"> |
|
||||
<div class="col-xs-12 col-md-6 o_setting_box"> |
|
||||
<div class="o_setting_left_pane"> |
|
||||
<field name="group_use_partner_industry_for_person"/> |
|
||||
</div> |
|
||||
<div class="o_setting_right_pane"> |
|
||||
<label string="Industry for individual" for="group_use_partner_industry_for_person"/> |
|
||||
<div class="text-muted"> |
|
||||
|
<record id="res_config_settings_view_form" model="ir.ui.view"> |
||||
|
<field name="name">res.config.settings.view.form</field> |
||||
|
<field name="model">res.config.settings</field> |
||||
|
<field name="inherit_id" ref="base_setup.res_config_settings_view_form" /> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//div[@name='multi_company']" position="after"> |
||||
|
<h2>Partner Industries</h2> |
||||
|
<div class="row mt16 o_settings_container" name="partner_industries"> |
||||
|
<div class="col-xs-12 col-md-6 o_setting_box"> |
||||
|
<div class="o_setting_left_pane"> |
||||
|
<field name="group_use_partner_industry_for_person" /> |
||||
|
</div> |
||||
|
<div class="o_setting_right_pane"> |
||||
|
<label |
||||
|
string="Industry for individual" |
||||
|
for="group_use_partner_industry_for_person" |
||||
|
/> |
||||
|
<div class="text-muted"> |
||||
Enable industries for individuals |
Enable industries for individuals |
||||
</div> |
</div> |
||||
<div class="content-group"> |
|
||||
<div class="mt16" attrs="{'invisible': [('group_use_partner_industry_for_person', '=', False)]}"> |
|
||||
<button name="%(base.res_partner_industry_action)d" icon="fa-arrow-right" type="action" string="Industries" class="btn-link"/> |
|
||||
</div> |
|
||||
|
<div class="content-group"> |
||||
|
<div |
||||
|
class="mt16" |
||||
|
attrs="{'invisible': [('group_use_partner_industry_for_person', '=', False)]}" |
||||
|
> |
||||
|
<button |
||||
|
name="%(base.res_partner_industry_action)d" |
||||
|
icon="fa-arrow-right" |
||||
|
type="action" |
||||
|
string="Industries" |
||||
|
class="btn-link" |
||||
|
/> |
||||
</div> |
</div> |
||||
</div> |
</div> |
||||
</div> |
</div> |
||||
</div> |
</div> |
||||
</xpath> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
|
</div> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
</odoo> |
</odoo> |
@ -1,29 +1,26 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
|
<?xml version="1.0" encoding="utf-8" ?> |
||||
<!-- Copyright 2015 Antiun Ingenieria S.L. - Javier Iniesta |
<!-- Copyright 2015 Antiun Ingenieria S.L. - Javier Iniesta |
||||
Copyright 2018 Eficent Business and IT Consulting Services, S.L. |
Copyright 2018 Eficent Business and IT Consulting Services, S.L. |
||||
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). --> |
||||
<odoo> |
<odoo> |
||||
|
|
||||
<record id="res_partner_industry_view_form" model="ir.ui.view"> |
<record id="res_partner_industry_view_form" model="ir.ui.view"> |
||||
<field name="name">Industry</field> |
<field name="name">Industry</field> |
||||
<field name="model">res.partner.industry</field> |
<field name="model">res.partner.industry</field> |
||||
<field name="inherit_id" ref="base.res_partner_industry_view_form"/> |
|
||||
|
<field name="inherit_id" ref="base.res_partner_industry_view_form" /> |
||||
<field name="arch" type="xml"> |
<field name="arch" type="xml"> |
||||
<field name="full_name" position="after"> |
<field name="full_name" position="after"> |
||||
<field name="parent_id"/> |
|
||||
|
<field name="parent_id" /> |
||||
</field> |
</field> |
||||
</field> |
</field> |
||||
</record> |
</record> |
||||
|
|
||||
<record id="res_partner_industry_view_tree" model="ir.ui.view"> |
<record id="res_partner_industry_view_tree" model="ir.ui.view"> |
||||
<field name="name">Industry</field> |
<field name="name">Industry</field> |
||||
<field name="model">res.partner.industry</field> |
<field name="model">res.partner.industry</field> |
||||
<field name="inherit_id" ref="base.res_partner_industry_view_tree"/> |
|
||||
|
<field name="inherit_id" ref="base.res_partner_industry_view_tree" /> |
||||
<field name="arch" type="xml"> |
<field name="arch" type="xml"> |
||||
<field name="name" position="after"> |
<field name="name" position="after"> |
||||
<field name="parent_id"/> |
|
||||
|
<field name="parent_id" /> |
||||
</field> |
</field> |
||||
</field> |
</field> |
||||
</record> |
</record> |
||||
|
|
||||
</odoo> |
</odoo> |
@ -1,115 +1,157 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
|
<?xml version="1.0" encoding="utf-8" ?> |
||||
<!-- Copyright 2015 Antiun Ingenieria S.L. - Javier Iniesta |
<!-- Copyright 2015 Antiun Ingenieria S.L. - Javier Iniesta |
||||
Copyright 2018 Eficent Business and IT Consulting Services, S.L. - Jordi Ballester |
Copyright 2018 Eficent Business and IT Consulting Services, S.L. - Jordi Ballester |
||||
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). --> |
||||
<odoo> |
<odoo> |
||||
|
|
||||
<record model="ir.ui.view" id="view_partner_form_industry"> |
<record model="ir.ui.view" id="view_partner_form_industry"> |
||||
<field name="name">Partner form with industry</field> |
<field name="name">Partner form with industry</field> |
||||
<field name="model">res.partner</field> |
<field name="model">res.partner</field> |
||||
<field name="inherit_id" ref="base.view_partner_form"/> |
|
||||
|
<field name="inherit_id" ref="base.view_partner_form" /> |
||||
<field name="arch" type="xml"> |
<field name="arch" type="xml"> |
||||
<field name="industry_id" position="after"> |
<field name="industry_id" position="after"> |
||||
<field name="secondary_industry_ids" widget="many2many_tags" |
|
||||
attrs="{'invisible': [('is_company', '=', False)]}"/> |
|
||||
|
<field |
||||
|
name="secondary_industry_ids" |
||||
|
widget="many2many_tags" |
||||
|
attrs="{'invisible': [('is_company', '=', False)]}" |
||||
|
/> |
||||
</field> |
</field> |
||||
<xpath expr="//field[@name='child_ids']/form//field[@name='title']" position="after"> |
|
||||
<field name="is_company" invisible="1"/> |
|
||||
<field name="industry_id" placeholder="Sector" |
|
||||
options='{"no_open": True}' |
|
||||
attrs="{'invisible': [('is_company', '=', False)]}"/> |
|
||||
<field name="secondary_industry_ids" widget="many2many_tags" |
|
||||
attrs="{'invisible': [('is_company', '=', False)]}"/> |
|
||||
|
<xpath |
||||
|
expr="//field[@name='child_ids']/form//field[@name='title']" |
||||
|
position="after" |
||||
|
> |
||||
|
<field name="is_company" invisible="1" /> |
||||
|
<field |
||||
|
name="industry_id" |
||||
|
placeholder="Sector" |
||||
|
options='{"no_open": True}' |
||||
|
attrs="{'invisible': [('is_company', '=', False)]}" |
||||
|
/> |
||||
|
<field |
||||
|
name="secondary_industry_ids" |
||||
|
widget="many2many_tags" |
||||
|
attrs="{'invisible': [('is_company', '=', False)]}" |
||||
|
/> |
||||
</xpath> |
</xpath> |
||||
</field> |
</field> |
||||
</record> |
</record> |
||||
|
|
||||
<record model="ir.ui.view" id="view_partner_tree_industry"> |
<record model="ir.ui.view" id="view_partner_tree_industry"> |
||||
<field name="name">Partner tree with industry</field> |
<field name="name">Partner tree with industry</field> |
||||
<field name="model">res.partner</field> |
<field name="model">res.partner</field> |
||||
<field name="inherit_id" ref="base.view_partner_tree"/> |
|
||||
|
<field name="inherit_id" ref="base.view_partner_tree" /> |
||||
<field name="arch" type="xml"> |
<field name="arch" type="xml"> |
||||
<field name="email" position="after"> |
<field name="email" position="after"> |
||||
<field name="industry_id" |
|
||||
attrs="{'invisible': [('is_company', '=', False)]}"/> |
|
||||
|
<field |
||||
|
name="industry_id" |
||||
|
attrs="{'invisible': [('is_company', '=', False)]}" |
||||
|
/> |
||||
</field> |
</field> |
||||
</field> |
</field> |
||||
</record> |
</record> |
||||
|
|
||||
<record model="ir.ui.view" id="view_res_partner_filter_industry"> |
<record model="ir.ui.view" id="view_res_partner_filter_industry"> |
||||
<field name="name">Partner search with industry</field> |
<field name="name">Partner search with industry</field> |
||||
<field name="model">res.partner</field> |
<field name="model">res.partner</field> |
||||
<field name="inherit_id" ref="base.view_res_partner_filter"/> |
|
||||
|
<field name="inherit_id" ref="base.view_res_partner_filter" /> |
||||
<field name="arch" type="xml"> |
<field name="arch" type="xml"> |
||||
<field name="category_id" position="after"> |
<field name="category_id" position="after"> |
||||
<field name="industry_id" |
|
||||
string="Industry" |
|
||||
filter_domain="['|',('industry_id','ilike',self), |
|
||||
('secondary_industry_ids.name','ilike',self)]"/> |
|
||||
|
<field |
||||
|
name="industry_id" |
||||
|
string="Industry" |
||||
|
filter_domain="['|',('industry_id','ilike',self), |
||||
|
('secondary_industry_ids.name','ilike',self)]" |
||||
|
/> |
||||
</field> |
</field> |
||||
<filter name="salesperson" position="after"> |
<filter name="salesperson" position="after"> |
||||
<filter name="industry" |
|
||||
string="Industry" |
|
||||
domain="[('is_company','=', True)]" |
|
||||
context="{'group_by': 'industry_id'}"/> |
|
||||
|
<filter |
||||
|
name="industry" |
||||
|
string="Industry" |
||||
|
domain="[('is_company','=', True)]" |
||||
|
context="{'group_by': 'industry_id'}" |
||||
|
/> |
||||
</filter> |
</filter> |
||||
</field> |
</field> |
||||
</record> |
</record> |
||||
|
|
||||
<!-- Views activated for group_use_partner_industry_for_person --> |
<!-- Views activated for group_use_partner_industry_for_person --> |
||||
|
|
||||
<record model="ir.ui.view" id="view_partner_form_industry_person0"> |
<record model="ir.ui.view" id="view_partner_form_industry_person0"> |
||||
<field name="name">Partner form with industry</field> |
<field name="name">Partner form with industry</field> |
||||
<field name="model">res.partner</field> |
<field name="model">res.partner</field> |
||||
<field name="inherit_id" ref="base.view_partner_form"/> |
|
||||
<field name="groups_id" eval="[(4, ref('partner_industry_secondary.group_use_partner_industry_for_person'))]"/> |
|
||||
|
<field name="inherit_id" ref="base.view_partner_form" /> |
||||
|
<field |
||||
|
name="groups_id" |
||||
|
eval="[(4, ref('partner_industry_secondary.group_use_partner_industry_for_person'))]" |
||||
|
/> |
||||
<field name="arch" type="xml"> |
<field name="arch" type="xml"> |
||||
<xpath expr="//page/group/group/field[@name='industry_id']" position="attributes"> |
|
||||
|
<xpath |
||||
|
expr="//page/group/group/field[@name='industry_id']" |
||||
|
position="attributes" |
||||
|
> |
||||
<attribute name="attrs">{'invisible': 0}</attribute> |
<attribute name="attrs">{'invisible': 0}</attribute> |
||||
</xpath> |
</xpath> |
||||
</field> |
</field> |
||||
</record> |
</record> |
||||
|
|
||||
<record model="ir.ui.view" id="view_partner_form_industry_person"> |
<record model="ir.ui.view" id="view_partner_form_industry_person"> |
||||
<field name="name">Partner form with industry</field> |
<field name="name">Partner form with industry</field> |
||||
<field name="model">res.partner</field> |
<field name="model">res.partner</field> |
||||
<field name="inherit_id" ref="partner_industry_secondary.view_partner_form_industry"/> |
|
||||
<field name="groups_id" eval="[(4, ref('partner_industry_secondary.group_use_partner_industry_for_person'))]"/> |
|
||||
|
<field |
||||
|
name="inherit_id" |
||||
|
ref="partner_industry_secondary.view_partner_form_industry" |
||||
|
/> |
||||
|
<field |
||||
|
name="groups_id" |
||||
|
eval="[(4, ref('partner_industry_secondary.group_use_partner_industry_for_person'))]" |
||||
|
/> |
||||
<field name="arch" type="xml"> |
<field name="arch" type="xml"> |
||||
<xpath expr="//page/group/group/field[@name='secondary_industry_ids']" position="attributes"> |
|
||||
|
<xpath |
||||
|
expr="//page/group/group/field[@name='secondary_industry_ids']" |
||||
|
position="attributes" |
||||
|
> |
||||
<attribute name="attrs">{'invisible': 0}</attribute> |
<attribute name="attrs">{'invisible': 0}</attribute> |
||||
</xpath> |
</xpath> |
||||
<xpath expr="//field[@name='child_ids']/form//field[@name='industry_id']" position="attributes"> |
|
||||
|
<xpath |
||||
|
expr="//field[@name='child_ids']/form//field[@name='industry_id']" |
||||
|
position="attributes" |
||||
|
> |
||||
<attribute name="attrs">{'invisible': 0}</attribute> |
<attribute name="attrs">{'invisible': 0}</attribute> |
||||
</xpath> |
</xpath> |
||||
<xpath expr="//field[@name='child_ids']/form//field[@name='secondary_industry_ids']" position="attributes"> |
|
||||
|
<xpath |
||||
|
expr="//field[@name='child_ids']/form//field[@name='secondary_industry_ids']" |
||||
|
position="attributes" |
||||
|
> |
||||
<attribute name="attrs">{'invisible': 0}</attribute> |
<attribute name="attrs">{'invisible': 0}</attribute> |
||||
</xpath> |
</xpath> |
||||
</field> |
</field> |
||||
</record> |
</record> |
||||
|
|
||||
<record model="ir.ui.view" id="view_partner_tree_industry_person"> |
<record model="ir.ui.view" id="view_partner_tree_industry_person"> |
||||
<field name="name">Partner tree with industry</field> |
<field name="name">Partner tree with industry</field> |
||||
<field name="model">res.partner</field> |
<field name="model">res.partner</field> |
||||
<field name="inherit_id" ref="partner_industry_secondary.view_partner_tree_industry"/> |
|
||||
<field name="groups_id" eval="[(4, ref('partner_industry_secondary.group_use_partner_industry_for_person'))]"/> |
|
||||
|
<field |
||||
|
name="inherit_id" |
||||
|
ref="partner_industry_secondary.view_partner_tree_industry" |
||||
|
/> |
||||
|
<field |
||||
|
name="groups_id" |
||||
|
eval="[(4, ref('partner_industry_secondary.group_use_partner_industry_for_person'))]" |
||||
|
/> |
||||
<field name="arch" type="xml"> |
<field name="arch" type="xml"> |
||||
<field name="industry_id" position="attributes"> |
<field name="industry_id" position="attributes"> |
||||
<attribute name="attrs">{'invisible': 0}</attribute> |
<attribute name="attrs">{'invisible': 0}</attribute> |
||||
</field> |
</field> |
||||
</field> |
</field> |
||||
</record> |
</record> |
||||
|
|
||||
<record model="ir.ui.view" id="view_res_partner_filter_industry_person"> |
<record model="ir.ui.view" id="view_res_partner_filter_industry_person"> |
||||
<field name="name">Partner search with industry</field> |
<field name="name">Partner search with industry</field> |
||||
<field name="model">res.partner</field> |
<field name="model">res.partner</field> |
||||
<field name="inherit_id" ref="partner_industry_secondary.view_res_partner_filter_industry"/> |
|
||||
<field name="groups_id" eval="[(4, ref('partner_industry_secondary.group_use_partner_industry_for_person'))]"/> |
|
||||
|
<field |
||||
|
name="inherit_id" |
||||
|
ref="partner_industry_secondary.view_res_partner_filter_industry" |
||||
|
/> |
||||
|
<field |
||||
|
name="groups_id" |
||||
|
eval="[(4, ref('partner_industry_secondary.group_use_partner_industry_for_person'))]" |
||||
|
/> |
||||
<field name="arch" type="xml"> |
<field name="arch" type="xml"> |
||||
<filter name="industry" position="attributes"> |
<filter name="industry" position="attributes"> |
||||
<attribute name="domain"/> |
|
||||
|
<attribute name="domain" /> |
||||
</filter> |
</filter> |
||||
</field> |
</field> |
||||
</record> |
</record> |
||||
|
|
||||
</odoo> |
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue