소스 검색

commit smarticon_iniciativas

sebas 8 년 전
커밋
a80e811f00
7개의 변경된 파일201개의 추가작업 그리고 0개의 파일을 삭제
  1. 27 0
      __init__.py
  2. BIN
      __init__.pyc
  3. 45 0
      __openerp__.py
  4. 48 0
      res_partner.py
  5. BIN
      res_partner.pyc
  6. 81 0
      res_partner_view.xml
  7. BIN
      static/description/icon.png

+ 27 - 0
__init__.py

@@ -0,0 +1,27 @@
+# -*- encoding: utf-8 -*-
+#################################################################################
+#                                                                               #
+#    product_brand for OpenERP                                                  #
+#    Copyright (C) 2009 NetAndCo (<http://www.netandco.net>).                   #
+#    Authors, Mathieu Lemercier, mathieu@netandco.net,                          #
+#             Franck Bret, franck@netandco.net                                  #
+#    Copyright (C) 2011 Akretion Benoît Guillot <benoit.guillot@akretion.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/>.      #
+#                                                                               #
+#################################################################################
+###################################################################################
+# Product Brand is an Openobject module wich enable Brand management for products #
+###################################################################################
+from . import res_partner

BIN
__init__.pyc


+ 45 - 0
__openerp__.py

@@ -0,0 +1,45 @@
+# -*- encoding: utf-8 -*-
+#################################################################################
+#                                                                               #
+#    product_features for OpenERP                                                  #
+#    Copyright (C) 2009 NetAndCo (<http://www.netandco.net>).                   #
+#    Authors, Mathieu Lemercier, mathieu@netandco.net,                          #
+#             Franck Bret, franck@netandco.net                                  #
+#    Copyright (C) 2011 Akretion Benoît Guillot <benoit.guillot@akretion.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/>.      #
+#                                                                               #
+#################################################################################
+###################################################################################
+# Product features is an Openobject module wich enable features management for products #
+###################################################################################
+{
+    'name': 'Smarticon para Iniciativas CRM',
+    'version': '0.1',
+    'category': 'CRM',
+    'description': """
+Smarticon para Iniciativas CRM
+========================================
+
+Smarticon para Iniciativas CRM
+
+    """,
+    'author': 'Eiru/Sebastian Penayo',
+    'website': '',
+	'depends': ['crm', 'report', 'base'],
+    'data': [
+		'res_partner_view.xml',
+    ],
+    'installable': True,
+}

+ 48 - 0
res_partner.py

@@ -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/>.
+#
+##############################################################################
+
+
+from openerp.osv import fields,osv
+
+class res_partner(osv.osv):
+    """ Inherits partner and adds CRM information in the partner form """
+    _inherit = 'res.partner'
+
+    #for partner in self.browse(cr, uid, ids, context):
+    def _iniciativa_count(self, cr, uid, ids, field_name, arg, context=None):
+        res = dict(map(lambda x: (x,0), ids))
+        # The current user may not have access rights for sale orders
+        try:
+            for partner in self.browse(cr, uid, ids, context):
+                operator = '='
+                ini_ids = self.pool['crm.lead'].search(cr, uid, [('partner_id', operator, partner.id), ('type', '=', 'lead')], context=context)
+                res[partner.id] = {
+                    'iniciativa_count': len(ini_ids),
+                }
+        except:
+            pass
+        return res
+
+    _columns = {
+        'iniciativa_ids': fields.one2many('crm.lead', 'partner_id',\
+            'Leads'),
+        'iniciativa_count': fields.function(_iniciativa_count, string="Lead", type='integer'),
+    }

BIN
res_partner.pyc


+ 81 - 0
res_partner_view.xml

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+  <data>
+
+		<record id="relate_partner_leads" model="ir.actions.act_window">
+      <field name="name">Iniciativas</field>
+      <field name="res_model">crm.lead</field>
+      <field name="view_mode">tree,form</field>
+      <field name="domain">[('type','=','lead')]</field>
+      <field name="context">{
+          'search_default_partner_id': active_id,
+          'stage_type': 'lead',
+          'default_type': 'lead'
+      }</field>
+      <field name="view_id" eval="False"/>
+      <field name="search_view_id" ref="crm.view_crm_case_leads_filter"/>
+      <field name="help" type="html">
+        <p class="oe_view_nocontent_create">
+          Click to create an lead related to this customer.
+        </p><p>
+          Use leads to keep track of your sales pipeline, follow
+          up potential sales and better forecast your future revenues.
+        </p><p>
+          You will be able to plan meetings and phone calls from
+          leads, convert them into quotations, attach related
+          documents, track all discussions, and much more.
+        </p>
+      </field>
+    </record>
+
+    <record model="ir.actions.act_window.view" id="action_crm_tag_tree_view_lead11">
+          <field name="sequence" eval="1"/>
+          <field name="view_mode">tree</field>
+          <field name="view_id" ref="crm.crm_case_tree_view_leads"/>
+          <field name="act_window_id" ref="relate_partner_leads"/>
+      </record>
+
+      <record model="ir.actions.act_window.view" id="action_crm_tag_form_view_lead11">
+          <field name="sequence" eval="2"/>
+          <field name="view_mode">form</field>
+          <field name="view_id" ref="crm.crm_case_form_view_leads"/>
+          <field name="act_window_id" ref="relate_partner_leads"/>
+      </record>
+
+		<!-- Partner kanban view inherte -->
+    <record model="ir.ui.view" id="crm_lead_partner_kanban_view">
+        <field name="name">res.partner.kanban.inherit1</field>
+        <field name="model">res.partner</field>
+        <field name="inherit_id" ref="base.res_partner_kanban_view"/>
+        <field name="priority" eval="10"/>
+        <field name="arch" type="xml">
+            <field name="mobile" position="after">
+                <field name="iniciativa_count"/>
+            </field>
+            <xpath expr="//div[@class='oe_kanban_partner_links']" position="inside">
+                <a name="%(relate_partner_leads)d" type="action">
+                    <t t-esc="record.iniciativa_count.value"/> Iniciativas
+                </a>
+            </xpath>
+        </field>
+    </record>
+
+		<!--  Partners inherited form -->
+    <record id="view_partners_form_crm1" model="ir.ui.view">
+          <field name="name">view.res.partner.form.crm.inherited1</field>
+          <field name="model">res.partner</field>
+          <field name="inherit_id" ref="base.view_partner_form"/>
+          <field name="priority" eval="55"/>
+          <field name="arch" type="xml">
+                <xpath expr="//div[@name='buttons']" position="inside">
+                  <button class="oe_inline oe_stat_button" type="action" name="%(relate_partner_leads)d"
+                      attrs="{'invisible': [('customer', '=', False)]}"
+                      icon="fa-star"
+                      context="{'search_default_partner_id': active_id}">
+                      <field string="Iniciativas" name="iniciativa_count" widget="statinfo"/>
+                  </button>
+                </xpath>
+            </field>
+       </record>
+  </data>
+</openerp>

BIN
static/description/icon.png