Browse Source

Prepare for OCA.

- Shorter copyright & license headers.
- Remove all CRM functionality & dependencies.
- Move fields to Sales & Purchases tab.
- Remove pot.
- Probably something more.
pull/225/head
Jairo Llopis 9 years ago
parent
commit
766c09b308
  1. 69
      partner_employee_amount/README.rst
  2. 8
      partner_employee_amount/__init__.py
  3. 37
      partner_employee_amount/__openerp__.py
  4. 90
      partner_employee_amount/i18n/crm_employees.pot
  5. 10
      partner_employee_amount/models/__init__.py
  6. 12
      partner_employee_amount/models/crm_employees_range.py
  7. 26
      partner_employee_amount/models/crm_lead.py
  8. 25
      partner_employee_amount/models/res_partner.py
  9. 8
      partner_employee_amount/security/ir.model.access.csv
  10. 29
      partner_employee_amount/views/crm_employees_range_view.xml
  11. 32
      partner_employee_amount/views/crm_lead_view.xml
  12. 27
      partner_employee_amount/views/res_partner_employee_amount_range_view.xml
  13. 19
      partner_employee_amount/views/res_partner_view.xml

69
partner_employee_amount/README.rst

@ -1,13 +1,72 @@
Employees in CRM
================
.. 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
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.
===========================
Employee amount in partners
===========================
This module allows to set employee amount for partners, and categorize them by
ranges.
Configuration
=============
To manage available ranges, you need to:
* Go to *Sales > Configuration > Address Book > Ranges by amount of employees*.
Usage
=====
To use this module, you need to:
* Go to any partner's form.
* Enable *Is company?*.
* Go to *Sales & Purchases > Employee amount*.
.. 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/8.0
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 smashing it by providing a detailed and welcomed `feedback
<https://github.com/OCA/
partner-contact/issues/new?body=module:%20
partner_employee_amount%0Aversion:%20
8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits Credits
======= =======
Images
------
* `Antiun Ingeniería S.L. <http://www.antiun.com>`_: Icon.
Contributors Contributors
------------ ------------
* Antonio Espinosa <antonioea@antiun.com> * Antonio Espinosa <antonioea@antiun.com>
* Rafael Blasco <rafabn@antiun.com>
* Jairo Llopis <yajo.sk8@gmail.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.

8
partner_employee_amount/__init__.py

@ -1,6 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
# -*- coding: utf-8 -*-
# © 2015 Antiun Ingeniería S.L. - Antonio Espinosa
# © 2015 Antiun Ingeniería S.L. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models from . import models

37
partner_employee_amount/__openerp__.py

@ -1,39 +1,22 @@
# -*- 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/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# © 2015 Antiun Ingeniería S.L. - Antonio Espinosa
# © 2015 Antiun Ingeniería S.L. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{ {
'name': 'Employees in CRM',
'version': '1.0',
'name': 'Employee amount in partners',
'summary': 'Know how many employees a partner has',
'version': '8.0.1.0.0',
'category': 'Customer Relationship Management', 'category': 'Customer Relationship Management',
'author': 'Antiun Ingeniería S.L.', 'author': 'Antiun Ingeniería S.L.',
'website': 'http://www.antiun.com', 'website': 'http://www.antiun.com',
'depends': [ 'depends': [
'crm',
'base',
], ],
'data': [ 'data': [
'views/crm_employees_range_view.xml',
'views/crm_lead_view.xml',
'views/res_partner_view.xml',
'security/ir.model.access.csv', 'security/ir.model.access.csv',
'views/res_partner_employee_amount_range_view.xml',
'views/res_partner_view.xml',
], ],
"installable": True, "installable": True,
} }

90
partner_employee_amount/i18n/crm_employees.pot

@ -1,90 +0,0 @@
# 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-05-27 08:57+0000\n"
"PO-Revision-Date: 2015-05-27 08:57+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,create_uid:0
msgid "Created by"
msgstr ""
#. module: crm_employees
#: field:crm.employees_range,create_date:0
msgid "Created on"
msgstr ""
#. module: crm_employees
#: view:res.partner:crm_employees.view_res_partner_filter_employees
msgid "Emplooyees"
msgstr ""
#. module: crm_employees
#: field:crm.lead,employees_number:0
#: field:res.partner,employees_number:0
msgid "Employees number"
msgstr ""
#. module: crm_employees
#: view:crm.lead:crm_employees.crm_case_form_view_leads_employees
#: view:crm.lead:crm_employees.crm_case_form_view_oppor_employees
#: field:crm.lead,employees_range:0
#: model:ir.model,name:crm_employees.model_crm_employees_range
#: view:res.partner:crm_employees.view_partner_form_employees
#: 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
#: model:ir.model,name:crm_employees.model_res_partner
msgid "Partner"
msgstr ""
#. module: crm_employees
#: view:res.partner:crm_employees.view_res_partner_filter_employees
msgid "Salesperson"
msgstr ""

10
partner_employee_amount/models/__init__.py

@ -1,8 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
# -*- coding: utf-8 -*-
# © 2015 Antiun Ingeniería S.L. - Antonio Espinosa
# © 2015 Antiun Ingeniería S.L. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import crm_employees_range
from . import crm_lead
from . import res_partner from . import res_partner

12
partner_employee_amount/models/crm_employees_range.py

@ -1,12 +0,0 @@
# -*- 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'
_description = "Employees range"
name = fields.Char(required=True, translate=True)

26
partner_employee_amount/models/crm_lead.py

@ -1,26 +0,0 @@
# -*- 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

25
partner_employee_amount/models/res_partner.py

@ -1,12 +1,25 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
# -*- coding: utf-8 -*-
# © 2015 Antiun Ingeniería S.L. - Antonio Espinosa
# © 2015 Antiun Ingeniería S.L. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields from openerp import models, fields
class ResPartner(models.Model): class ResPartner(models.Model):
_inherit = 'res.partner' _inherit = 'res.partner'
employees_range = fields.Many2one(comodel_name='crm.employees_range')
employees_number = fields.Integer()
employee_amount = fields.Integer(
oldname="employees_number")
employee_amount_range_id = fields.Many2one(
"res.partner.employee_amount_range",
"Employee amount range",
help="Range of this partner depending on the employee amount.",
oldname="employees_range")
class ResPartnerEmployeeAmountRange(models.Model):
_name = "res.partner.employee_amount_range"
_description = "Partner employee amount range"
name = fields.Char(required=True, translate=True)

8
partner_employee_amount/security/ir.model.access.csv

@ -1,5 +1,5 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" "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
"access_res_partner_employee_amount_range_public","res_partner_employee_amount_range group_public","model_res_partner_employee_amount_range","base.group_public",1,0,0,0
"access_res_partner_employee_amount_range_portal","res_partner_employee_amount_range group_portal","model_res_partner_employee_amount_range","base.group_portal",1,0,0,0
"access_res_partner_employee_amount_range_group_partner_manager","res_partner_employee_amount_range group_partner_manager","model_res_partner_employee_amount_range","base.group_partner_manager",1,1,1,1
"access_res_partner_employee_amount_range_group_user","res_partner_employee_amount_range group_user","model_res_partner_employee_amount_range","base.group_user",1,0,0,0

29
partner_employee_amount/views/crm_employees_range_view.xml

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<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="top">
<field name="name"/>
</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>

32
partner_employee_amount/views/crm_lead_view.xml

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="crm_case_form_view_leads">
<field name="name">Add employees field</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" placeholder="Employees range"
options='{"no_open": True}'/>
<field name="employees_number"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="crm_case_form_view_oppor">
<field name="name">Add employees field</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" placeholder="Employees range"
options='{"no_open": True}'/>
<field name="employees_number"/>
</field>
</field>
</record>
</data>
</openerp>

27
partner_employee_amount/views/res_partner_employee_amount_range_view.xml

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="employees_range_action" model="ir.actions.act_window">
<field name="name">Ranges by amount of employees</field>
<field name="res_model">res.partner.employee_amount_range</field>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
</record>
<record id="employees_range_tree_view" model="ir.ui.view">
<field name="name">Amount of employees ranges tree</field>
<field name="model">res.partner.employee_amount_range</field>
<field name="arch" type="xml">
<tree string="Ranges by amount of employees" editable="top">
<field name="name"/>
</tree>
</field>
</record>
<menuitem action="employees_range_action"
id="menu_employees_range"
parent="base.menu_config_address_book"/>
</data>
</openerp>

19
partner_employee_amount/views/res_partner_view.xml

@ -7,13 +7,14 @@
<field name="model">res.partner</field> <field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/> <field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="phone" position="before">
<field name="employees_range" placeholder="Employees range"
attrs="{'invisible': [('is_company', '=', False)]}"
options='{"no_open": True}'/>
<field name="employees_number"
attrs="{'invisible': [('is_company', '=', False)]}"/>
</field>
<xpath expr="//page[@name='sales_purchases']/group">
<group name="employee_amount"
string="Employee amount"
attrs="{'invisible': [('is_company', '=', False)]}">
<field name="employee_amount"/>
<field name="employee_amount_range_id"/>
</group>
</xpath>
</field> </field>
</record> </record>
@ -23,9 +24,9 @@
<field name="inherit_id" ref="base.view_res_partner_filter"/> <field name="inherit_id" ref="base.view_res_partner_filter"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<filter string="Salesperson" position="after"> <filter string="Salesperson" position="after">
<filter string="Emplooyees"
<filter string="Employees"
domain="[('is_company','=', True)]" domain="[('is_company','=', True)]"
context="{'group_by': 'employees_range'}"/>
context="{'group_by': 'employee_amount_range_id'}"/>
</filter> </filter>
</field> </field>
</record> </record>

Loading…
Cancel
Save