[MOVE] crm: crm.stage code moved from crm to crm_stage.py file; moved

its views in its own file. Just reorganizing things before cleaning
a bit.
This commit is contained in:
Fabien Pinckaers
2015-07-30 10:19:14 +02:00
committed by Thibault Delavallée
parent dc736426dd
commit a056a5d890
10 changed files with 66 additions and 65 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import crm
import crm_stage
import crm_lead
import sales_team
import models
+1
View File
@@ -56,6 +56,7 @@ Dashboard for CRM will include:
'wizard/crm_merge_opportunities_view.xml',
'crm_view.xml',
'crm_stage_views.xml',
'crm_lead_view.xml',
'crm_lead_menu.xml',
'views/crm_action_views.xml',
+5 -5
View File
@@ -5,11 +5,11 @@ from datetime import datetime, timedelta
import logging
from operator import itemgetter
import crm
import openerp
from openerp import SUPERUSER_ID
from openerp import tools, api
from openerp.addons.base.res.res_partner import format_address
from openerp.addons.crm import crm_stage
from openerp.osv import fields, osv
from openerp.tools.translate import _
from openerp.tools import email_re, email_split
@@ -183,7 +183,7 @@ class crm_lead(format_address, osv.osv):
[('lead', 'Lead'), ('opportunity', 'Opportunity')],
string='Type', select=True, required=True,
help="Type is used to separate Leads and Opportunities"),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority', select=True),
'priority': fields.selection(crm_stage.AVAILABLE_PRIORITIES, 'Priority', select=True),
'date_closed': fields.datetime('Closed', readonly=True, copy=False),
'stage_id': fields.many2one('crm.stage', 'Stage', track_visibility='onchange', select=True,
domain="['&', ('team_ids', '=', team_id), '|', ('type', '=', type), ('type', '=', 'both')]"),
@@ -248,7 +248,7 @@ class crm_lead(format_address, osv.osv):
'stage_id': lambda s, cr, uid, c: s._get_default_stage_id(cr, uid, c),
'team_id': lambda s, cr, uid, c: s.pool['crm.team']._get_default_team_id(cr, uid, context=c),
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.lead', context=c),
'priority': lambda *a: crm.AVAILABLE_PRIORITIES[0][0],
'priority': lambda *a: crm_stage.AVAILABLE_PRIORITIES[0][0],
'color': 0,
'date_last_stage_update': fields.datetime.now,
}
@@ -996,7 +996,7 @@ class crm_lead(format_address, osv.osv):
}
if msg.get('author_id'):
defaults.update(self.on_change_partner_id(cr, uid, None, msg.get('author_id'), context=context)['value'])
if msg.get('priority') in dict(crm.AVAILABLE_PRIORITIES):
if msg.get('priority') in dict(crm_stage.AVAILABLE_PRIORITIES):
defaults['priority'] = msg.get('priority')
defaults.update(custom_values)
return super(crm_lead, self).message_new(cr, uid, msg, custom_values=defaults, context=context)
@@ -1010,7 +1010,7 @@ class crm_lead(format_address, osv.osv):
ids = [ids]
if update_vals is None: update_vals = {}
if msg.get('priority') in dict(crm.AVAILABLE_PRIORITIES):
if msg.get('priority') in dict(crm_stage.AVAILABLE_PRIORITIES):
update_vals['priority'] = msg.get('priority')
maps = {
'cost':'planned_cost',
+54
View File
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.ui.view" id="crm_stage_tree">
<field name="name">crm.stage.tree</field>
<field name="model">crm.stage</field>
<field name="arch" type="xml">
<tree string="Stages">
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="probability"/>
<field name="type"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="crm_stage_form">
<field name="name">crm.stage.form</field>
<field name="model">crm.stage</field>
<field name="priority" eval="1"/>
<field name="arch" type="xml">
<form string="Stage">
<group>
<group>
<field name="name"/>
<field name="type"/>
<field name="on_change"/>
<label for="probability" attrs="{'invisible': [('on_change', '=', False)]}"/>
<div attrs="{'invisible': [('on_change', '=', False)]}">
<field name="probability"/>
<p class="text-muted">
A stage will be considered as 'Won' if the probability is 100% and if 'Change Probability Automatically' is true.<br/>
A stage will be considered as 'Lost' or 'Dead' if the probability is 0% and if 'Change Probability Automatically' is true.
</p>
</div>
</group>
<group>
<field name="fold"/>
</group>
</group>
<separator string="Requirements"/>
<field name="requirements" nolabel="1"/>
<field name="team_ids" invisible="1"/>
</form>
</field>
</record>
<!-- CRM Stage Action -->
<record id="crm_stage_act" model="ir.actions.act_window">
<field name="name">Stages</field>
<field name="res_model">crm.stage</field>
<field name="view_type">form</field>
<field name="view_id" ref="crm_stage_tree"/>
</record>
</odoo>
-53
View File
@@ -52,58 +52,5 @@
<menuitem action="crm_lost_reason_action" id="menu_crm_lost_reason" parent="base.menu_crm_config_lead" sequence="6" groups="base.group_no_one"/>
<!-- CRM STAGE VIEWS -->
<record model="ir.ui.view" id="crm_stage_tree">
<field name="name">crm.stage.tree</field>
<field name="model">crm.stage</field>
<field name="arch" type="xml">
<tree string="Stages">
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="probability"/>
<field name="type"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="crm_stage_form">
<field name="name">crm.stage.form</field>
<field name="model">crm.stage</field>
<field name="priority" eval="1"/>
<field name="arch" type="xml">
<form string="Stage">
<group>
<group>
<field name="name"/>
<field name="type"/>
<field name="on_change"/>
<label for="probability" attrs="{'invisible': [('on_change', '=', False)]}"/>
<div attrs="{'invisible': [('on_change', '=', False)]}">
<field name="probability"/>
<p class="text-muted">
A stage will be considered as 'Won' if the probability is 100% and if 'Change Probability Automatically' is true.<br/>
A stage will be considered as 'Lost' or 'Dead' if the probability is 0% and if 'Change Probability Automatically' is true.
</p>
</div>
</group>
<group>
<field name="fold"/>
</group>
</group>
<separator string="Requirements"/>
<field name="requirements" nolabel="1"/>
<field name="team_ids" invisible="1"/>
</form>
</field>
</record>
<!-- CRM Stage Action -->
<record id="crm_stage_act" model="ir.actions.act_window">
<field name="name">Stages</field>
<field name="res_model">crm.stage</field>
<field name="view_type">form</field>
<field name="view_id" ref="crm_stage_tree"/>
</record>
</data>
</openerp>
+2 -2
View File
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp.addons.crm import crm
from openerp.addons.crm import crm_stage
from openerp.osv import fields, osv
from openerp import tools
@@ -36,7 +36,7 @@ class crm_lead_report(osv.Model):
'stage_id': fields.many2one ('crm.stage', 'Stage', readonly=True, domain="[('team_ids', '=', team_id)]"),
'partner_id': fields.many2one('res.partner', 'Partner' , readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
'priority': fields.selection(crm_stage.AVAILABLE_PRIORITIES, 'Priority'),
'type':fields.selection([
('lead','Lead'),
('opportunity','Opportunity'),
+2 -2
View File
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp.addons.crm import crm
from openerp.addons.crm import crm_stage
from openerp.osv import fields, osv
from openerp import tools
@@ -38,7 +38,7 @@ class crm_opportunity_report(osv.Model):
'stage_id': fields.many2one ('crm.stage', 'Stage', readonly=True, domain="[('team_ids', '=', team_id)]"),
'partner_id': fields.many2one('res.partner', 'Partner' , readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
'priority': fields.selection(crm_stage.AVAILABLE_PRIORITIES, 'Priority'),
'type':fields.selection([
('lead','Lead'),
('opportunity','Opportunity'),
-1
View File
@@ -2,7 +2,6 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import openerp
from openerp.addons.crm import crm
from openerp.osv import fields, osv
from openerp import tools
from openerp.tools.translate import _
@@ -4,7 +4,7 @@
from openerp.osv import fields, osv
from openerp import tools
from openerp.addons.crm import crm
class project_issue_report(osv.osv):
_name = "project.issue.report"