Browse Source

[ADD] partner_industry : manage industry sector on the partner

pull/218/head
Jacques-Etienne Baudoux 10 years ago
parent
commit
c8f29fbfe0
  1. 25
      partner_industry/README.rst
  2. 7
      partner_industry/__init__.py
  3. 39
      partner_industry/__openerp__.py
  4. 2
      partner_industry/model/__init__.py
  5. 36
      partner_industry/model/industry.py
  6. 32
      partner_industry/model/partner.py
  7. 54
      partner_industry/view/industry.xml
  8. 16
      partner_industry/view/partner.xml

25
partner_industry/README.rst

@ -0,0 +1,25 @@
Segmentation of partner and lead by commercial zone
===================================================
This addon adds an industry sector object and a field 'Industry sectors' after the tags on the partner form view.
Credits
=======
Contributors
------------
* Jacques-Etienne Baudoux <je@bcim.be> (BCIM sprl)
Maintainer
----------
.. image:: http://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: http://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 http://odoo-community.org.

7
partner_industry/__init__.py

@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
#
# License, author and contributors information in:
# __openerp__.py file at the root folder of this module.
#
from . import model

39
partner_industry/__openerp__.py

@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Jacques-Etienne Baudoux <je@bcim.be>
# Copyright 2015 BCIM sprl
#
# 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/>.
#
##############################################################################
{
'name': 'Partner Industry Sector',
'version': '1.0',
'author': "BCIM,Odoo Community Association (OCA)",
'maintainer': 'BCIM',
'category': 'Sales Management',
'complexity': 'easy',
'depends': ['base'],
'website': 'http://www.bcim.be',
'data': [
'view/industry.xml',
'view/partner.xml',
],
'installable': True,
'auto_install': False,
'license': 'AGPL-3',
'application': False,
}

2
partner_industry/model/__init__.py

@ -0,0 +1,2 @@
from . import industry
from . import partner

36
partner_industry/model/industry.py

@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Jacques-Etienne Baudoux <je@bcim.be>
# Copyright 2015 BCIM sprl
#
# 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/>.
#
##############################################################################
from openerp.osv import fields, orm
class Industry(orm.Model):
_name = 'res.partner.category.industry'
_inherit = 'res.partner.category'
_columns = {
'code': fields.char('Code', size=16),
'parent_id': fields.many2one(_name, 'Parent Category', select=True, ondelete='cascade'),
'partner_ids': fields.many2many(
'res.partner',
'res_partner_industry_rel', 'industry_id', 'partner_id',
'Partners'),
}

32
partner_industry/model/partner.py

@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Jacques-Etienne Baudoux <je@bcim.be>
# Copyright 2015 BCIM sprl
#
# 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/>.
#
##############################################################################
from openerp.osv import fields, orm
class res_partner(orm.Model):
_inherit = 'res.partner'
_columns = {
'industry_ids': fields.many2many(
'res.partner.category.industry',
'res_partner_industry_rel', 'partner_id', 'industry_id',
'Industries'),
}

54
partner_industry/view/industry.xml

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="view_crm_industry_form">
<field name="name">Industry</field>
<field name="model">res.partner.category.industry</field>
<field name="arch" type="xml">
<form string="Industry Sector" version="7.0">
<sheet>
<label for="name" class="oe_edit_only" />
<h1>
<field name="name" />
</h1>
<group>
<group>
<field name="code" />
<field name="active" />
</group>
<group>
<field name="parent_id" />
</group>
</group>
</sheet>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_crm_industry_tree">
<field name="name">Industry</field>
<field name="model">res.partner.category.industry</field>
<field name="arch" type="xml">
<tree string="Industry Sectors">
<field name="complete_name" />
<field name="code" />
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_crm_industry">
<field name="name">Industry Sectors</field>
<field name="res_model">res.partner.category.industry</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_crm_industry_tree" />
</record>
<menuitem id="menu_crm_config_industry" name="Industry Sectors"
parent="base.menu_config_address_book" action="action_crm_industry"
sequence="20" groups="base.group_no_one" />
</data>
</openerp>

16
partner_industry/view/partner.xml

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_partner_form" model="ir.ui.view">
<field name="name">res.partner.form.industry</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<field name="category_id" position="after">
<field name="industry_ids" widget="many2many_tags" placeholder="Industry Sectors.."
attrs="{'invisible':[('is_company','=', False)]}"/>
</field>
</field>
</record>
</data>
</openerp>
Loading…
Cancel
Save