From 05a9270e474ac10a7c1bd08f37a94459cafe0615 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Fri, 22 Mar 2013 17:09:34 +0100 Subject: [PATCH 1/6] [IMP] crm.case.section,salesteams: kanban bzr revid: chm@openerp.com-20130322160934-3mekvjm9hxaiwp4b --- addons/crm/crm_case_section_view.xml | 12 ++++----- addons/crm/crm_lead.py | 2 +- addons/crm/static/src/css/crm.css | 38 +++++++++++++++++++--------- addons/sale_crm/sale_crm.py | 13 ++++++++++ addons/sale_crm/sale_crm_view.xml | 15 +++++++---- 5 files changed, 56 insertions(+), 24 deletions(-) diff --git a/addons/crm/crm_case_section_view.xml b/addons/crm/crm_case_section_view.xml index c92da5ee426..82e337e0db3 100644 --- a/addons/crm/crm_case_section_view.xml +++ b/addons/crm/crm_case_section_view.xml @@ -84,7 +84,7 @@ -
+
í
    @@ -95,18 +95,18 @@

-
+
%%
-
- + -
+
diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 4dfef9f1f46..1f601c3edcf 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -94,7 +94,7 @@ class crm_lead(base_stage, format_address, osv.osv): def onchange_user_id(self, cr, uid, ids, section_id, user_id, context=None): if user_id: section_ids = self.pool.get('crm.case.section').search(cr, uid, ['|', ('user_id', '=', user_id), ('member_ids', '=', user_id)], context=context) - if section_id not in section_ids: + if section_id and section_id not in section_ids: section_id = section_ids[0] return {'value': {'section_id': section_id}} diff --git a/addons/crm/static/src/css/crm.css b/addons/crm/static/src/css/crm.css index 25494a761b5..5bdf51f66c6 100644 --- a/addons/crm/static/src/css/crm.css +++ b/addons/crm/static/src/css/crm.css @@ -1,12 +1,12 @@ -.oe_kanban_crm_salesteams { - width: 220px; - min-height: 160px; +.openerp .oe_kanban_view .oe_kanban_crm_salesteams { + width: 300px; } -.oe_kanban_crm_salesteams_avatars { - margin-top: 8px; +.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_avatars { + text-align: right; + margin: -5px 0 -10px 0; } -.oe_kanban_crm_salesteams_avatars img { +.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_avatars img { width: 30px; height: 30px; padding-left: 0px; @@ -19,11 +19,11 @@ -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); } -.oe_kanban_crm_salesteams_alias { +.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_alias { margin: -8px 0 8px 0; } -.oe_kanban_crm_salesteams_alias .oe_e { +.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_alias .oe_e { font-size: 30px; line-height: 6px; vertical-align: top; @@ -32,10 +32,24 @@ text-shadow: 0px 0px 2px rgba(0, 0, 0, 1); float: left; } - -.oe_kanban_crm_salesteams_list a { - white-space: nowrap; +.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_items_list { + margin: 10px 0; } -.oe_kanban_crm_salesteams_list a:hover { +.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_items_list a { + width: 96px; + display: inline-block; +} +.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_items_list a:hover { text-decoration: underline !important; +} +.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_center { + text-align: center; + margin: 3px 0; +} +.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_center .oe_sum { + margin: 0; + font-size: 40px; +} +.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_center .oe_subsum { + font-size: 10px; } \ No newline at end of file diff --git a/addons/sale_crm/sale_crm.py b/addons/sale_crm/sale_crm.py index ed3ddb600d2..56706fc408c 100644 --- a/addons/sale_crm/sale_crm.py +++ b/addons/sale_crm/sale_crm.py @@ -20,6 +20,8 @@ ############################################################################## from openerp.osv import osv, fields +from datetime import datetime +from openerp import tools class sale_order(osv.osv): _inherit = 'sale.order' @@ -53,10 +55,21 @@ class crm_case_section(osv.osv): res[section_id] = obj.search(cr, uid, [("section_id", "=", section_id),('state','not in',['draft','cancel'])], count=True, context=context) return res + def _get_sum_month_invoice(self, cr, uid, ids, field_name, arg, context=None): + res = dict.fromkeys(ids, 0) + obj = self.pool.get('account.invoice.report') + when = datetime.today() + for section_id in ids: + invoice_ids = obj.search(cr, uid, [("section_id", "=", section_id), ('state', 'not in', ['draft', 'cancel']), ('year', '=', when.year), ('month', '=', when.month > 9 and when.month or "0%s" % when.month)], context=context) + for invoice in obj.browse(cr, uid, invoice_ids, context=context): + res[section_id] += invoice.price_total + return res + _columns = { 'number_saleorder': fields.function(_get_number_saleorder, type='integer', readonly=True), 'number_quotation': fields.function(_get_number_quotation, type='integer', readonly=True), 'number_invoice': fields.function(_get_number_invoice, type='integer', readonly=True), + 'sum_month_invoice': fields.function(_get_sum_month_invoice, type='integer', readonly=True), } class res_users(osv.Model): diff --git a/addons/sale_crm/sale_crm_view.xml b/addons/sale_crm/sale_crm_view.xml index a0e248f8b8c..937481ad005 100644 --- a/addons/sale_crm/sale_crm_view.xml +++ b/addons/sale_crm/sale_crm_view.xml @@ -186,20 +186,25 @@ - - + + QuotationQuotations - + Sales OrderSales Orders - + InvoiceInvoices + +
+
+
Invoiced this month
+
+
- From a4d3976caffcb6ecae5554911a3b8d444ace754a Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Mon, 25 Mar 2013 11:25:55 +0100 Subject: [PATCH 2/6] [IMP] sales teams: in progress bzr revid: chm@openerp.com-20130325102555-5q3j1y5dapohgax5 --- addons/crm/crm.py | 6 ++++-- addons/crm/crm_case_section_view.xml | 27 ++++++++++++++++++--------- addons/crm/crm_lead.py | 4 ++-- addons/crm/static/src/css/crm.css | 3 +++ 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/addons/crm/crm.py b/addons/crm/crm.py index d7e1fba40e9..257e69e1542 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -129,10 +129,11 @@ class crm_case_section(osv.osv): help="The email address associated with this team. New emails received will automatically " "create new leads assigned to the team."), 'open_lead_ids': fields.one2many('crm.lead', 'section_id', 'Leads', readonly=True, - domain=[('type', '!=', 'opportunity'), ('state', 'not in', ['done', 'cancel'])]), + domain=['&', ('type', '!=', 'opportunity'), ('state', 'not in', ['done', 'cancel'])]), 'open_opportunity_ids': fields.one2many('crm.lead', 'section_id', 'Opportunities', readonly=True, - domain=['&', ('type', '=', 'opportunity'), ('type', '=', 'both'), ('state', 'not in', ['done', 'cancel'])]), + domain=['&', '|', ('type', '=', 'opportunity'), ('type', '=', 'both'), ('state', 'not in', ['done', 'cancel'])]), 'color': fields.integer('Color Index'), + 'use_leads': fields.boolean('Leads', help="If checked, this sales teams will be available in the sales teams menu and you will be able to manage leads"), } def _get_stage_common(self, cr, uid, context): @@ -142,6 +143,7 @@ class crm_case_section(osv.osv): _defaults = { 'active': 1, 'stage_ids': _get_stage_common, + 'use_leads': True, } _sql_constraints = [ diff --git a/addons/crm/crm_case_section_view.xml b/addons/crm/crm_case_section_view.xml index 82e337e0db3..446664ae7b9 100644 --- a/addons/crm/crm_case_section_view.xml +++ b/addons/crm/crm_case_section_view.xml @@ -74,6 +74,7 @@ crm.case.section + @@ -95,11 +96,11 @@

-
+
%%
- + LeadsLead @@ -147,23 +148,31 @@
+
+
- - - - - - + + + + + diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 1f601c3edcf..e62f33bb5d5 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -85,9 +85,9 @@ class crm_lead(base_stage, format_address, osv.osv): } def get_empty_list_help(self, cr, uid, help, context=None): - if context.get('default_type', None) == 'lead': + if context.get('default_type') == 'lead': context['empty_list_help_model'] = 'crm.case.section' - context['empty_list_help_id'] = context.get('default_section_id', None) + context['empty_list_help_id'] = context.get('default_section_id') context['empty_list_help_document_name'] = _("leads") return super(crm_lead, self).get_empty_list_help(cr, uid, help, context=context) diff --git a/addons/crm/static/src/css/crm.css b/addons/crm/static/src/css/crm.css index 5bdf51f66c6..2815ed3eff1 100644 --- a/addons/crm/static/src/css/crm.css +++ b/addons/crm/static/src/css/crm.css @@ -52,4 +52,7 @@ } .openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_center .oe_subsum { font-size: 10px; +} +.openerp .oe_form_editable .oe_form .oe_read_only { + display: none; } \ No newline at end of file From 547343e3af7abbbce711fbcc306b54d94b9ad918 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Mon, 25 Mar 2013 12:54:38 +0100 Subject: [PATCH 3/6] [IMP] crm.case.section: salesteams view and search bzr revid: chm@openerp.com-20130325115438-xofnoi1ua6tk1dxr --- addons/crm/crm_case_section_view.xml | 20 +------------------- addons/crm/crm_lead_menu.xml | 19 +------------------ addons/crm/crm_lead_view.xml | 4 ++-- addons/sale/sale_view.xml | 4 ++-- addons/sale_crm/sale_crm_view.xml | 8 +++++--- 5 files changed, 11 insertions(+), 44 deletions(-) diff --git a/addons/crm/crm_case_section_view.xml b/addons/crm/crm_case_section_view.xml index 446664ae7b9..ab06a6b2fc7 100644 --- a/addons/crm/crm_case_section_view.xml +++ b/addons/crm/crm_case_section_view.xml @@ -27,20 +27,6 @@ - - @@ -167,7 +153,7 @@ - +
@@ -280,10 +266,6 @@ - - ['|', ('type','=','lead'), ('type','=',False)] - { - 'default_type':'lead', - 'stage_type':'lead' - } + {'default_type':'lead', 'stage_type':'lead', 'search_default_unassigned':1}

Use leads if you need a qualification step before creating an @@ -26,20 +23,6 @@ - - Opportunities crm.lead diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 6fdee2d42e5..71cbe4a86f9 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -334,7 +334,7 @@ - + - + form tree,form,calendar,graph - {'show_address': 1} + {'show_address': 1, 'search_default_my_sale_orders_filter': 1} [('state','not in',('draft','sent','cancel'))]

@@ -372,7 +372,7 @@ form tree,form,calendar,graph - {'show_address': 1} + {'show_address': 1, 'search_default_my_sale_orders_filter': 1} [('state','in',('draft','sent','cancel'))] diff --git a/addons/sale_crm/sale_crm_view.xml b/addons/sale_crm/sale_crm_view.xml index 937481ad005..c7b10dbacd4 100644 --- a/addons/sale_crm/sale_crm_view.xml +++ b/addons/sale_crm/sale_crm_view.xml @@ -124,7 +124,8 @@ [('state','not in',('draft','sent','cancel'))] { - 'search_default_section_id': [active_id], 'default_section_id': active_id + 'search_default_section_id': [active_id], 'default_section_id': active_id, + 'search_default_my_sale_orders_filter': 1 }

@@ -145,7 +146,8 @@ tree,form,calendar,graph { - 'search_default_section_id': [active_id], 'default_section_id': active_id, 'show_address': 1 + 'search_default_section_id': [active_id], 'default_section_id': active_id, 'show_address': 1, + 'search_default_my_sale_orders_filter': 1 } [('state','in',('draft','sent','cancel'))] @@ -193,7 +195,7 @@ Sales OrderSales Orders - + InvoiceInvoices From a98861a7166f0f60cab59b54925928f7b2defad1 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Mon, 25 Mar 2013 17:32:04 +0100 Subject: [PATCH 4/6] [IMP] crm: add settings options multi sales teams bzr revid: chm@openerp.com-20130325163204-np98t3rywso3le35 --- addons/crm/crm.py | 9 +++++++++ addons/crm/crm_case_section_view.xml | 16 +++++++++++++++- addons/crm/security/crm_security.xml | 5 +++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/addons/crm/crm.py b/addons/crm/crm.py index 257e69e1542..0c103c8fba6 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -236,4 +236,13 @@ class crm_payment_mode(osv.osv): 'section_id': fields.many2one('crm.case.section', 'Sales Team'), } + +class base_config_settings(osv.osv_memory): + _inherit = 'base.config.settings' + _columns = { + 'group_multi_salesteams': fields.boolean("Use mutli sales teams", + implied_group='crm.group_multi_salesteams', + help=""" """), + } + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/crm/crm_case_section_view.xml b/addons/crm/crm_case_section_view.xml index ab06a6b2fc7..a230f0217ba 100644 --- a/addons/crm/crm_case_section_view.xml +++ b/addons/crm/crm_case_section_view.xml @@ -266,11 +266,25 @@ + + base.config.settings.crm + base.config.settings + + + +

+ +
+ + + + + groups="crm.group_multi_salesteams"/> \ No newline at end of file diff --git a/addons/crm/security/crm_security.xml b/addons/crm/security/crm_security.xml index 2c34252209c..2a06840685f 100644 --- a/addons/crm/security/crm_security.xml +++ b/addons/crm/security/crm_security.xml @@ -22,6 +22,11 @@ + + + Use mutli sales teams + + Manage Fund Raising From 454d3a0d4b0584c8e6edc6445254d499715b1748 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Mon, 25 Mar 2013 17:51:25 +0100 Subject: [PATCH 5/6] [IMP] crm.case.section,salesteams: add groups multi_salesteams bzr revid: chm@openerp.com-20130325165125-a5t5fdbnz9rqw1jp --- addons/crm/crm.py | 2 +- addons/crm/crm_case_section_view.xml | 2 +- addons/crm/crm_lead_view.xml | 16 +++++----- addons/crm/crm_phonecall_view.xml | 4 +-- addons/crm/crm_report_view.xml | 32 +++++++++---------- addons/crm/crm_view.xml | 12 +++---- addons/crm/report/crm_lead_report_view.xml | 6 ++-- .../crm/report/crm_phonecall_report_view.xml | 4 +-- addons/crm/res_partner_view.xml | 2 +- addons/crm/security/crm_security.xml | 2 +- .../wizard/crm_lead_to_opportunity_view.xml | 6 ++-- .../wizard/crm_merge_opportunities_view.xml | 2 +- .../crm_opportunity_to_phonecall_view.xml | 2 +- .../crm_phonecall_to_phonecall_view.xml | 2 +- addons/crm_claim/crm_claim_view.xml | 2 +- .../report/crm_claim_report_view.xml | 4 +-- addons/crm_helpdesk/crm_helpdesk_view.xml | 6 ++-- .../report/crm_helpdesk_report_view.xml | 4 +-- .../report/crm_lead_report_view.xml | 4 +-- .../report/crm_partner_report_view.xml | 4 +-- .../crm_partner_assign/res_partner_view.xml | 2 +- .../report/project_issue_report_view.xml | 2 +- .../sale_crm_account_invoice_report_view.xml | 2 +- addons/sale_crm/sale_crm_view.xml | 8 ++--- 24 files changed, 66 insertions(+), 66 deletions(-) diff --git a/addons/crm/crm.py b/addons/crm/crm.py index 0c103c8fba6..bb2a71f55fd 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -241,7 +241,7 @@ class base_config_settings(osv.osv_memory): _inherit = 'base.config.settings' _columns = { 'group_multi_salesteams': fields.boolean("Use mutli sales teams", - implied_group='crm.group_multi_salesteams', + implied_group='base.group_multi_salesteams', help=""" """), } diff --git a/addons/crm/crm_case_section_view.xml b/addons/crm/crm_case_section_view.xml index a230f0217ba..73f99707eda 100644 --- a/addons/crm/crm_case_section_view.xml +++ b/addons/crm/crm_case_section_view.xml @@ -285,6 +285,6 @@ id="crm.menu_crm_case_section_act" sequence="1" parent="base.menu_sales" - groups="crm.group_multi_salesteams"/> + groups="base.group_multi_salesteams"/> \ No newline at end of file diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index a1b547ca8a2..402116e2258 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -153,8 +153,8 @@ -