Browse Source

[ADD] crm_employees addon

pull/225/head
Antonio Espinosa 10 years ago
committed by Jairo Llopis
parent
commit
109082ae03
  1. 13
      crm_employees/README.rst
  2. 6
      crm_employees/__init__.py
  3. 39
      crm_employees/__openerp__.py
  4. 97
      crm_employees/i18n/crm_employees.pot
  5. 97
      crm_employees/i18n/es.po
  6. 8
      crm_employees/models/__init__.py
  7. 20
      crm_employees/models/crm_employees_range.py
  8. 26
      crm_employees/models/crm_lead.py
  9. 12
      crm_employees/models/res_partner.py
  10. 5
      crm_employees/security/ir.model.access.csv
  11. BIN
      crm_employees/static/description/icon.png
  12. 30
      crm_employees/views/crm_employees_range_view.xml
  13. 30
      crm_employees/views/crm_lead_view.xml
  14. 20
      crm_employees/views/res_partner_view.xml

13
crm_employees/README.rst

@ -0,0 +1,13 @@
Employees in CRM
================
This module allows to set employees amount and employees ranges for companies
in the CRM main objects (lead, opportunity, partner), and propagate them through
the workflow.
Credits
=======
Contributors
------------
* Antonio Espinosa <antonioea@antiun.com>

6
crm_employees/__init__.py

@ -0,0 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from . import models

39
crm_employees/__openerp__.py

@ -0,0 +1,39 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Odoo Source Management Solution
# Copyright (c) 2015 Antiun Ingeniería S.L. (http://www.antiun.com)
# Antonio Espinosa <antonioea@antiun.com>
#
# 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': 'Employees in CRM',
'version': '1.0',
'category': 'Customer Relationship Management',
'author': 'Antiun Ingeniería S.L.',
'website': 'http://www.antiun.com',
'depends': [
'crm',
],
'data': [
'views/crm_employees_range_view.xml',
'views/crm_lead_view.xml',
'views/res_partner_view.xml',
'security/ir.model.access.csv',
],
"installable": True,
}

97
crm_employees/i18n/crm_employees.pot

@ -0,0 +1,97 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_employees
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-03-24 11:53+0000\n"
"PO-Revision-Date: 2015-03-24 11:53+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: crm_employees
#: field:crm.employees_range,children:0
msgid "Children"
msgstr ""
#. module: crm_employees
#: field:crm.employees_range,create_uid:0
msgid "Created by"
msgstr ""
#. module: crm_employees
#: field:crm.employees_range,create_date:0
msgid "Created on"
msgstr ""
#. module: crm_employees
#: field:crm.lead,employees_number:0
#: field:res.partner,employees_number:0
msgid "Employees number"
msgstr ""
#. module: crm_employees
#: field:crm.lead,employees_range:0
#: model:ir.model,name:crm_employees.model_crm_employees_range
#: field:res.partner,employees_range:0
msgid "Employees range"
msgstr ""
#. module: crm_employees
#: view:crm.employees_range:crm_employees.crm_employees_range_tree_view
#: model:ir.actions.act_window,name:crm_employees.crm_employees_range_action
#: model:ir.ui.menu,name:crm_employees.menu_crm_employees_range
msgid "Employees ranges"
msgstr ""
#. module: crm_employees
#: field:crm.employees_range,id:0
msgid "ID"
msgstr ""
#. module: crm_employees
#: field:crm.employees_range,write_uid:0
msgid "Last Updated by"
msgstr ""
#. module: crm_employees
#: field:crm.employees_range,write_date:0
msgid "Last Updated on"
msgstr ""
#. module: crm_employees
#: model:ir.model,name:crm_employees.model_crm_lead
msgid "Lead/Opportunity"
msgstr ""
#. module: crm_employees
#: field:crm.employees_range,name:0
msgid "Name"
msgstr ""
#. module: crm_employees
#: field:crm.employees_range,parent_left:0
msgid "Parent Left"
msgstr ""
#. module: crm_employees
#: field:crm.employees_range,parent_right:0
msgid "Parent Right"
msgstr ""
#. module: crm_employees
#: field:crm.employees_range,parent_id:0
msgid "Parent id"
msgstr ""
#. module: crm_employees
#: model:ir.model,name:crm_employees.model_res_partner
msgid "Partner"
msgstr ""

97
crm_employees/i18n/es.po

@ -0,0 +1,97 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_employees
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-03-24 11:53+0000\n"
"PO-Revision-Date: 2015-03-24 11:53+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: crm_employees
#: field:crm.employees_range,children:0
msgid "Children"
msgstr "Hijos"
#. module: crm_employees
#: field:crm.employees_range,create_uid:0
msgid "Created by"
msgstr "Creado por"
#. module: crm_employees
#: field:crm.employees_range,create_date:0
msgid "Created on"
msgstr "Creado en"
#. module: crm_employees
#: field:crm.lead,employees_number:0
#: field:res.partner,employees_number:0
msgid "Employees number"
msgstr "Número de empleados"
#. module: crm_employees
#: field:crm.lead,employees_range:0
#: model:ir.model,name:crm_employees.model_crm_employees_range
#: field:res.partner,employees_range:0
msgid "Employees range"
msgstr "Rango de empleados"
#. module: crm_employees
#: view:crm.employees_range:crm_employees.crm_employees_range_tree_view
#: model:ir.actions.act_window,name:crm_employees.crm_employees_range_action
#: model:ir.ui.menu,name:crm_employees.menu_crm_employees_range
msgid "Employees ranges"
msgstr "Rangos de empleados"
#. module: crm_employees
#: field:crm.employees_range,id:0
msgid "ID"
msgstr "ID"
#. module: crm_employees
#: field:crm.employees_range,write_uid:0
msgid "Last Updated by"
msgstr "Última actualización por"
#. module: crm_employees
#: field:crm.employees_range,write_date:0
msgid "Last Updated on"
msgstr "Última actualización en"
#. module: crm_employees
#: model:ir.model,name:crm_employees.model_crm_lead
msgid "Lead/Opportunity"
msgstr "Iniciativa/Oportunidad"
#. module: crm_employees
#: field:crm.employees_range,name:0
msgid "Name"
msgstr "Nombre"
#. module: crm_employees
#: field:crm.employees_range,parent_left:0
msgid "Parent Left"
msgstr "Padre izquierdo"
#. module: crm_employees
#: field:crm.employees_range,parent_right:0
msgid "Parent Right"
msgstr "Padre derecho"
#. module: crm_employees
#: field:crm.employees_range,parent_id:0
msgid "Parent id"
msgstr "ID del padre"
#. module: crm_employees
#: model:ir.model,name:crm_employees.model_res_partner
msgid "Partner"
msgstr "Empresa"

8
crm_employees/models/__init__.py

@ -0,0 +1,8 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from . import crm_employees_range
from . import crm_lead
from . import res_partner

20
crm_employees/models/crm_employees_range.py

@ -0,0 +1,20 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, fields
class CrmEmployeesRange(models.Model):
_name = 'crm.employees_range'
_order = "parent_left"
_parent_order = "name"
_parent_store = True
_description = "Employees range"
name = fields.Char(required=True)
parent_id = fields.Many2one(comodel_name='crm.employees_range')
children = fields.One2many(comodel_name='crm.employees_range',
inverse_name='parent_id')
parent_left = fields.Integer('Parent Left', select=True)
parent_right = fields.Integer('Parent Right', select=True)

26
crm_employees/models/crm_lead.py

@ -0,0 +1,26 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, fields
class CrmLead(models.Model):
_inherit = 'crm.lead'
employees_range = fields.Many2one(comodel_name='crm.employees_range')
employees_number = fields.Integer()
def _lead_create_contact(self, cr, uid, lead, name, is_company,
parent_id=False, context=None):
"""Propagate employees_range and employees_number to created partner.
"""
partner_id = super(CrmLead, self)._lead_create_contact(
cr, uid, lead, name, is_company, parent_id=parent_id,
context=context)
self.pool['res.partner'].write(
cr, uid, partner_id, {
'employees_range': lead.employees_range.id,
'employees_number': lead.employees_number
}, context=context)
return partner_id

12
crm_employees/models/res_partner.py

@ -0,0 +1,12 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, fields
class ResPartner(models.Model):
_inherit = 'res.partner'
employees_range = fields.Many2one(comodel_name='crm.employees_range')
employees_number = fields.Integer()

5
crm_employees/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_crm_employees_public","crm_employees_range group_public","model_crm_employees_range","base.group_public",1,0,0,0
"access_crm_employees_portal","crm_employees_range group_portal","model_crm_employees_range","base.group_portal",1,0,0,0
"access_crm_employees_group_partner_manager","crm_employees_range group_partner_manager","model_crm_employees_range","base.group_partner_manager",1,1,1,1
"access_crm_employees_group_user","crm_employees_range group_user","model_crm_employees_range","base.group_user",1,0,0,0

BIN
crm_employees/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 18 KiB

30
crm_employees/views/crm_employees_range_view.xml

@ -0,0 +1,30 @@
<?xml version="1.0"?>
<openerp>
<data>
<record id="crm_employees_range_action" model="ir.actions.act_window">
<field name="name">Employees ranges</field>
<field name="res_model">crm.employees_range</field>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
</record>
<record id="crm_employees_range_tree_view" model="ir.ui.view">
<field name="name">CRM employees_range tree</field>
<field name="model">crm.employees_range</field>
<field name="arch" type="xml">
<tree string="Employees ranges" editable="bottom">
<field name="name"/>
<field name="parent_id"/>
</tree>
</field>
</record>
<menuitem action="crm_employees_range_action"
id="menu_crm_employees_range"
name="Employees ranges"
parent="base.menu_crm_config_lead"
sequence="5"/>
</data>
</openerp>

30
crm_employees/views/crm_lead_view.xml

@ -0,0 +1,30 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="ir.ui.view" id="crm_case_form_view_leads_employees">
<field name="name">CRM - Leads Form with employees</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_form_view_leads"/>
<field name="arch" type="xml">
<field name="partner_id" position="before">
<field name="employees_range"/>
<field name="employees_number"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="crm_case_form_view_oppor_employees">
<field name="name">CRM - Leads Form with employees</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_form_view_oppor"/>
<field name="arch" type="xml">
<field name="partner_id" position="before">
<field name="employees_range"/>
<field name="employees_number"/>
</field>
</field>
</record>
</data>
</openerp>

20
crm_employees/views/res_partner_view.xml

@ -0,0 +1,20 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="ir.ui.view" id="view_partner_form_employees">
<field name="name">Partner form with employees</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<field name="phone" position="before">
<field name="employees_range"
attrs="{'invisible': [('is_company', '=', False)]}"/>
<field name="employees_number"
attrs="{'invisible': [('is_company', '=', False)]}"/>
</field>
</field>
</record>
</data>
</openerp>
Loading…
Cancel
Save