Skip to content

Commit

Permalink
[ADD] ne module which adds a field hear about us in the crm.lead
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieuvatel committed Jul 31, 2015
1 parent 1776303 commit 8a5f7f4
Show file tree
Hide file tree
Showing 6 changed files with 179 additions and 0 deletions.
24 changes: 24 additions & 0 deletions crm_hear_about_us/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2015-Today Julius Network Solutions SARL <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################

from . import crm

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
49 changes: 49 additions & 0 deletions crm_hear_about_us/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2015-Today Julius Network Solutions SARL <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################

{
"name": "How the customer hear about us",
"version": "1.0",
"author": "Julius Network Solutions",
"website": "http://www.julius.fr/",
"category": "CRM",
"contributors": "Mathieu Vatel <[email protected]>",
"description": """
This module adds a new model :
==============================
* CRM How the customer hear about us
""",
"depends": [
"base",
"crm",
],
"demo": [],
"data": [
"security/ir.model.access.csv",
"crm_view.xml",
],
'installable': True,
'active': False,
}

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
38 changes: 38 additions & 0 deletions crm_hear_about_us/crm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2015-Today Julius Network Solutions SARL <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################

from openerp import models, fields

class crm_heard_about_us(models.Model):
_name = 'crm.hear.about.us'
_description = 'How did the customer hear about us'
_order = 'sequence'

sequence = fields.Integer(default=10)
name = fields.Char(translate=True, required=True)

class crm_lead(models.Model):
_inherit = 'crm.lead'

hear_about_us_id = fields.Many2one('crm.hear.about.us',
'How did the customer hear about us ?')

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
64 changes: 64 additions & 0 deletions crm_hear_about_us/crm_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

<record id="crm_hear_about_us_tree" model="ir.ui.view">
<field name="name">crm.hear.about.us.tree</field>
<field name="model">crm.hear.about.us</field>
<field name="arch" type="xml">
<tree string="Hear about us">
<field name="sequence" widget="handle"/>
<field name="name"/>
</tree>
</field>
</record>

<record id="crm_hear_about_us_form" model="ir.ui.view">
<field name="name">crm.hear.about.us.form</field>
<field name="model">crm.hear.about.us</field>
<field name="arch" type="xml">
<form string="Hear about us">
<group>
<field name="name"/>
<field name="sequence"/>
</group>
</form>
</field>
</record>

<record id="crm_hear_about_us_action" model="ir.actions.act_window">
<field name="name">Hear about us</field>
<field name="res_model">crm.hear.about.us</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>

<menuitem action="crm_hear_about_us_action" id="menu_crm_hear_about_us"
parent="base.menu_crm_config_lead" sequence="10"/>

<record model="ir.ui.view" id="crm_lead_hear_about_us_form">
<field name="name">CRM - Leads hear about us Form</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_form_view_leads"/>
<field name="priority">30</field>
<field name="arch" type="xml">
<field name="referred" position="after">
<field name="hear_about_us_id" options='{"no_open": True, "no_create": True}'/>
</field>
</field>
</record>

<record model="ir.ui.view" id="crm_opportunity_hear_about_us_form">
<field name="name">CRM - Opportunities hear about us Form</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_form_view_oppor"/>
<field name="priority">30</field>
<field name="arch" type="xml">
<field name="referred" position="after">
<field name="hear_about_us_id" options='{"no_open": True, "no_create": True}'/>
</field>
</field>
</record>

</data>
</openerp>
4 changes: 4 additions & 0 deletions crm_hear_about_us/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_crm_hear_about_us_salesman,access_crm_hear_about_us salesman,model_crm_hear_about_us,base.group_sale_salesman,1,1,1,0
access_crm_hear_about_us_manager,access_crm_hear_about_us manager,model_crm_hear_about_us,base.group_sale_manager,1,1,1,1
access_crm_hear_about_us_user,access_crm_hear_about_us user,model_crm_hear_about_us,,1,0,0,0
Binary file added crm_hear_about_us/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8a5f7f4

Please sign in to comment.