Browse Source

[add] partner_contact_role

pull/524/head
Simone Orsi 7 years ago
parent
commit
c0b7cbc9b3
  1. 71
      partner_contact_role/README.rst
  2. 1
      partner_contact_role/__init__.py
  3. 22
      partner_contact_role/__manifest__.py
  4. 1
      partner_contact_role/models/__init__.py
  5. 22
      partner_contact_role/models/res_partner.py
  6. 5
      partner_contact_role/security/ir.model.access.csv
  7. BIN
      partner_contact_role/static/description/icon.png
  8. 18
      partner_contact_role/views/res_partner.xml
  9. 36
      partner_contact_role/views/res_partner_role.xml

71
partner_contact_role/README.rst

@ -0,0 +1,71 @@
.. 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
====================
Partner Contact Role
====================
This module extends the functionality of partners to add roles.
Each partner can have a job position / function but can be assigned
to several roles / responsibilities for his/her duty.
Configuration
=============
To configure roles, you need to:
* Go to *Sales > Configuration > Address Book > Partner Roles*.
Usage
=====
To use this module, you need to:
* Go to any partner's form.
* Use the new *Roles* field.
.. 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/10.0
.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt
.. branch is "8.0" for example
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 smash it by providing 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
------------
* Simone Orsi <simone.orsi@camptocamp.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.

1
partner_contact_role/__init__.py

@ -0,0 +1 @@
from . import models

22
partner_contact_role/__manifest__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Camptocamp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Partner Contact Role',
'summary': """Add roles to partners.""",
'version': '10.0.1.0.0',
'license': 'AGPL-3',
'author': 'Camptocamp,Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/partner-contact',
'depends': [
'sales_team',
],
'data': [
'security/ir.model.access.csv',
'views/res_partner_role.xml',
'views/res_partner.xml',
],
'demo': [
],
}

1
partner_contact_role/models/__init__.py

@ -0,0 +1 @@
from . import res_partner

22
partner_contact_role/models/res_partner.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Camptocamp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class ResPartner(models.Model):
_inherit = 'res.partner'
role_ids = fields.Many2many(
string='Roles',
comodel_name='res.partner.role',
)
class ResPartnerRole(models.Model):
_name = 'res.partner.role'
_description = 'Partner Role'
name = fields.Char()

5
partner_contact_role/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_role_public,res_partner_role group_public,model_res_partner_role,base.group_public,1,0,0,0
access_res_partner_role_portal,res_partner_role group_portal,model_res_partner_role,base.group_portal,1,0,0,0
access_res_partner_role_group_partner_manager,res_partner_role group_partner_manager,model_res_partner_role,base.group_partner_manager,1,1,1,1
access_res_partner_role_group_user,res_partner_role group_user,model_res_partner_role,base.group_user,1,0,0,0

BIN
partner_contact_role/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

18
partner_contact_role/views/res_partner.xml

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 Camptocamp
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record model="ir.ui.view" id="view_partner_form_role">
<field name="name">Partner form with roles</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="after">
<field name="role_ids" widget="many2many_tags" attrs="{'invisible': [('is_company','=', True)]}" />
</field>
</field>
</record>
</odoo>

36
partner_contact_role/views/res_partner_role.xml

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 Camptocamp
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record model="ir.ui.view" id="res_partner_role_form_view">
<field name="name">res.partner.role.form</field>
<field name="model">res.partner.role</field>
<field name="arch" type="xml">
<form>
<sheet>
<group name="main">
<field name="name"/>
</group>
</sheet>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="res_partner_role_act_window">
<field name="name">Partner Role</field>
<field name="res_model">res.partner.role</field>
<field name="view_mode">tree,form</field>
<field name="domain">[]</field>
<field name="context">{}</field>
</record>
<record model="ir.ui.menu" id="res_partner_role_menu">
<field name="name">Partner Roles</field>
<field name="parent_id" ref="sales_team.menu_config_address_book"/>
<field name="action" ref="res_partner_role_act_window"/>
<field name="sequence" eval="16"/>
</record>
</odoo>
Loading…
Cancel
Save