diff --git a/crm_employees/README.rst b/crm_employees/README.rst new file mode 100644 index 000000000..51ffa3ece --- /dev/null +++ b/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 diff --git a/crm_employees/__init__.py b/crm_employees/__init__.py new file mode 100644 index 000000000..054c8853d --- /dev/null +++ b/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 diff --git a/crm_employees/__openerp__.py b/crm_employees/__openerp__.py new file mode 100644 index 000000000..fe43bfcce --- /dev/null +++ b/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 +# +# 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 . +# +############################################################################## + +{ + '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, +} diff --git a/crm_employees/i18n/crm_employees.pot b/crm_employees/i18n/crm_employees.pot new file mode 100644 index 000000000..198769332 --- /dev/null +++ b/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 "" + diff --git a/crm_employees/i18n/es.po b/crm_employees/i18n/es.po new file mode 100644 index 000000000..77bbddff3 --- /dev/null +++ b/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" + diff --git a/crm_employees/models/__init__.py b/crm_employees/models/__init__.py new file mode 100644 index 000000000..60471a1ff --- /dev/null +++ b/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 diff --git a/crm_employees/models/crm_employees_range.py b/crm_employees/models/crm_employees_range.py new file mode 100644 index 000000000..5610c1dd7 --- /dev/null +++ b/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) diff --git a/crm_employees/models/crm_lead.py b/crm_employees/models/crm_lead.py new file mode 100644 index 000000000..60e9f7fce --- /dev/null +++ b/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 diff --git a/crm_employees/models/res_partner.py b/crm_employees/models/res_partner.py new file mode 100644 index 000000000..53b3f5e24 --- /dev/null +++ b/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() diff --git a/crm_employees/security/ir.model.access.csv b/crm_employees/security/ir.model.access.csv new file mode 100644 index 000000000..01adc1025 --- /dev/null +++ b/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 diff --git a/crm_employees/static/description/icon.png b/crm_employees/static/description/icon.png new file mode 100644 index 000000000..64933c90c Binary files /dev/null and b/crm_employees/static/description/icon.png differ diff --git a/crm_employees/views/crm_employees_range_view.xml b/crm_employees/views/crm_employees_range_view.xml new file mode 100644 index 000000000..87fda272b --- /dev/null +++ b/crm_employees/views/crm_employees_range_view.xml @@ -0,0 +1,30 @@ + + + + + + Employees ranges + crm.employees_range + form + tree + + + + CRM employees_range tree + crm.employees_range + + + + + + + + + + + + \ No newline at end of file diff --git a/crm_employees/views/crm_lead_view.xml b/crm_employees/views/crm_lead_view.xml new file mode 100644 index 000000000..9bb89f255 --- /dev/null +++ b/crm_employees/views/crm_lead_view.xml @@ -0,0 +1,30 @@ + + + + + + CRM - Leads Form with employees + crm.lead + + + + + + + + + + + CRM - Leads Form with employees + crm.lead + + + + + + + + + + + \ No newline at end of file diff --git a/crm_employees/views/res_partner_view.xml b/crm_employees/views/res_partner_view.xml new file mode 100644 index 000000000..3ed8d41e6 --- /dev/null +++ b/crm_employees/views/res_partner_view.xml @@ -0,0 +1,20 @@ + + + + + + Partner form with employees + res.partner + + + + + + + + + + + \ No newline at end of file