Browse Source

[ADD] crm_capital addon

pull/224/head
Antonio Espinosa 10 years ago
committed by Jairo Llopis
parent
commit
7cd001f3ed
  1. 18
      crm_capital/README.rst
  2. 6
      crm_capital/__init__.py
  3. 39
      crm_capital/__openerp__.py
  4. 105
      crm_capital/i18n/crm_capital.pot
  5. 105
      crm_capital/i18n/es.po
  6. 8
      crm_capital/models/__init__.py
  7. 28
      crm_capital/models/crm_lead.py
  8. 20
      crm_capital/models/crm_turnover_range.py
  9. 14
      crm_capital/models/res_partner.py
  10. 5
      crm_capital/security/ir.model.access.csv
  11. BIN
      crm_capital/static/description/icon.png
  12. 30
      crm_capital/views/crm_lead_view.xml
  13. 30
      crm_capital/views/crm_turnover_range_view.xml
  14. 20
      crm_capital/views/res_partner_view.xml

18
crm_capital/README.rst

@ -0,0 +1,18 @@
Capital in CRM
================
This module allows to set capital country, capital registered and turnover
for companies in the CRM main objects (lead, opportunity, partner), and
propagate them through the workflow.
By capital country we mean country of origin of the capital of the company
By capital registered we mean the amount of money registered in comercial
registry, aka social capital or just capital of a company
By turnover we can define a range an a concret amount
Credits
=======
Contributors
------------
* Antonio Espinosa <antonioea@antiun.com>

6
crm_capital/__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_capital/__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': 'Capital 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_turnover_range_view.xml',
'views/crm_lead_view.xml',
'views/res_partner_view.xml',
'security/ir.model.access.csv',
],
"installable": True,
}

105
crm_capital/i18n/crm_capital.pot

@ -0,0 +1,105 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_capital
#
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_capital
#: field:crm.lead,capital_country:0
msgid "Capital country"
msgstr ""
#. module: crm_capital
#: field:crm.lead,capital_registered:0
#: field:res.partner,capital_registered:0
msgid "Capital registered"
msgstr ""
#. module: crm_capital
#: field:crm.turnover_range,children:0
msgid "Children"
msgstr ""
#. module: crm_capital
#: help:crm.lead,capital_country:0
msgid "Country of origin of the capital of this company"
msgstr ""
#. module: crm_capital
#: field:crm.turnover_range,create_uid:0
msgid "Created by"
msgstr ""
#. module: crm_capital
#: field:crm.turnover_range,create_date:0
msgid "Created on"
msgstr ""
#. module: crm_capital
#: field:crm.turnover_range,id:0
msgid "ID"
msgstr ""
#. module: crm_capital
#: field:crm.turnover_range,write_uid:0
msgid "Last Updated by"
msgstr ""
#. module: crm_capital
#: field:crm.turnover_range,write_date:0
msgid "Last Updated on"
msgstr ""
#. module: crm_capital
#: model:ir.model,name:crm_capital.model_crm_lead
msgid "Lead/Opportunity"
msgstr ""
#. module: crm_capital
#: field:crm.turnover_range,name:0
msgid "Name"
msgstr ""
#. module: crm_capital
#: field:crm.turnover_range,parent_left:0
msgid "Parent Left"
msgstr ""
#. module: crm_capital
#: field:crm.turnover_range,parent_right:0
msgid "Parent Right"
msgstr ""
#. module: crm_capital
#: field:crm.turnover_range,parent_id:0
msgid "Parent id"
msgstr ""
#. module: crm_capital
#: model:ir.model,name:crm_capital.model_res_partner
msgid "Partner"
msgstr ""
#. module: crm_capital
#: model:ir.model,name:crm_capital.model_crm_turnover_range
msgid "Turnover range"
msgstr ""
#. module: crm_capital
#: view:crm.turnover_range:crm_capital.crm_turnover_range_tree_view
#: model:ir.actions.act_window,name:crm_capital.crm_turnover_range_action
#: model:ir.ui.menu,name:crm_capital.menu_crm_turnover_range
msgid "Turnover ranges"
msgstr ""

105
crm_capital/i18n/es.po

@ -0,0 +1,105 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_capital
#
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_capital
#: field:crm.lead,capital_country:0
msgid "Capital country"
msgstr "Nacionalidad del capital"
#. module: crm_capital
#: field:crm.lead,capital_registered:0
#: field:res.partner,capital_registered:0
msgid "Capital registered"
msgstr "Capital social"
#. module: crm_capital
#: field:crm.turnover_range,children:0
msgid "Children"
msgstr "Hijos"
#. module: crm_capital
#: help:crm.lead,capital_country:0
msgid "Country of origin of the capital of this company"
msgstr "País de origen del capital social de esta empresa"
#. module: crm_capital
#: field:crm.turnover_range,create_uid:0
msgid "Created by"
msgstr "Creado por"
#. module: crm_capital
#: field:crm.turnover_range,create_date:0
msgid "Created on"
msgstr "Creado en"
#. module: crm_capital
#: field:crm.turnover_range,id:0
msgid "ID"
msgstr "ID"
#. module: crm_capital
#: field:crm.turnover_range,write_uid:0
msgid "Last Updated by"
msgstr "Última actualización por"
#. module: crm_capital
#: field:crm.turnover_range,write_date:0
msgid "Last Updated on"
msgstr "última actualización en"
#. module: crm_capital
#: model:ir.model,name:crm_capital.model_crm_lead
msgid "Lead/Opportunity"
msgstr "Iniciativa/Oportunidad"
#. module: crm_capital
#: field:crm.turnover_range,name:0
msgid "Name"
msgstr "Nombre"
#. module: crm_capital
#: field:crm.turnover_range,parent_left:0
msgid "Parent Left"
msgstr "Padre izquierdo"
#. module: crm_capital
#: field:crm.turnover_range,parent_right:0
msgid "Parent Right"
msgstr "Padre derecho"
#. module: crm_capital
#: field:crm.turnover_range,parent_id:0
msgid "Parent id"
msgstr "ID del padre"
#. module: crm_capital
#: model:ir.model,name:crm_capital.model_res_partner
msgid "Partner"
msgstr "Empresa"
#. module: crm_capital
#: model:ir.model,name:crm_capital.model_crm_turnover_range
msgid "Turnover range"
msgstr "Rango de facturación"
#. module: crm_capital
#: view:crm.turnover_range:crm_capital.crm_turnover_range_tree_view
#: model:ir.actions.act_window,name:crm_capital.crm_turnover_range_action
#: model:ir.ui.menu,name:crm_capital.menu_crm_turnover_range
msgid "Turnover ranges"
msgstr "Rangos de facturación"

8
crm_capital/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_turnover_range
from . import crm_lead
from . import res_partner

28
crm_capital/models/crm_lead.py

@ -0,0 +1,28 @@
# -*- 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'
capital_country = fields.Many2one(
'res.country', string="Capital country",
help="Country of origin of the capital of this company")
capital_registered = fields.Integer(string="Capital registered")
def _lead_create_contact(self, cr, uid, lead, name, is_company,
parent_id=False, context=None):
"""Propagate capital_country and capital_registered 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, {
'capital_country': lead.capital_country.id,
'capital_registered': lead.capital_registered
}, context=context)
return partner_id

20
crm_capital/models/crm_turnover_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 CrmTurnoverRange(models.Model):
_name = 'crm.turnover_range'
_order = "parent_left"
_parent_order = "name"
_parent_store = True
_description = "Turnover range"
name = fields.Char(required=True)
parent_id = fields.Many2one(comodel_name='crm.turnover_range')
children = fields.One2many(comodel_name='crm.turnover_range',
inverse_name='parent_id')
parent_left = fields.Integer('Parent Left', select=True)
parent_right = fields.Integer('Parent Right', select=True)

14
crm_capital/models/res_partner.py

@ -0,0 +1,14 @@
# -*- 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'
capital_country = fields.Many2one(
'res.country', string="Capital country",
help="Country of origin of the capital of this company")
capital_registered = fields.Integer(string="Capital registered")

5
crm_capital/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_turnover_public","crm_turnover_range group_public","model_crm_turnover_range","base.group_public",1,0,0,0
"access_crm_turnover_portal","crm_turnover_range group_portal","model_crm_turnover_range","base.group_portal",1,0,0,0
"access_crm_turnover_group_partner_manager","crm_turnover_range group_partner_manager","model_crm_turnover_range","base.group_partner_manager",1,1,1,1
"access_crm_turnover_group_user","crm_turnover_range group_user","model_crm_turnover_range","base.group_user",1,0,0,0

BIN
crm_capital/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 19 KiB

30
crm_capital/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_capital">
<field name="name">CRM - Leads Form with capital info</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="capital_country"/>
<field name="capital_registered"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="crm_case_form_view_oppor_capital">
<field name="name">CRM - Leads Form with capital info</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="capital_country"/>
<field name="capital_registered"/>
</field>
</field>
</record>
</data>
</openerp>

30
crm_capital/views/crm_turnover_range_view.xml

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

20
crm_capital/views/res_partner_view.xml

@ -0,0 +1,20 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="ir.ui.view" id="view_partner_form_capital">
<field name="name">Partner form with capital info</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="capital_country"
attrs="{'invisible': [('is_company', '=', False)]}"/>
<field name="capital_registered"
attrs="{'invisible': [('is_company', '=', False)]}"/>
</field>
</field>
</record>
</data>
</openerp>
Loading…
Cancel
Save