[ADD]: crm_fundraising: Made new module for crm fundraising from crm
authorrpa (Open ERP) <rpa@tinyerp.com>
Tue, 27 Apr 2010 12:38:59 +0000 (18:08 +0530)
committerrpa (Open ERP) <rpa@tinyerp.com>
Tue, 27 Apr 2010 12:38:59 +0000 (18:08 +0530)
bzr revid: rpa@tinyerp.com-20100427123859-rugfef0byupt0a2j

addons/crm_fundraising/__init__.py [new file with mode: 0644]
addons/crm_fundraising/__openerp__.py [new file with mode: 0644]
addons/crm_fundraising/crm_fundraising.py [new file with mode: 0644]
addons/crm_fundraising/crm_fundraising_data.xml [new file with mode: 0644]
addons/crm_fundraising/crm_fundraising_demo.xml [new file with mode: 0644]
addons/crm_fundraising/crm_fundraising_menu.xml [new file with mode: 0644]
addons/crm_fundraising/crm_fundraising_view.xml [new file with mode: 0644]
addons/crm_fundraising/report/__init__.py [new file with mode: 0644]
addons/crm_fundraising/report/crm_fundraising_report.py [new file with mode: 0644]
addons/crm_fundraising/report/crm_fundraising_report_view.xml [new file with mode: 0644]
addons/crm_fundraising/security/ir.model.access.csv [new file with mode: 0644]

diff --git a/addons/crm_fundraising/__init__.py b/addons/crm_fundraising/__init__.py
new file mode 100644 (file)
index 0000000..b16301e
--- /dev/null
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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/>.
+#
+##############################################################################
+
+import crm_fundraising
+import report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/crm_fundraising/__openerp__.py b/addons/crm_fundraising/__openerp__.py
new file mode 100644 (file)
index 0000000..292325f
--- /dev/null
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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': 'CRM Fundraising',
+    'version': '1.0',
+    'category': 'Generic Modules/CRM & SRM',
+    'description': """Fundraising""",
+    'author': 'Tiny',
+    'website': 'http://www.openerp.com',
+    'depends': ['crm'],
+    'init_xml': [
+         'crm_fundraising_data.xml',
+    ],
+
+    'update_xml': [
+        'crm_fundraising_view.xml',
+        'crm_fundraising_menu.xml',
+        'security/ir.model.access.csv',
+        'report/crm_fundraising_report_view.xml',
+    ],
+    'demo_xml': [
+        'crm_fundraising_demo.xml',
+    ],
+    'installable': True,
+    'active': False,
+}
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/crm_fundraising/crm_fundraising.py b/addons/crm_fundraising/crm_fundraising.py
new file mode 100644 (file)
index 0000000..30c4130
--- /dev/null
@@ -0,0 +1,75 @@
+#-*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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/>.
+#
+##############################################################################
+
+from osv import fields, osv, orm
+from crm import crm
+
+class crm_fundraising(osv.osv):
+    """ Fund Raising Cases """
+
+    _name = "crm.fundraising"
+    _description = "Fund Raising Cases"
+    _order = "id desc"
+    _inherit ='crm.case'
+
+    _columns = {
+            'date_closed': fields.datetime('Closed', readonly=True), 
+            'date': fields.datetime('Date'), 
+            'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'), 
+            'categ_id': fields.many2one('crm.case.categ', 'Category', \
+                                domain="[('section_id','=',section_id),\
+                                ('object_id.model', '=', 'crm.fundraising')]"), 
+            'planned_revenue': fields.float('Planned Revenue'), 
+            'planned_cost': fields.float('Planned Costs'), 
+            'probability': fields.float('Probability (%)'), 
+            'partner_name': fields.char("Employee's Name", size=64), 
+            'partner_name2': fields.char('Employee Email', size=64), 
+            'partner_phone': fields.char('Phone', size=32), 
+            'partner_mobile': fields.char('Mobile', size=32), 
+            'stage_id': fields.many2one ('crm.case.stage', 'Stage', \
+                             domain="[('section_id','=',section_id),\
+                            ('object_id.model', '=', 'crm.fundraising')]"), 
+            'type_id': fields.many2one('crm.case.resource.type', 'Fundraising Type', \
+                             domain="[('section_id','=',section_id),\
+                             ('object_id.model', '=', 'crm.fundraising')]"), 
+            'duration': fields.float('Duration'), 
+            'ref': fields.reference('Reference', selection=crm._links_get, size=128), 
+            'ref2': fields.reference('Reference 2', selection=crm._links_get, size=128), 
+            'canal_id': fields.many2one('res.partner.canal', 'Channel', \
+                        help="The channels represent the different communication \
+                        modes available with the customer." \
+                       " With each commercial opportunity, you can indicate\
+                     the canall which is this opportunity source."), 
+            'som': fields.many2one('res.partner.som', 'State of Mind', \
+                         help="The minds states allow to define a value scale which represents" \
+                              "the partner mentality in relation to our services.The scale has" \
+                            "to be created with a factor for each level from 0 \
+                             (Very dissatisfied) to 10 (Extremely satisfied)."), 
+        }
+
+    _defaults = {
+                 'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0], 
+                 'probability':lambda *a:0.0, 
+                 'planned_cost':lambda *a:0.0, 
+                 'planned_revenue':lambda *a:0.0, 
+    }
+
+crm_fundraising()
diff --git a/addons/crm_fundraising/crm_fundraising_data.xml b/addons/crm_fundraising/crm_fundraising_data.xml
new file mode 100644 (file)
index 0000000..03613d8
--- /dev/null
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<openerp>
+<data noupdate="1">
+
+        <!--    FUNDRAISING CATEGORY(categ_id)        -->
+        
+    <record model="crm.case.categ" id="categ_fund1">
+        <field name="name">Social Rehabilitation And Rural Upliftment</field>
+        <field name="section_id" ref="crm.section_sales_department"/>
+               <field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
+    </record>
+    
+    <record model="crm.case.categ" id="categ_fund2">
+        <field name="name">Learning And Education</field>
+        <field name="section_id" ref="crm.section_sales_department"/>
+               <field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>      
+    </record>    
+    
+    <record model="crm.case.categ" id="categ_fund3">
+        <field name="name">Healthcare</field>
+        <field name="section_id" ref="crm.section_sales_department"/>
+               <field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>         
+    </record>        
+    
+    <record model="crm.case.categ" id="categ_fund4">
+        <field name="name">Arts And Culture</field>
+        <field name="section_id" ref="crm.section_sales_department"/>
+               <field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>         
+    </record>    
+
+        <!--    CASE Resource(type_id)        -->
+        
+    <record model="crm.case.resource.type" id="type_fund1">
+        <field name="name">Cash</field>
+        <field name="section_id" ref="crm.section_sales_department"/>
+               <field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>  
+    </record>
+    
+    <record model="crm.case.resource.type" id="type_fund2">
+        <field name="name">Cheque</field>
+        <field name="section_id" ref="crm.section_sales_department"/>
+               <field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>          
+    </record>        
+
+    <record model="crm.case.resource.type" id="type_fund3">
+        <field name="name">Credit Card</field>
+        <field name="section_id" ref="crm.section_sales_department"/>
+               <field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>          
+    </record>
+    
+    <record model="crm.case.resource.type" id="type_fund4">
+        <field name="name">Demand Draft</field>
+        <field name="section_id" ref="crm.section_sales_department"/>
+               <field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>          
+    </record>    
+
+</data>
+</openerp>
diff --git a/addons/crm_fundraising/crm_fundraising_demo.xml b/addons/crm_fundraising/crm_fundraising_demo.xml
new file mode 100644 (file)
index 0000000..c758870
--- /dev/null
@@ -0,0 +1,146 @@
+<?xml version="1.0" ?>
+<openerp>
+    <data noupdate="1">
+        <record id="crm_case_helpingstreetchildren0" model="crm.fundraising">
+            <field eval="50" name="probability"/>
+            <field name="partner_address_id" ref="base.res_partner_address_1"/>
+            <field eval="1" name="active"/>
+            <field name="type_id" ref="type_fund3"/>
+            <field eval="3.0" name="duration"/>
+            <field name="partner_id" ref="base.res_partner_9"/>
+            <field eval="&quot;3&quot;" name="priority"/>
+            <field name="user_id" ref="base.user_demo"/>
+            <field eval="&quot;open&quot;" name="state"/>
+            <field eval="250000.0" name="planned_cost"/>
+            <field name="section_id" ref="crm.section_sales_department"/>
+            <field eval="time.strftime('%Y-%m-01 10:35:50')" name="date"/>
+            <field name="categ_id" ref="categ_fund1"/>
+            <field eval="&quot;Helping Street Children&quot;" name="name"/>
+            <field eval="&quot;info@opensides.be&quot;" name="email_from"/>
+        </record>
+    </data>
+    <data noupdate="1">
+        <record id="crm_case_helpingearthquakevictims0" model="crm.fundraising">
+            <field eval="80" name="probability"/>
+            <field name="partner_address_id" ref="base.main_address"/>
+            <field eval="1" name="active"/>
+            <field name="type_id" ref="type_fund4"/>
+            <field name="partner_id" ref="base.main_partner"/>
+            <field eval="&quot;3&quot;" name="priority"/>
+            <field name="user_id" ref="base.user_root"/>
+            <field eval="&quot;draft&quot;" name="state"/>
+            <field eval="2000000.0" name="planned_cost"/>
+            <field name="section_id" ref="crm.section_sales_department"/>
+            <field eval="time.strftime('%Y-%m-05 12:35:50')" name="date"/>
+            <field eval="8.0" name="duration"/>
+            <field name="categ_id" ref="categ_fund1"/>
+            <field eval="&quot;Helping earthquake victims&quot;" name="name"/>
+        </record>
+    </data>
+    <data noupdate="1">
+        <record id="crm_case_donatingbookstoschoollibraries0" model="crm.fundraising">
+            <field name="partner_address_id" ref="base.res_partner_address_zen"/>
+            <field eval="1" name="active"/>
+            <field name="type_id" ref="type_fund1"/>
+            <field eval="5.0" name="duration"/>
+            <field name="partner_id" ref="base.res_partner_3"/>
+            <field eval="&quot;3&quot;" name="priority"/>
+            <field name="user_id" ref="base.user_root"/>
+            <field eval="&quot;open&quot;" name="state"/>
+            <field eval="500000.0" name="planned_cost"/>
+            <field name="section_id" ref="crm.section_sales_department"/>
+            <field eval="time.strftime('%Y-%m-07 13:50:50')" name="date"/>
+            <field name="categ_id" ref="categ_fund2"/>
+            <field eval="&quot;Donating books to school libraries&quot;" name="name"/>
+        </record>
+    </data>
+    <data noupdate="1">
+        <record id="crm_case_renovatinggovernmentschools0" model="crm.fundraising">
+            <field name="partner_address_id" ref="base.res_partner_address_7"/>
+            <field eval="1" name="active"/>
+            <field name="type_id" ref="type_fund2"/>
+            <field eval="3.0" name="duration"/>
+            <field name="partner_id" ref="base.res_partner_4"/>
+            <field eval="&quot;3&quot;" name="priority"/>
+            <field name="user_id" ref="base.user_demo"/>
+            <field eval="&quot;draft&quot;" name="state"/>
+            <field eval="1000000.0" name="planned_cost"/>
+            <field name="section_id" ref="crm.section_sales_department"/>
+            <field eval="time.strftime('%Y-%m-12 15:10:50')" name="date"/>
+            <field name="categ_id" ref="categ_fund2"/>
+            <field eval="4.3" name="duration"/>
+            <field eval="&quot;Renovating government schools&quot;" name="name"/>
+        </record>
+    </data>
+    <data noupdate="1">
+        <record id="crm_case_donatingambulancestohospitals0" model="crm.fundraising">
+            <field name="partner_address_id" ref="base.res_partner_address_13"/>
+            <field eval="1" name="active"/>
+            <field name="type_id" ref="type_fund4"/>
+            <field name="partner_id" ref="base.res_partner_14"/>
+            <field eval="&quot;3&quot;" name="priority"/>
+            <field name="user_id" ref="base.user_root"/>
+            <field eval="&quot;open&quot;" name="state"/>
+            <field eval="5000000.0" name="planned_cost"/>
+            <field name="section_id" ref="crm.section_sales_department"/>
+            <field eval="time.strftime('%Y-%m-17 19:00:15')" name="date"/>
+            <field eval="3" name="duration"/>
+            <field name="categ_id" ref="categ_fund3"/>
+            <field eval="&quot;Donating ambulances to hospitals&quot;" name="name"/>
+        </record>
+    </data>
+    <data noupdate="1">
+        <record id="crm_case_donatinghospitalequipments0" model="crm.fundraising">
+            <field name="partner_address_id" ref="base.res_partner_address_2"/>
+            <field eval="1" name="active"/>
+            <field name="type_id" ref="type_fund3"/>
+            <field name="partner_id" ref="base.res_partner_10"/>
+            <field eval="&quot;3&quot;" name="priority"/>
+            <field name="user_id" ref="base.user_root"/>
+            <field eval="&quot;done&quot;" name="state"/>
+            <field eval="10000000.0" name="planned_cost"/>
+            <field name="section_id" ref="crm.section_sales_department"/>
+            <field eval="time.strftime('%Y-%m-27 09:00:15')" name="date"/>
+            <field eval="12" name="duration"/>
+            <field name="categ_id" ref="categ_fund3"/>
+            <field eval="&quot;Donating hospital equipments&quot;" name="name"/>
+            <field eval="&quot;contact@tecsas.fr&quot;" name="email_from"/>
+        </record>
+    </data>
+    <data noupdate="1">
+        <record id="crm_case_encouragingarts0" model="crm.fundraising">
+            <field name="partner_address_id" ref="base.res_partner_address_14"/>
+            <field eval="1" name="active"/>
+            <field name="type_id" ref="type_fund2"/>
+            <field eval="7.0" name="duration"/>
+            <field name="partner_id" ref="base.res_partner_15"/>
+            <field eval="&quot;3&quot;" name="priority"/>
+            <field name="user_id" ref="base.user_demo"/>
+            <field eval="&quot;draft&quot;" name="state"/>
+            <field eval="10000.0" name="planned_cost"/>
+            <field name="section_id" ref="crm.section_sales_department"/>
+            <field eval="time.strftime('%Y-%m-01 10:00:15')" name="date"/>
+            <field name="categ_id" ref="categ_fund4"/>
+            <field eval="&quot;Encouraging arts&quot;" name="name"/>
+        </record>
+    </data>
+    <data noupdate="1">
+        <record id="crm_case_promotingculturalprogramsandpreservingdyingartforms0" model="crm.fundraising">
+            <field eval="10" name="probability"/>
+            <field name="partner_address_id" ref="base.res_partner_address_1"/>
+            <field eval="1" name="active"/>
+            <field name="type_id" ref="type_fund1"/>
+            <field eval="6.0" name="duration"/>
+            <field name="partner_id" ref="base.res_partner_9"/>
+            <field eval="&quot;3&quot;" name="priority"/>
+            <field name="user_id" ref="base.user_root"/>
+            <field eval="&quot;open&quot;" name="state"/>
+            <field eval="800000.0" name="planned_cost"/>
+            <field name="section_id" ref="crm.section_sales_department"/>
+            <field eval="time.strftime('%Y-%m-24 22:00:15')" name="date"/>
+            <field name="categ_id" ref="categ_fund4"/>
+            <field eval="&quot;Promoting cultural programs and preserving dying art forms&quot;" name="name"/>
+            <field eval="&quot;info@opensides.be&quot;" name="email_from"/>
+        </record>
+    </data>
+</openerp>
diff --git a/addons/crm_fundraising/crm_fundraising_menu.xml b/addons/crm_fundraising/crm_fundraising_menu.xml
new file mode 100644 (file)
index 0000000..eab0603
--- /dev/null
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<openerp>
+<data noupdate="1">
+
+<!-- MENU -->
+
+    <menuitem id="base.menu_fundrising" name="Fund Raising"
+        groups="base.group_extended"
+        parent="base.menu_base_partner" sequence="7" />
+
+    <record model="ir.actions.act_window" id="crm_case_category_act_fund_all1">
+        <field name="name">Funds</field>
+        <field name="res_model">crm.fundraising</field>
+        <field name="view_mode">tree,form,graph</field>
+        <field name="view_id" ref="crm_fundraising.crm_case_tree_view_fund"/>
+        <field name="search_view_id" ref="crm_fundraising.view_crm_case_fund_filter"/>
+    </record>
+
+    <record model="ir.actions.act_window.view" id="action_crm_tag_tree_view_fund_all1">
+        <field name="sequence" eval="1"/>
+        <field name="view_mode">tree</field>
+        <field name="view_id" ref="crm_fundraising.crm_case_tree_view_fund"/>
+        <field name="act_window_id" ref="crm_fundraising.crm_case_category_act_fund_all1"/>
+    </record>
+
+    <record model="ir.actions.act_window.view" id="action_crm_tag_form_view_fund_all1">
+        <field name="sequence" eval="2"/>
+        <field name="view_mode">form</field>
+        <field name="view_id" ref="crm_fundraising.crm_case_form_view_fund"/>
+        <field name="act_window_id" ref="crm_fundraising.crm_case_category_act_fund_all1"/>
+    </record>
+
+    <record model="ir.actions.act_window.view" id="action_crm_tag_graph_view_fund_all1">
+        <field name="sequence" eval="3"/>
+        <field name="view_mode">graph</field>
+        <field name="view_id" ref="crm_fundraising.crm_case_graph_view_fund"/>
+        <field name="act_window_id" ref="crm_fundraising.crm_case_category_act_fund_all1"/>
+    </record>
+
+    <menuitem name="Fund Raising" id="menu_crm_case_fund_raise"
+       parent="base.menu_fundrising"
+       action="crm_case_category_act_fund_all1" sequence="1" />
+
+</data>
+</openerp>
diff --git a/addons/crm_fundraising/crm_fundraising_view.xml b/addons/crm_fundraising/crm_fundraising_view.xml
new file mode 100644 (file)
index 0000000..70cc477
--- /dev/null
@@ -0,0 +1,296 @@
+<?xml version="1.0"?>
+<openerp>
+<data>
+
+<!-- Fund Raising Categories Form View -->
+
+    <record id="crm_fund_categ_action" model="ir.actions.act_window">
+        <field name="name">Fundraising Categories</field>
+        <field name="res_model">crm.case.categ</field>
+        <field name="view_type">form</field>
+         <field name="view_id" ref="crm.crm_case_categ_tree-view"/>
+        <field name="domain">[('object_id.model', '=', 'crm.fundraising')]</field>
+        <field name="context">{'object_id':'crm.fundraising'}</field>
+    </record>
+
+    <menuitem action="crm_fund_categ_action"
+        id="menu_crm_case_fundraising-act"
+        groups="base.group_extended"
+        parent="crm.menu_crm_case_categ" />
+
+<!-- Fund Stage Form View -->
+
+        <record id="crm_fundraising_stage_act" model="ir.actions.act_window">
+            <field name="name">Fundraising Stages</field>
+            <field name="res_model">crm.case.stage</field>
+            <field name="view_type">form</field>
+            <field name="view_id" ref="crm.crm_case_stage_tree"/>
+               <field name="domain">[('object_id.model', '=', 'crm.fundraising')]</field>
+               <field name="context">{'object_id':'crm.fundraising'}</field>
+        </record>
+
+        <menuitem action="crm_fundraising_stage_act"
+            groups="base.group_extended"
+            id="menu_crm_fundraising_stage_act"
+            parent="crm.menu_crm_case_stage" />
+
+<!-- Fund  Resource Type Form View -->
+
+        <record id="crm_fundraising_resource_act" model="ir.actions.act_window">
+            <field name="name">Fundraising Resource Type</field>
+            <field name="res_model">crm.case.resource.type</field>
+            <field name="view_type">form</field>
+            <field name="view_id" ref="crm.crm_case_resource_type_tree"/>
+               <field name="domain">[('object_id.model', '=', 'crm.fundraising')]</field>
+               <field name="context">{'object_id':'crm.fundraising'}</field>
+        </record>
+
+        <menuitem action="crm_fundraising_resource_act"
+            groups="base.group_extended"
+            id="menu_crm_fundraising_resource_act"
+            parent="crm.menu_crm_case_resource_type" />
+
+
+<!-- Fund Raising Tree View -->
+
+    <record model="ir.ui.view" id="crm_case_tree_view_fund">
+        <field name="name">CRM - Funds Tree</field>
+        <field name="model">crm.fundraising</field>
+        <field name="type">tree</field>
+        <field name="arch" type="xml">
+            <tree string="Funds Tree"
+                colors="red:state=='open';black:state in ('draft', 'cancel','done','pending')">
+                <field name="id" />
+                <field name="name" string="Fund Description" />
+                <field name="categ_id" />
+                <field name="type_id" string="Payment Mode" />
+                <field name="planned_cost" string="Amount" />
+                <field name="probability" />
+                <field name="user_id" />
+                <field name="state" />
+                <button name="case_close" string="Done"
+                    states="open,draft,pending" type="object"
+                    icon="gtk-close" />
+                <button name="case_open" string="Open"
+                    states="draft,pending" type="object"
+                    icon="gtk-go-forward" />
+                <button name="case_cancel" string="Cancel"
+                    states="draft,open,pending" type="object"
+                    icon="gtk-cancel" />
+                <button name="case_pending" string="Pending"
+                    states="draft,open" type="object" icon="gtk-media-pause" />
+                <button name="case_escalate" string="Escalate"
+                    states="open,draft,pending" type="object"
+                    groups="base.group_extended"
+                    icon="gtk-go-up" />
+                <button name="case_reset" string="Reset to Draft"
+                    states="done,cancel" type="object" icon="gtk-convert" />
+            </tree>
+        </field>
+    </record>
+
+<!-- Fund Raising Form View -->
+
+    <record model="ir.ui.view" id="crm_case_form_view_fund">
+        <field name="name">CRM - Funds Form</field>
+        <field name="model">crm.fundraising</field>
+        <field name="type">form</field>
+        <field name="arch" type="xml">
+            <form string="Funds Form">
+                <group colspan="4" col="4">
+                    <field name="name" select="1" string="Name"/>
+                    <field name="type_id" string="Payment Mode" select="1" widget="selection"
+                            domain="[('object_id.model', '=', 'crm.fundraising')]" />
+                </group>
+                <notebook colspan="4">
+                <page string="Funds">
+                    <separator colspan="4" string="Communication"/>
+                    <group colspan="4" col="4">
+                        <field name="partner_id" select="1"
+                            on_change="onchange_partner_id(partner_id, email_from)"
+                            colspan="2" />
+                        <field name="partner_address_id"
+                            string="Contact"
+                            on_change="onchange_partner_address_id(partner_address_id, email_from)"
+                            colspan="1" />
+                        <field name="email_from" colspan="2"/>
+                    </group>
+                    <separator colspan="4" string="Estimates"/>
+                    <field name="planned_cost"/>
+                    <field name="planned_revenue"/>
+                    <field name="probability"/>
+                    <separator colspan="4" string="Categorization"/>
+                    <group colspan="4" col="6">
+                        <field name="user_id" string="Responsible"/>
+                        <field name="section_id" colspan="1" widget="selection"/>
+                        <field name="categ_id" select="1"
+                            widget="selection"
+                            domain="[('object_id.model', '=', 'crm.fundraising')]" />
+                        <field name="date"/>
+                        <field name="duration"/>
+                    </group>
+                    <separator colspan="4" string="Notes"/>
+                        <field name="description" nolabel="1" colspan="4"/>
+                    <separator colspan="4"/>
+                    <group col="8" colspan="4">
+                        <field name="state"/>
+                        <button name="case_close" string="Done"
+                            states="open,draft,pending" type="object"
+                            icon="gtk-close" />
+                        <button name="case_open" string="Open"
+                            states="draft,pending" type="object"
+                            icon="gtk-go-forward" />
+                        <button name="case_cancel" string="Cancel"
+                            states="draft,open,pending" type="object"
+                            icon="gtk-cancel" />
+                        <button name="case_pending" string="Pending"
+                            states="draft,open" type="object"
+                            icon="gtk-media-pause" />
+                        <button name="case_escalate" string="Escalate"
+                            states="open,draft,pending" type="object"
+                            groups="base.group_extended"
+                            icon="gtk-go-up" />
+                        <button name="case_reset"
+                            string="Reset to Draft" states="done,cancel"
+                            type="object" icon="gtk-convert" />
+                    </group>
+                </page>
+                <page string="History" groups="base.group_extended">
+                    <field name="id" select="1"/>
+                    <field name="active"/>
+                    <field name="priority" string="Priority"/>
+                    <newline/>
+                    <field name="canal_id"/>
+                    <field name="som"/>
+                    <separator colspan="4" string="Dates"/>
+                    <field name="create_date"/>
+                    <field name="date_closed"/>
+                    <separator colspan="4" string="References"/>
+                    <field name="ref" colspan="4"/>
+                    <field name="ref2" colspan="4"/>
+
+                    <field name="log_ids" nolabel="1" colspan="4">
+                        <form string="Actions">
+                            <separator string="Action Information" colspan="4"/>
+                            <field name="name" colspan="4"/>
+                            <field name="date"/>
+                            <field name="user_id"/>
+                        </form>
+                    </field>
+                </page>
+                 <page string="Emails" groups="base.group_extended">
+                   <group colspan="4">
+                       <field colspan="4" name="email_cc" string="CC"/>
+                   </group>
+                    <field name="history_line" colspan="4" nolabel="1" mode="form,tree">
+                       <form string="Communication history">
+                            <group col="7" colspan="4">
+                                <field name="date"/>
+                                <field name="email_to"/>
+                                <field name="email_from"/>
+                                <button
+                                     string="Add a CC"
+                                               name="%(crm.action_view_crm_email_add_cc_wizard)d"
+                                               icon="gtk-add" type="action"/>
+                                   </group>
+                                   <newline/>
+                                   <field name="description" colspan="4" nolabel="1"/>
+                                   <button colspan="4"
+                                       string="Reply to Last Email"
+                                       name="%(crm.action_crm_send_mail)d"
+                                       context="{'mail':'reply', 'model': 'crm.fundraising'}"
+                                       icon="gtk-undo" type="action" />
+                               </form>
+                               <tree string="Communication history">
+                                   <field name="description"/>
+                                   <field name="email_to"/>
+                                   <field name="date"/>
+                               </tree>
+                           </field>
+                           <button colspan="4" string="Send New Email"
+                               name="%(crm.action_crm_send_mail)d"
+                               context="{'mail':'new', 'model': 'crm.fundraising'}"
+                               icon="gtk-go-forward" type="action" />
+                 </page>
+                </notebook>
+            </form>
+        </field>
+    </record>
+
+<!-- Fund Raising Calendar View -->
+
+    <record model="ir.ui.view" id="crm_case_calendar_view_fund">
+        <field name="name">CRM - Funds Calendar</field>
+        <field name="model">crm.fundraising</field>
+        <field name="type">calendar</field>
+        <field name="priority" eval="2"/>
+        <field name="arch" type="xml">
+            <calendar string="Funds" date_start="date" color="user_id" date_delay="duration">
+                <field name="name"/>
+                <field name="partner_id"/>
+            </calendar>
+        </field>
+    </record>
+
+<!-- Fund Raising Graph View -->
+
+    <record model="ir.ui.view" id="crm_case_graph_view_fund">
+        <field name="name">CRM - Funds Graph</field>
+        <field name="model">crm.fundraising</field>
+        <field name="type">graph</field>
+        <field name="arch" type="xml">
+            <graph string="Funds by Categories" type="bar" orientation="horizontal">
+                <field name="categ_id"/>
+                <field name="planned_cost" operator="+"/>
+                <field name="state" group="True"/>
+            </graph>
+        </field>
+    </record>
+
+<!-- Fund Raising Search View -->
+
+    <record id="view_crm_case_fund_filter" model="ir.ui.view">
+            <field name="name">CRM - Funds Search</field>
+            <field name="model">crm.fundraising</field>
+            <field name="type">search</field>
+            <field name="arch" type="xml">
+                <search string="Search Funds">
+                   <group col='6' colspan='4'>
+                       <filter icon="terp-partner" string="My Funds"
+                           default="1" domain="[('user_id','=',uid)]"
+                           separator="1"
+                           help="Funds Related to Current User"
+                           />
+                       <separator orientation="vertical" />
+                       <filter icon="gtk-new" string="Current Funds"
+                           domain="[('state','in',('draft', 'open'))]"
+                           help="Current Funds" />
+                       <filter icon="gtk-yes" string="Open Funds"
+                           domain="[('state','=','open')]"
+                           help="Open Funds" />
+                       <filter icon="gtk-media-pause"
+                           string="Pending Funds"
+                           domain="[('state','=','pending')]"
+                           help="Pending Funds" />
+                       <separator orientation="vertical" />
+                       <field name="state" select="1" />
+                       <field name="name" select='1'
+                           string="Fund Description" />
+                       <field name="user_id" select="1"
+                           widget="selection">
+                           <filter icon="terp-partner"
+                               domain="[('user_id','=', False)]"
+                               help="Unassigned" />
+                       </field>
+                       <field name="section_id" select="1" widget="selection" string="Sales Team">
+                           <filter icon="terp-crm"
+                               domain="[('section_id','=',context.get('section_id',False))]"
+                               help="My section" />
+                       </field>
+                   </group>
+               </search>
+            </field>
+        </record>
+
+</data>
+</openerp>
diff --git a/addons/crm_fundraising/report/__init__.py b/addons/crm_fundraising/report/__init__.py
new file mode 100644 (file)
index 0000000..747d631
--- /dev/null
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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/>.     
+#
+##############################################################################
+
+import crm_fundraising_report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/crm_fundraising/report/crm_fundraising_report.py b/addons/crm_fundraising/report/crm_fundraising_report.py
new file mode 100644 (file)
index 0000000..af867ea
--- /dev/null
@@ -0,0 +1,84 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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/>.
+#
+##############################################################################
+
+from osv import fields,osv
+import tools
+
+
+class crm_fundraising_report(osv.osv):
+    """CRM Fundraising Report"""
+
+    _name = "crm.fundraising.report"
+    _auto = False
+    _inherit = "crm.case.report"
+    _description = "CRM Fundraising Report"
+
+    _columns = {
+        'categ_id': fields.many2one('crm.case.categ', 'Category', \
+                    domain="[('section_id','=',section_id),\
+                    ('object_id.model', '=', 'crm.fundraising')]"),
+        'probability': fields.float('Avg. Probability',digits=(16,2),readonly=True, group_operator="avg"),
+        'amount_revenue': fields.float('Est.Revenue',readonly=True,digits=(16,2)),
+        'amount_revenue_prob': fields.float('Est. Rev*Prob.',digits=(16,2),readonly=True),
+        'delay_close': fields.float('Delay to close', digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"),
+        'partner_id': fields.many2one('res.partner', 'Partner'),
+        'company_id': fields.many2one('res.company', 'Company'),
+    }
+
+    def init(self, cr):
+
+        """  Display Number of cases and Average Probability
+            @param cr: the current row, from the database cursor
+        """
+
+        tools.drop_view_if_exists(cr, 'crm_fundraising_report')
+        cr.execute("""
+            create or replace view crm_fundraising_report as (
+                select
+                    min(c.id) as id,
+                    to_char(c.create_date, 'YYYY') as name,
+                    to_char(c.create_date, 'MM') as month,
+                    to_char(c.create_date, 'YYYY-MM-DD') as day,
+                    c.state,
+                    c.user_id,
+                    c.section_id,
+                    c.categ_id,
+                    c.company_id,
+                    c.partner_id,
+                    count(*) as nbr,
+                    0 as avg_answers,
+                    0.0 as perc_done,
+                    0.0 as perc_cancel,
+                    date_trunc('day',c.create_date) as create_date,
+                    sum(planned_revenue) as amount_revenue,
+                    sum(planned_revenue*probability)::decimal(16,2) as amount_revenue_prob,
+                    avg(probability)::decimal(16,2) as probability,
+                    avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as  delay_close
+                from
+                    crm_fundraising c
+                group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'),\
+                     c.state, c.user_id,c.section_id,c.categ_id,c.partner_id,c.company_id,
+                     c.create_date,to_char(c.create_date, 'YYYY-MM-DD')
+            )""")
+
+crm_fundraising_report()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/crm_fundraising/report/crm_fundraising_report_view.xml b/addons/crm_fundraising/report/crm_fundraising_report_view.xml
new file mode 100644 (file)
index 0000000..dc759d0
--- /dev/null
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+<!-- Fundraising by user and section Tree View-->
+
+        <record id="view_report_crm_fundraising_tree" model="ir.ui.view">
+            <field name="name">crm.fundraising.report.tree</field>
+            <field name="model">crm.fundraising.report</field>
+            <field name="type">tree</field>
+            <field name="arch" type="xml">
+               <tree string="Fundraising">
+                       <field name="name" invisible="1"/>
+                                       <field name="month" invisible="1"/>
+                                       <field name="section_id" invisible="1"/>
+                    <field name="user_id" invisible="1"/>
+                               <field name="company_id" invisible="1"/>
+                    <field name="partner_id" invisible="1"/>
+                       <field name="nbr" string='#Fundraising' sum="#Fundraising"/>
+                    <field name="amount_revenue"  sum='Est.Revenue'/>
+                    <field name="probability" avg='Avg. Probability' widget="progressbar"/>
+                    <field name="amount_revenue_prob" sum='Est. Rev*Prob.'/>
+                    <field name="delay_close" avg='Avg Closing Delay'/>
+                    <field name="state" invisible="1"/>
+                    <field name="categ_id" invisible="1"/>
+                    <field name="day" invisible="1"/>
+               </tree>
+            </field>
+
+<!-- Fundraising by user and section Form View-->
+
+        </record>
+        <record id="view_report_crm_fundraising_form" model="ir.ui.view">
+            <field name="name">crm.fundraising.report.form</field>
+            <field name="model">crm.fundraising.report</field>
+            <field name="inherit_id" ref="crm.view_crm_case_form"/>
+            <field name="type">form</field>
+            <field name="arch" type="xml">
+                <field name="nbr" position="after">
+                    <field name="delay_close"/>
+                    <field name="amount_revenue"/>
+                    <field name="amount_revenue_prob"/>
+                    <field name="probability"/>
+                </field>
+            </field>
+        </record>
+
+<!-- Fundraising by user and section Graph View-->
+
+        <record id="view_report_crm_fundraising_graph" model="ir.ui.view">
+            <field name="name">crm.fundraising.report.graph</field>
+            <field name="model">crm.fundraising.report</field>
+            <field name="type">graph</field>
+            <field name="arch" type="xml">
+                <graph orientation="horizontal" string="Fundraising" type="bar">
+                    <field name="state"/>
+                    <field name="nbr" operator="+"/>
+                    <field group="True" name="user_id"/>
+                </graph>
+            </field>
+        </record>
+
+<!-- Fundraising by user and section Search View-->
+
+        <record id="view_report_crm_fundraising_filter" model="ir.ui.view">
+            <field name="name">crm.fundraising.report.select</field>
+            <field name="model">crm.fundraising.report</field>
+            <field name="inherit_id" ref="crm.view_crm_case_filter"/>
+            <field name="type">search</field>
+            <field name="arch" type="xml">
+            <data>
+               <xpath expr='//search[@string="Search"]/group[@string="Extended options..."]/filter[@string="Cancel"]' position='after'>
+               <group>
+                   <separator orientation="vertical"/>
+                       <field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.fundraising')]"/>
+                    </group>
+               </xpath>
+                </data>
+            </field>
+        </record>
+
+<!-- Fundraising by user and section Action -->
+
+        <record id="action_report_crm_fundraising" model="ir.actions.act_window">
+            <field name="name">Fundraising</field>
+            <field name="res_model">crm.fundraising.report</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,graph</field>
+            <field name="context">{"search_default_User":1,"search_default_This Month":1,'group_by_no_leaf':1,'group_by':[]}</field>
+            <field name="view_id" ref="view_report_crm_fundraising_tree"/>
+            <field name="search_view_id" ref="view_report_crm_fundraising_filter"/>
+        </record>
+
+
+           <record model="ir.actions.act_window.view" id="action_report_crm_fundrising_tree">
+            <field name="sequence" eval="1"/>
+            <field name="view_mode">tree</field>
+            <field name="view_id" ref="view_report_crm_fundraising_tree"/>
+            <field name="act_window_id" ref="action_report_crm_fundraising"/>
+        </record>
+
+        <record model="ir.actions.act_window.view" id="action_report_crm_fundrising_graph">
+            <field name="sequence" eval="2"/>
+            <field name="view_mode">graph</field>
+            <field name="view_id" ref="view_report_crm_fundraising_graph"/>
+            <field name="act_window_id" ref="action_report_crm_fundraising"/>
+        </record>
+
+        <menuitem name="Fundraising"
+            action="action_report_crm_fundraising"
+            groups="base.group_extended"
+            id="menu_report_crm_fundraising_tree" parent="base.next_id_64" />
+
+    </data>
+</openerp>
diff --git a/addons/crm_fundraising/security/ir.model.access.csv b/addons/crm_fundraising/security/ir.model.access.csv
new file mode 100644 (file)
index 0000000..43e6075
--- /dev/null
@@ -0,0 +1,3 @@
+"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
+"access_crm_fundraising","crm.fundraising","model_crm_fundraising","crm.group_crm_manager",1,1,1,1
+"access_crm_fundraising_report_user","crm.fundraising.report","model_crm_fundraising_report","crm.group_crm_user",1,0,0,0