[IMP] optimize code
This commit is contained in:
parent
d0df0175ec
commit
27ee024847
|
@ -120,17 +120,16 @@ class crm_case_section(osv.osv):
|
|||
return res
|
||||
|
||||
_columns = {
|
||||
'resource_calendar_id': fields.many2one('resource.calendar', "Working Time", help="Used to compute open days"),
|
||||
'stage_ids': fields.many2many('crm.case.stage', 'section_stage_rel', 'section_id', 'stage_id', 'Stages'),
|
||||
'use_leads': fields.boolean('Leads',
|
||||
help="The first contact you get with a potential customer is a lead you qualify before converting it into a real business opportunity. Check this box to manage leads in this sales team."),
|
||||
|
||||
'monthly_open_leads': fields.function(_get_opportunities_data,
|
||||
type="string", readonly=True, multi='_get_opportunities_data',
|
||||
string='Open Leads per Month'),
|
||||
'monthly_planned_revenue': fields.function(_get_opportunities_data,
|
||||
type="string", readonly=True, multi='_get_opportunities_data',
|
||||
string='Planned Revenue per Month'),
|
||||
'resource_calendar_id': fields.many2one('resource.calendar', "Working Time", help="Used to compute open days"),
|
||||
}
|
||||
|
||||
def _get_stage_common(self, cr, uid, context):
|
||||
|
|
|
@ -118,7 +118,6 @@
|
|||
</record>
|
||||
|
||||
<!-- Case Sections Action -->
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_kanban_view_salesteams_oppor11">
|
||||
<field name="sequence" eval="0"/>
|
||||
<field name="view_mode">kanban</field>
|
||||
|
|
|
@ -195,7 +195,6 @@ class crm_lead(format_address, osv.osv):
|
|||
resource_id = resource_ids[0]
|
||||
|
||||
duration = float(ans.days)
|
||||
|
||||
if lead.section_id and lead.section_id.resource_calendar_id:
|
||||
duration = float(ans.days) * 24
|
||||
new_dates = cal_obj.interval_get(cr,
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
<field name="users" eval="[(4, ref('base.user_root'))]"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="group_fund_raising" model="res.groups">
|
||||
<field name="name">Manage Fund Raising</field>
|
||||
<field name="category_id" ref="base.module_category_hidden"/>
|
||||
|
|
|
@ -282,6 +282,7 @@ class gamification_goal(osv.Model):
|
|||
_logger.exception(_('Invalid return content from the evaluation of code for definition %s' % definition.name))
|
||||
|
||||
else: # count or sum
|
||||
|
||||
obj = self.pool.get(definition.model_id.model)
|
||||
field_date_name = definition.field_date_id and definition.field_date_id.name or False
|
||||
|
||||
|
@ -345,6 +346,7 @@ class gamification_goal(osv.Model):
|
|||
if not value:
|
||||
continue
|
||||
goal = all_goals[goal_id]
|
||||
|
||||
# check goal target reached
|
||||
if (goal.definition_condition == 'higher' and value.get('current', goal.current) >= goal.target_goal) \
|
||||
or (goal.definition_condition == 'lower' and value.get('current', goal.current) <= goal.target_goal):
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import sales_crm_account_invoice_report
|
||||
import sale_report
|
||||
import sale_analysis_report
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import calendar
|
||||
from openerp import tools
|
||||
from datetime import date, datetime, timedelta
|
||||
|
@ -390,7 +391,6 @@ class sale_order(osv.osv):
|
|||
invoice_vals.update(self._inv_get(cr, uid, order, context=context))
|
||||
return invoice_vals
|
||||
|
||||
|
||||
def _make_invoice(self, cr, uid, order, lines, context=None):
|
||||
inv_obj = self.pool.get('account.invoice')
|
||||
obj_invoice_line = self.pool.get('account.invoice.line')
|
||||
|
@ -1013,9 +1013,9 @@ class mail_compose_message(osv.Model):
|
|||
self.pool.get('sale.order').signal_quotation_sent(cr, uid, [context['default_res_id']])
|
||||
return super(mail_compose_message, self).send_mail(cr, uid, ids, context=context)
|
||||
|
||||
|
||||
class account_invoice(osv.Model):
|
||||
_inherit = 'account.invoice'
|
||||
|
||||
_columns = {
|
||||
'section_id': fields.many2one('crm.case.section', 'Sales Team'),
|
||||
}
|
||||
|
|
|
@ -565,9 +565,7 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- search by Salesteams -->
|
||||
|
||||
<record id="action_orders_salesteams" model="ir.actions.act_window">
|
||||
<field name="name">Sales Orders</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
|
|
|
@ -21,6 +21,5 @@
|
|||
|
||||
import wizard
|
||||
import sale_crm
|
||||
import report
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -22,4 +22,3 @@ import sale_team
|
|||
import sale_team_config
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
'website': 'http://www.openerp.com',
|
||||
'depends' : ['base','mail','web_kanban_sparkline',],
|
||||
'data': ['security/sale_team_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'res_config_view.xml',
|
||||
'ir.model.access.csv',
|
||||
'sale_team_data.xml',
|
||||
'sale_team.xml',],
|
||||
'demo': ['sale_team_demo.xml'],
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_sale_config_settings" model="ir.ui.view">
|
||||
<field name="name">crm settings</field>
|
||||
<field name="model">sale.team.config.settings</field>
|
||||
|
@ -17,11 +16,11 @@
|
|||
<field name="group_multi_salesteams" class="oe_inline"/>
|
||||
<label for="group_multi_salesteams"/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</group>
|
||||
</div>
|
||||
</data></field>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -19,17 +19,13 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
import calendar
|
||||
from datetime import date, datetime
|
||||
from dateutil import relativedelta
|
||||
|
||||
from openerp import tools
|
||||
from openerp.osv import fields
|
||||
from openerp.osv import osv
|
||||
|
||||
|
||||
|
||||
class crm_case_section(osv.osv):
|
||||
_name = "crm.case.section"
|
||||
_inherit = ['mail.thread', 'ir.needaction_mixin']
|
||||
|
@ -146,6 +142,3 @@ class res_users(osv.Model):
|
|||
self.SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS)
|
||||
self.SELF_WRITEABLE_FIELDS.extend(['default_section_id'])
|
||||
return init_res
|
||||
|
||||
|
||||
|
|
@ -75,10 +75,7 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<!-- Case Sections Search view -->
|
||||
|
||||
<record id="crm_case_section_salesteams_search" model="ir.ui.view">
|
||||
<field name="name">Case Sections - Search</field>
|
||||
<field name="model">crm.case.section</field>
|
||||
|
@ -99,7 +96,6 @@
|
|||
</record>
|
||||
|
||||
<!-- Case Sections Action -->
|
||||
|
||||
<record id="crm_case_section_salesteams_act" model="ir.actions.act_window">
|
||||
<field name="name">Sales Teams</field>
|
||||
<field name="res_model">crm.case.section</field>
|
||||
|
@ -175,7 +171,6 @@
|
|||
</record>
|
||||
|
||||
<!-- Case Sections Tree View -->
|
||||
|
||||
<record id="crm_case_section_view_tree" model="ir.ui.view">
|
||||
<field name="name">crm.case.section.tree</field>
|
||||
<field name="model">crm.case.section</field>
|
||||
|
@ -189,15 +184,6 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Case Sections Action -->
|
||||
|
||||
<!--<record model="ir.actions.act_window.view" id="action_crm_tag_kanban_view_salesteams_oppor11">
|
||||
<field name="sequence" eval="0"/>
|
||||
<field name="view_mode">kanban</field>
|
||||
<field name="view_id" ref="crm_case_kanban_view_leads"/>
|
||||
<field name="act_window_id" ref="crm_case_form_view_salesteams_opportunity"/>
|
||||
</record>-->
|
||||
|
||||
<record id="crm_case_section_act" model="ir.actions.act_window">
|
||||
<field name="name">Sales Teams</field>
|
||||
<field name="res_model">crm.case.section</field>
|
||||
|
@ -213,7 +199,6 @@
|
|||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="sale_team.menu_sale_team_act" action="crm_case_section_salesteams_act" sequence="1" parent="base.menu_sales"/>
|
||||
</data>
|
||||
</openerp>
|
|
@ -1,8 +1,27 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-today OpenERP SA (<http://www.openerp.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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp import SUPERUSER_ID
|
||||
from openerp.osv import fields, osv
|
||||
|
||||
|
||||
class sala_team_configuration(osv.TransientModel):
|
||||
_name = 'sale.team.config.settings'
|
||||
_inherit = ['sale.config.settings', 'fetchmail.config.settings']
|
||||
|
@ -35,11 +54,7 @@ class sala_team_configuration(osv.TransientModel):
|
|||
return True
|
||||
|
||||
_columns = {
|
||||
|
||||
'group_multi_salesteams': fields.boolean("Organize Sales activities into multiple Sales Teams",
|
||||
implied_group='base.group_multi_salesteams',
|
||||
help="""Allows you to use Sales Teams to manage your leads and opportunities."""),
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -15,6 +15,5 @@
|
|||
<field name="code">SPD</field>
|
||||
<field name="member_ids" eval="[(4, ref('base.user_root')),(4, ref('base.user_demo'))]"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -2,4 +2,3 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
|||
access_crm_case_section,crm.case.section,model_crm_case_section,base.group_user,1,0,0,0
|
||||
access_crm_case_section_user,crm.case.section.user,model_crm_case_section,base.group_sale_salesman,1,0,0,0
|
||||
access_crm_case_section_manager,crm.case.section.manager,model_crm_case_section,base.group_sale_manager,1,1,1,1
|
||||
|
|
|
@ -35,6 +35,5 @@
|
|||
<record model="ir.ui.menu" id="base.menu_base_config">
|
||||
<field eval="[(4, ref('base.group_sale_manager'))]" name="groups_id"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue