diff --git a/addons/crm/crm.py b/addons/crm/crm.py
index 5b3b6b38b82..4740c0fdcf1 100644
--- a/addons/crm/crm.py
+++ b/addons/crm/crm.py
@@ -116,6 +116,7 @@ class crm_case_section(osv.osv):
return []
reads = self.read(cr, uid, ids, ['name', 'parent_id'], context)
res = []
+
for record in reads:
name = record['name']
if record['parent_id']:
@@ -178,9 +179,11 @@ class crm_case_resource_type(osv.osv):
object_id = context and context.get('object_id', False) or False
ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', object_id)])
return ids and ids[0]
+
_defaults = {
'object_id' : _find_object_id
}
+
crm_case_resource_type()
@@ -215,6 +218,7 @@ class crm_case_stage(osv.osv):
object_id = context and context.get('object_id', False) or False
ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', object_id)])
return ids and ids[0]
+
_defaults = {
'sequence': lambda *args: 1,
'probability': lambda *args: 0.0,
@@ -295,11 +299,14 @@ class crm_case(osv.osv):
if 'history_line' in field_names:
history_obj = self.pool.get('crm.case.history')
name = 'history_line'
+
if 'log_ids' in field_names:
history_obj = self.pool.get('crm.case.log')
name = 'log_ids'
+
if not history_obj:
return result
+
for case in self.browse(cr, uid, ids, context):
model_ids = model_obj.search(cr, uid, [('model', '=', case._name)])
history_ids = history_obj.search(cr, uid, [('model_id', '=', model_ids[0]),\
@@ -495,6 +502,7 @@ class crm_case(osv.osv):
s = self.get_stage_dict(cr, uid, ids, context=context)
for case in self.browse(cr, uid, ids, context):
section = (case.section_id.id or False)
+
if section in s:
st = case.stage_id.id or False
s[section] = dict([(v, k) for (k, v) in s[section].iteritems()])
@@ -519,8 +527,10 @@ class crm_case(osv.osv):
value = {}
if not name:
value['name'] = case.name
+
if (not partner_id) and case.partner_id:
value['partner_id'] = case.partner_id.id
+
if case.partner_address_id:
value['partner_address_id'] = case.partner_address_id.id
if case.email_from:
@@ -552,6 +562,7 @@ class crm_case(osv.osv):
model_obj = self.pool.get('ir.model')
+
for case in cases:
model_ids = model_obj.search(cr, uid, [('model', '=', case._name)])
data = {
@@ -562,6 +573,7 @@ class crm_case(osv.osv):
'res_id': case.id,
'section_id': case.section_id.id
}
+
obj = self.pool.get('crm.case.log')
if history:
obj = self.pool.get('crm.case.history')
@@ -636,12 +648,15 @@ class crm_case(osv.osv):
if not case.email_from:
raise osv.except_osv(_('Error!'),
_('You must put a Partner eMail to use this action!'))
+
if not case.user_id:
raise osv.except_osv(_('Error!'),
_('You must define a responsible user for this case in order to use this action!'))
+
if not case.description:
raise osv.except_osv(_('Error!'),
_('Can not send mail with empty body,you should have description in the body'))
+
self.__history(cr, uid, cases, _('Send'), history=True, email=False)
for case in cases:
self.write(cr, uid, [case.id], {
@@ -735,6 +750,7 @@ class crm_case(osv.osv):
cases = self.browse(cr, uid, ids)
for case in cases:
data = {'active': True, 'user_id': False}
+
if case.section_id.parent_id:
data['section_id'] = case.section_id.parent_id.id
if case.section_id.parent_id.user_id:
@@ -868,6 +884,7 @@ class crm_case_history(osv.osv):
res[hist.id] = (hist.email or '/') + ' (' + str(hist.date) + ')\n'
res[hist.id] += (hist.description or '')
return res
+
_columns = {
'description': fields.text('Description'),
'note': fields.function(_note_get, method=True, string="Description", type="text"),
@@ -944,6 +961,7 @@ class crm_email_add_cc_wizard(osv.osv_memory):
openobject_id = str(case.id),
subtype = "html"
)
+
if flag:
model_pool.write(cr, uid, case.id, {'email_cc' : case.email_cc and case.email_cc + ',' + email or email})
else:
diff --git a/addons/crm/crm_action_rule.py b/addons/crm/crm_action_rule.py
index 1e7c50588db..f2d5a19997d 100644
--- a/addons/crm/crm_action_rule.py
+++ b/addons/crm/crm_action_rule.py
@@ -27,26 +27,47 @@ import tools
import mx.DateTime
from tools.translate import _
-from osv import fields
-from osv import osv
+from osv import fields
+from osv import osv
from osv import orm
from osv.orm import except_orm
import crm
class case(osv.osv):
+ """ Case """
+
_inherit = 'crm.case'
+ _description = 'case'
+
_columns = {
'date_action_last': fields.datetime('Last Action', readonly=1),
'date_action_next': fields.datetime('Next Action', readonly=1),
}
def remind_partner(self, cr, uid, ids, context={}, attach=False):
+
+ """
+ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of Remind Partner's IDs
+ @param context: A standard dictionary for contextual values
+
+ """
return self.remind_user(cr, uid, ids, context, attach,
destination=False)
- def remind_user(self, cr, uid, ids, context={}, attach=False,
- destination=True):
+ def remind_user(self, cr, uid, ids, context={}, attach=False,destination=True):
+
+ """
+ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of Remind user's IDs
+ @param context: A standard dictionary for contextual values
+
+ """
for case in self.browse(cr, uid, ids):
if not case.section_id.reply_to:
raise osv.except_osv(_('Error!'), ("Reply To is not specified in Section"))
@@ -83,34 +104,40 @@ class case(osv.osv):
raise osv.except_osv(_('Email!'),("Email Successfully Sent"))
else:
raise osv.except_osv(_('Email Fail!'),("Email is not sent successfully"))
- return True
+ return True
def _check(self, cr, uid, ids=False, context={}):
- '''
+ """
Function called by the scheduler to process cases for date actions
Only works on not done and cancelled cases
- '''
+
+ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param context: A standard dictionary for contextual values
+ """
cr.execute('select * from crm_case \
where (date_action_last<%s or date_action_last is null) \
and (date_action_next<=%s or date_action_next is null) \
and state not in (\'cancel\',\'done\')',
(time.strftime("%Y-%m-%d %H:%M:%S"),
time.strftime('%Y-%m-%d %H:%M:%S')))
- ids2 = map(lambda x: x[0], cr.fetchall() or [])
- cases = self.browse(cr, uid, ids2, context)
- return self._action(cr, uid, cases, False, context=context)
- def _action(self, cr, uid, cases, state_to, scrit=None, context={}):
+ ids2 = map(lambda x: x[0], cr.fetchall() or [])
+ cases = self.browse(cr, uid, ids2, context)
+ return self._action(cr, uid, cases, False, context=context)
+
+ def _action(self, cr, uid, cases, state_to, scrit=None, context={}):
if not context:
context = {}
- context['state_to'] = state_to
+ context['state_to'] = state_to
rule_obj = self.pool.get('base.action.rule')
model_obj = self.pool.get('ir.model')
- model_ids = model_obj.search(cr, uid, [('model','=',self._name)])
+ model_ids = model_obj.search(cr, uid, [('model','=',self._name)])
rule_ids = rule_obj.search(cr, uid, [('name','=',model_ids[0])])
return rule_obj._action(cr, uid, rule_ids, cases, scrit=scrit, context=context)
- def format_body(self, body):
+ def format_body(self, body):
return self.pool.get('base.action.rule').format_body(body)
def format_mail(self, obj, body):
@@ -118,12 +145,19 @@ class case(osv.osv):
case()
class base_action_rule(osv.osv):
+ """ Base Action Rule """
_inherit = 'base.action.rule'
_description = 'Action Rules'
-
+
def do_check(self, cr, uid, action, obj, context={}):
+
+ """ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param context: A standard dictionary for contextual values"""
+
ok = super(base_action_rule, self).do_check(cr, uid, action, obj, context=context)
-
+
if hasattr(obj, 'section_id'):
ok = ok and (not action.trg_section_id or action.trg_section_id.id==obj.section_id.id)
if hasattr(obj, 'categ_id'):
@@ -143,13 +177,19 @@ class base_action_rule(osv.osv):
return ok
def do_action(self, cr, uid, action, model_obj, obj, context={}):
- res = super(base_action_rule, self).do_action(cr, uid, action, model_obj, obj, context=context)
+
+ """ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param context: A standard dictionary for contextual values """
+
+ res = super(base_action_rule, self).do_action(cr, uid, action, model_obj, obj, context=context)
write = {}
-
+
if action.act_section_id:
obj.section_id = action.act_section_id
- write['section_id'] = action.act_section_id.id
-
+ write['section_id'] = action.act_section_id.id
+
if hasattr(obj, 'email_cc') and action.act_email_cc:
if '@' in (obj.email_cc or ''):
emails = obj.email_cc.split(",")
@@ -157,9 +197,10 @@ class base_action_rule(osv.osv):
write['email_cc'] = obj.email_cc+','+obj.act_email_cc
else:
write['email_cc'] = obj.act_email_cc
-
+
model_obj.write(cr, uid, [obj.id], write, context)
emails = []
+
if hasattr(obj, 'email_from') and action.act_mail_to_partner:
emails.append(obj.email_from)
emails = filter(None, emails)
@@ -167,29 +208,44 @@ class base_action_rule(osv.osv):
emails = list(set(emails))
self.email_send(cr, uid, obj, emails, action.act_mail_body)
return True
-
-
+
+
base_action_rule()
class base_action_rule_line(osv.osv):
+ """ Base Action Rule Line """
_inherit = 'base.action.rule.line'
+ _description = 'Base Action Rule Line'
def state_get(self, cr, uid, context={}):
- res = super(base_action_rule_line, self).state_get(cr, uid, context=context)
+
+ """@param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param context: A standard dictionary for contextual values """
+
+ res = super(base_action_rule_line, self).state_get(cr, uid, context=context)
return res + [('escalate','Escalate')] + crm.AVAILABLE_STATES
def priority_get(self, cr, uid, context={}):
- res = super(base_action_rule_line, self).priority_get(cr, uid, context=context)
+
+ """@param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param context: A standard dictionary for contextual values """
+
+ res = super(base_action_rule_line, self).priority_get(cr, uid, context=context)
return res + crm.AVAILABLE_PRIORITIES
-
- _columns = {
+
+ _columns = {
'trg_section_id': fields.many2one('crm.case.section', 'Section'),
'trg_max_history': fields.integer('Maximum Communication History'),
- 'trg_categ_id': fields.many2one('crm.case.categ', 'Category'),
+ 'trg_categ_id': fields.many2one('crm.case.categ', 'Category'),
'regex_history' : fields.char('Regular Expression on Case History', size=128),
- 'act_section_id': fields.many2one('crm.case.section', 'Set section to'),
+ 'act_section_id': fields.many2one('crm.case.section', 'Set section to'),
'act_categ_id': fields.many2one('crm.case.categ', 'Set Category to'),
- 'act_mail_to_partner': fields.boolean('Mail to partner',help="Check this if you want the rule to send an email to the partner."),
+ 'act_mail_to_partner': fields.boolean('Mail to partner',help="Check this \
+ if you want the rule to send an email to the partner."),
}
base_action_rule_line()
diff --git a/addons/crm/crm_claim.py b/addons/crm/crm_claim.py
index cbd34af2e52..43ec4fe9895 100755
--- a/addons/crm/crm_claim.py
+++ b/addons/crm/crm_claim.py
@@ -31,31 +31,43 @@ class crm_claim(osv.osv):
_order = "id desc"
_inherit = 'crm.case'
_columns = {
- 'date_closed': fields.datetime('Closed', readonly=True),
- 'date': fields.datetime('Date'),
- '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."),
- 'planned_revenue': fields.float('Planned Revenue'),
- 'planned_cost': fields.float('Planned Costs'),
- '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)."),
- 'categ_id': fields.many2one('crm.case.categ', 'Category', domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.claim')]"),
- 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
- 'type_id': fields.many2one('crm.case.resource.type', 'Claim Type', domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.claim')]"),
-
- 'partner_name': fields.char("Employee's Name", size=64),
- 'partner_mobile': fields.char('Mobile', size=32),
- 'partner_phone': fields.char('Phone', size=32),
- 'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.claim')]"),
- 'probability': fields.float('Probability (%)'),
+ 'date_closed': fields.datetime('Closed', readonly=True),
+ 'date': fields.datetime('Date'),
+ '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."),
+ 'planned_revenue': fields.float('Planned Revenue'),
+ 'planned_cost': fields.float('Planned Costs'),
+ '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)."),
+ 'categ_id': fields.many2one('crm.case.categ', 'Category',\
+ domain="[('section_id','=',section_id),\
+ ('object_id.model', '=', 'crm.claim')]"),
+ 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
+ 'type_id': fields.many2one('crm.case.resource.type', 'Claim Type',\
+ domain="[('section_id','=',section_id),\
+ ('object_id.model', '=', 'crm.claim')]"),
+
+ 'partner_name': fields.char("Employee's Name", size=64),
+ 'partner_mobile': fields.char('Mobile', size=32),
+ 'partner_phone': fields.char('Phone', size=32),
+ 'stage_id': fields.many2one ('crm.case.stage', 'Stage',\
+ domain="[('section_id','=',section_id),\
+ ('object_id.model', '=', 'crm.claim')]"),
+ 'probability': fields.float('Probability (%)'),
}
-
+
_defaults = {
- 'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
+ 'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
}
-
+
crm_claim()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/crm/crm_claims_menu.xml b/addons/crm/crm_claims_menu.xml
index 24afc46de58..1eac8e007a3 100755
--- a/addons/crm/crm_claims_menu.xml
+++ b/addons/crm/crm_claims_menu.xml
@@ -2,48 +2,50 @@
-
-
+
+
-
+
Claims
crm.claim
form
tree,calendar,form,graph
-
+
-
+
tree
-
+
calendar
-
+
form
-
+
graph
-
-
-
+
-
+
+
+
diff --git a/addons/crm/crm_claims_view.xml b/addons/crm/crm_claims_view.xml
index 1af94e62e11..ee2711f2890 100755
--- a/addons/crm/crm_claims_view.xml
+++ b/addons/crm/crm_claims_view.xml
@@ -1,9 +1,9 @@
-
+
-
+
Claim Categories
crm.case.categ
@@ -12,12 +12,12 @@
[('object_id.model', '=', 'crm.claim')]
{'object_id':'crm.claim'}
-
+
-
+
Claim Stages
crm.case.stage
@@ -26,7 +26,7 @@
[('object_id.model', '=', 'crm.claim')]
{'object_id':'crm.claim'}
-
+
@@ -40,13 +40,13 @@
[('object_id.model', '=', 'crm.claim')]
{'object_id':'crm.claim'}
-
+
-
+
CRM - Claims Tree
crm.claim
@@ -115,7 +115,7 @@
-
@@ -131,11 +131,21 @@
-
-
-
-
-
+
+
+
+
+
@@ -263,11 +273,12 @@
domain="[('user_id','=', False)]"
help="Unassigned Claims" />
-
-
+
+
@@ -281,6 +292,6 @@
-
+
diff --git a/addons/crm/crm_fund_menu.xml b/addons/crm/crm_fund_menu.xml
index 5d815c9b95d..babb10f291c 100644
--- a/addons/crm/crm_fund_menu.xml
+++ b/addons/crm/crm_fund_menu.xml
@@ -1,8 +1,12 @@
-
-
+
+
+
+
+
Funds
crm.fundraising
@@ -10,25 +14,31 @@
+
tree
+
form
+
graph
-
+
+
diff --git a/addons/crm/crm_fund_view.xml b/addons/crm/crm_fund_view.xml
index 6d2a76df625..bbe59a53836 100644
--- a/addons/crm/crm_fund_view.xml
+++ b/addons/crm/crm_fund_view.xml
@@ -2,9 +2,8 @@
- # ------------------------------------------------------
- # Fund Raising Categories
- # ------------------------------------------------------
+
+
Fundraising Categories
crm.case.categ
@@ -13,10 +12,13 @@
[('object_id.model', '=', 'crm.fundraising')]
{'object_id':'crm.fundraising'}
-
- # ------------------------------------------------------
- # Fund Stage
- # ------------------------------------------------------
+
+
+
+
+
Fundraising Stages
crm.case.stage
@@ -25,11 +27,13 @@
[('object_id.model', '=', 'crm.fundraising')]
{'object_id':'crm.fundraising'}
-
- # ------------------------------------------------------
- #Fund Resource Type
- # ------------------------------------------------------
+
+
+
+
Fundraising Resource Type
crm.case.resource.type
@@ -38,35 +42,51 @@
[('object_id.model', '=', 'crm.fundraising')]
{'object_id':'crm.fundraising'}
-
+
+
- # ------------------------------------------------------
- # Fund Raising
- # ------------------------------------------------------
+
+
CRM - Funds Tree
crm.fundraising
tree
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
CRM - Funds Form
crm.fundraising
@@ -74,7 +94,7 @@
+
+
+
CRM - Funds Calendar
crm.fundraising
@@ -189,6 +229,9 @@
+
+
+
CRM - Funds Graph
crm.fundraising
@@ -202,6 +245,8 @@
+
+
CRM - Funds Search
crm.fundraising
@@ -214,20 +259,32 @@
separator="1"
help="Funds Related to Current User"
/>
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
+
+
diff --git a/addons/crm/crm_fundraising.py b/addons/crm/crm_fundraising.py
index 9bfbd10a6b8..cc89342df29 100644
--- a/addons/crm/crm_fundraising.py
+++ b/addons/crm/crm_fundraising.py
@@ -23,40 +23,54 @@ from osv import fields,osv,orm
import crm
class crm_fundraising(osv.osv):
+ """ Fund Raising Cases """
+
_name = "crm.fundraising"
_description = "Fund Raising Cases"
_order = "id desc"
_inherit ='crm.case'
- _columns = {
+
+ _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')]"),
+ '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 (%)'),
+ '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')]"),
+ '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)."),
+ '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,
-
+ 'probability':lambda *a:0.0,
+ 'planned_cost':lambda *a:0.0,
+ 'planned_revenue':lambda *a:0.0,
+
}
-crm_fundraising()
+crm_fundraising()
diff --git a/addons/crm/crm_helpdesk.py b/addons/crm/crm_helpdesk.py
index 43f48025572..c9317b52a3b 100644
--- a/addons/crm/crm_helpdesk.py
+++ b/addons/crm/crm_helpdesk.py
@@ -23,27 +23,38 @@ from osv import fields,osv,orm
import crm
class crm_helpdesk(osv.osv):
+ """ Helpdesk Cases """
+
_name = "crm.helpdesk"
_description = "Helpdesk Cases"
_order = "id desc"
_inherit = 'crm.case'
+
_columns = {
'date_closed': fields.datetime('Closed', readonly=True),
'date': fields.datetime('Date'),
'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."),
+ '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."),
'planned_revenue': fields.float('Planned Revenue'),
'planned_cost': fields.float('Planned Costs'),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
'probability': fields.float('Probability (%)'),
- '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)."),
- 'categ_id': fields.many2one('crm.case.categ', 'Category', domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.helpdesk')]"),
+ '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)."),
+ 'categ_id': fields.many2one('crm.case.categ', 'Category',\
+ domain="[('section_id','=',section_id),\
+ ('object_id.model', '=', 'crm.helpdesk')]"),
'duration': fields.float('Duration'),
}
+
_defaults = {
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.helpdesk', context=c),
'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
@@ -51,5 +62,5 @@ class crm_helpdesk(osv.osv):
crm_helpdesk()
-
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/crm/crm_helpdesk_menu.xml b/addons/crm/crm_helpdesk_menu.xml
index 29684e5d1de..bd3f0889bd1 100644
--- a/addons/crm/crm_helpdesk_menu.xml
+++ b/addons/crm/crm_helpdesk_menu.xml
@@ -1,36 +1,43 @@
-
+
+
+
- ######################## Help Desk (menu) ###########################
Helpdesk Requests
crm.helpdesk
tree,calendar,form
-
+
+
tree
+
calendar
+
form
-
-
+
+
+
diff --git a/addons/crm/crm_helpdesk_view.xml b/addons/crm/crm_helpdesk_view.xml
index c3f95deb253..b94b0e5d499 100644
--- a/addons/crm/crm_helpdesk_view.xml
+++ b/addons/crm/crm_helpdesk_view.xml
@@ -2,9 +2,8 @@
- # ------------------------------------------------------
- # Helpdesk Support Categories
- # ------------------------------------------------------
+
+
Helpdesk Categories
crm.case.categ
@@ -13,11 +12,11 @@
[('object_id.model', '=', 'crm.helpdesk')]
{'object_id':'crm.helpdesk'}
-
- # ------------------------------------------------------
- # Helpdesk Support
- # ------------------------------------------------------
+
+
+
CRM - Helpdesk Support Form
@@ -34,11 +33,18 @@
-
-
+
+
-
-
+
+
@@ -46,7 +52,10 @@
-
+
@@ -55,12 +64,26 @@
-
-
-
-
-
-
+
+
+
+
+
+
@@ -125,6 +148,9 @@
+
+
+
CRM - Helpdesk Support Tree
crm.helpdesk
@@ -140,16 +166,29 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
CRM - Helpdesk Support Calendar
crm.helpdesk
@@ -164,6 +203,8 @@
+
+
CRM - Helpdesk Search
crm.helpdesk
@@ -184,18 +225,25 @@
-
+
-
-
+
+
-
-
-
+
+
+
diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py
index ae1e6c66d48..a8a76d6de5f 100644
--- a/addons/crm/crm_lead.py
+++ b/addons/crm/crm_lead.py
@@ -25,12 +25,23 @@ import crm
import math
class crm_lead(osv.osv):
+ """ CRm Lead Case """
+
_name = "crm.lead"
_description = "Leads Cases"
_order = "priority desc, id desc"
_inherit = ['res.partner.address', 'crm.case']
def _compute_openday(self, cr, uid, ids, name, args, context={}):
+
+ """
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of Openday’s IDs
+ @return: difference between current date and log date
+ @param context: A standard dictionary for contextual values
+ """
+
result = {}
for r in self.browse(cr, uid, ids , context):
result[r.id] = 0
@@ -51,9 +62,19 @@ class crm_lead(osv.osv):
return result
def _compute_closeday(self, cr, uid, ids, name, args, context={}):
+
+ """
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of closeday’s IDs
+ @return: difference between current date and closed date
+ @param context: A standard dictionary for contextual values
+ """
+
result = {}
for r in self.browse(cr, uid, ids , context):
result[r.id] = 0
+
if r.date_closed:
date_create = datetime.strptime(r.create_date, "%Y-%m-%d %H:%M:%S")
date_close = datetime.strptime(r.date_closed, "%Y-%m-%d %H:%M:%S")
@@ -63,27 +84,36 @@ class crm_lead(osv.osv):
return result
_columns = {
- 'categ_id': fields.many2one('crm.case.categ', 'Lead Source', domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.opportunity')]"),
- 'type_id': fields.many2one('crm.case.resource.type', 'Lead Type', domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.lead')]"),
- 'partner_name': fields.char("Contact Name", size=64),
- 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
- 'date_closed': fields.datetime('Closed', readonly=True),
- 'stage_id': fields.many2one('crm.case.stage', 'Stage', domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.lead')]"),
- 'opportunity_id': fields.many2one('crm.opportunity', 'Opportunity'),
+ 'categ_id': fields.many2one('crm.case.categ', 'Lead Source', \
+ domain="[('section_id','=',section_id),\
+ ('object_id.model', '=', 'crm.opportunity')]"),
+ 'type_id': fields.many2one('crm.case.resource.type', 'Lead Type',\
+ domain="[('section_id','=',section_id),\
+ ('object_id.model', '=', 'crm.lead')]"),
+ 'partner_name': fields.char("Contact Name", size=64),
- 'user_id': fields.many2one('res.users', 'Salesman'),
- 'referred': fields.char('Referred By', size=32),
+ 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
+ 'date_closed': fields.datetime('Closed', readonly=True),
+ 'stage_id': fields.many2one('crm.case.stage', 'Stage',\
+ domain="[('section_id','=',section_id),\
+ ('object_id.model', '=', 'crm.lead')]"),
+ 'opportunity_id': fields.many2one('crm.opportunity', 'Opportunity'),
+
+ 'user_id': fields.many2one('res.users', 'Salesman'),
+ 'referred': fields.char('Referred By', size=32),
'day_open': fields.function(_compute_openday, string='Days to Open', \
- method=True, type="integer", store=True),
+ method=True, type="integer", store=True),
'day_close': fields.function(_compute_closeday, string='Days to Close', \
- method=True, type="integer", store=True),
+ method=True, type="integer", store=True),
'function_name' : fields.char('Function', size=64),
}
_defaults = {
- 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.lead', 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[2][0],
}
crm_lead()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/crm/crm_lead_menu.xml b/addons/crm/crm_lead_menu.xml
index 96aaed7ecd9..c78d25b6738 100644
--- a/addons/crm/crm_lead_menu.xml
+++ b/addons/crm/crm_lead_menu.xml
@@ -1,9 +1,6 @@
-
-
-
Leads
@@ -24,8 +21,12 @@
-
-
+
+
+
diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml
index 51243f3e271..dc379ddacfb 100644
--- a/addons/crm/crm_lead_view.xml
+++ b/addons/crm/crm_lead_view.xml
@@ -2,11 +2,8 @@
+
-
- # ------------------------------------------------------
- # Stage
- # ------------------------------------------------------
Lead Stages
crm.case.stage
@@ -15,11 +12,11 @@
[('object_id.model', '=', 'crm.lead')]
{'object_id':'crm.lead'}
-
-
- # ------------------------------------------------------
- Resource Type
- # ------------------------------------------------------
+
+
+
+
Lead Resource Type
crm.case.resource.type
@@ -28,14 +25,13 @@
[('object_id.model', '=', 'crm.lead')]
{'object_id':'crm.lead'}
-
+
+
- # ------------------------------------------------------
- # Leads
- # ------------------------------------------------------
-
-
+
CRM - Leads Form
crm.lead
form
@@ -46,19 +42,26 @@
-
-
-
-
+
+
+
+
-
-
+
+
@@ -89,23 +92,35 @@
-
+
-
-
-
-
-
-
+
+
+
+
+
+
@@ -146,7 +161,9 @@
-
+
@@ -170,6 +187,8 @@
+
+
CRM - Leads Tree
crm.lead
@@ -187,33 +206,54 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
CRM - Leads Calendar
crm.lead
calendar
-
-
-
-
+
+
+
+
+
CRM - Leads Search
@@ -234,12 +274,13 @@
+ domain="[('create_date','<', time.strftime('%%Y-%%m-%%d 23:59:59')), \
+ ('create_date','>=', time.strftime('%%Y-%%m-%%d 23:59:59'))]"
+ help="Todays' Opportunities" />
@@ -265,14 +306,15 @@
-
-
+
+
-
+
diff --git a/addons/crm/crm_mailgate.py b/addons/crm/crm_mailgate.py
index 8b2f3bdef88..3b7121e76fd 100644
--- a/addons/crm/crm_mailgate.py
+++ b/addons/crm/crm_mailgate.py
@@ -33,43 +33,57 @@ from osv import fields,osv,orm
from osv.orm import except_orm
class crm_cases(osv.osv):
+ """ crm cases """
+
_name = "crm.case"
_inherit = "crm.case"
- def msg_new(self, cr, uid, msg):
+ def msg_new(self, cr, uid, msg):
+
+ """ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks
+ """
+
mailgate_obj = self.pool.get('mail.gateway')
msg_body = mailgate_obj.msg_body_get(msg)
- data = {
- 'name': msg['Subject'],
+ data = {
+ 'name': msg['Subject'],
'email_from': msg['From'],
- 'email_cc': msg['Cc'],
+ 'email_cc': msg['Cc'],
'user_id': False,
- 'description': msg_body['body'],
+ 'description': msg_body['body'],
}
res = mailgate_obj.partner_get(cr, uid, msg['From'])
if res:
data.update(res)
- res = self.create(cr, uid, data)
- cases = self.browse(cr, uid, [res])
+ res = self.create(cr, uid, data)
+ cases = self.browse(cr, uid, [res])
self._history(cr, uid, cases, _('Receive'), history=True, email=msg['From'])
return res
-
+
def msg_update(self, cr, uid, ids, msg, data={}, default_act='pending'):
+
+ """ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of update mail’s IDs """
+
if isinstance(ids, (str, int, long)):
select = [ids]
else:
- select = ids
+ select = ids
mailgate_obj = self.pool.get('mail.gateway')
- msg_actions, body_data = mailgate_obj.msg_act_get(msg)
+ msg_actions, body_data = mailgate_obj.msg_act_get(msg)
data.update({
- 'description': body_data,
+ 'description': body_data,
})
act = 'case_'+default_act
if 'state' in msg_actions:
if msg_actions['state'] in ['draft','close','cancel','open','pending']:
act = 'case_' + msg_actions['state']
-
- for k1,k2 in [('cost','planned_cost'),('revenue','planned_revenue'),('probability','probability')]:
+
+ for k1,k2 in [('cost','planned_cost'),('revenue','planned_revenue'),('probability','probability')]:
if k1 in msg_actions:
data[k2] = float(msg_actions[k1])
@@ -78,15 +92,24 @@ class crm_cases(osv.osv):
data['priority'] = msg_actions['priority']
if 'partner' in msg_actions:
- data['email_from'] = msg_actions['partner'][:128]
+ data['email_from'] = msg_actions['partner'][:128]
res = self.write(cr, uid, select, data)
- cases = self.browse(cr, uid, select)
- self._history(cr, uid, cases, _('Receive'), history=True, email=msg['From'])
+ cases = self.browse(cr, uid, select)
+ self._history(cr, uid, cases, _('Receive'), history=True, email=msg['From'])
getattr(self,act)(cr, uid, select)
return res
- def emails_get(self, cr, uid, ids, context={}):
+ def emails_get(self, cr, uid, ids, context={}):
+
+ """ Get Emails
+ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of email’s IDs
+ @param context: A standard dictionary for contextual values
+
+ """
res = []
if isinstance(ids, (str, int, long)):
select = [ids]
@@ -96,10 +119,19 @@ class crm_cases(osv.osv):
user_email = (case.user_id and case.user_id.address_id and case.user_id.address_id.email) or False
res += [(user_email, case.email_from, case.email_cc, getattr(case,'priority') and case.priority or False)]
if isinstance(ids, (str, int, long)):
- return len(res) and res[0] or False
+ return len(res) and res[0] or False
return res
def msg_send(self, cr, uid, id, *args, **argv):
- return True
+
+ """ Send The Message
+ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of email’s IDs
+ @param *args: Return Tuple Value
+ @param **args: Return Dictionary of Keyword Value
+ """
+ return True
crm_cases()
diff --git a/addons/crm/crm_meeting.py b/addons/crm/crm_meeting.py
index de0f1f01c33..9e3297704b1 100644
--- a/addons/crm/crm_meeting.py
+++ b/addons/crm/crm_meeting.py
@@ -26,63 +26,84 @@ from datetime import datetime, timedelta
class crm_opportunity(osv.osv):
_name = 'crm.opportunity'
-crm_opportunity()
+crm_opportunity()
class crm_phonecall(osv.osv):
+ """ CRM Phonecall """
+
_name = 'crm.phonecall'
+
crm_phonecall()
class crm_meeting(osv.osv):
+ """ CRM Meeting Cases """
+
_name = 'crm.meeting'
_description = "Meeting Cases"
_order = "id desc"
- _inherit = ["crm.case", "calendar.event"]
+ _inherit = ["crm.case", "calendar.event"]
- _columns = {
+ _columns = {
'categ_id': fields.many2one('crm.case.categ', 'Meeting Type', \
domain="[('object_id.model', '=', 'crm.meeting')]", \
- ),
- 'phonecall_id':fields.many2one ('crm.phonecall', 'Phonecall'),
- 'opportunity_id':fields.many2one ('crm.opportunity', 'Opportunity'),
- 'attendee_ids': fields.many2many('calendar.attendee', 'event_attendee_rel', 'event_id', 'attendee_id', 'Attendees'),
- 'date_closed': fields.datetime('Closed', readonly=True),
- 'date_deadline': fields.datetime('Deadline'),
- 'state': fields.selection([('open', 'Confirmed'),
- ('draft', 'Unconfirmed'),
- ('cancel', 'Cancelled'),
+ ),
+ 'phonecall_id': fields.many2one ('crm.phonecall', 'Phonecall'),
+ 'opportunity_id': fields.many2one ('crm.opportunity', 'Opportunity'),
+ 'attendee_ids': fields.many2many('calendar.attendee', 'event_attendee_rel',\
+ 'event_id', 'attendee_id', 'Attendees'),
+ 'date_closed': fields.datetime('Closed', readonly=True),
+ 'date_deadline': fields.datetime('Deadline'),
+ 'state': fields.selection([('open', 'Confirmed'),
+ ('draft', 'Unconfirmed'),
+ ('cancel', 'Cancelled'),
('done', 'Done')], 'State', \
size=16, readonly=True)
}
-
+
_defaults = {
'state': lambda *a: 'draft',
}
-
+
crm_meeting()
class calendar_attendee(osv.osv):
+ """ Calendar Attendee """
+
_inherit = 'calendar.attendee'
+ _description = 'Calendar Attendee'
- def _compute_data(self, cr, uid, ids, name, arg, context):
- name = name[0]
- result = super(calendar_attendee, self)._compute_data(cr, uid, ids, name, arg, context)
+ def _compute_data(self, cr, uid, ids, name, arg, context):
- for attdata in self.browse(cr, uid, ids, context=context):
+ """
+ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of compute data’s IDs
+ @param context: A standard dictionary for contextual values
+
+ """
+
+ name = name[0]
+ result = super(calendar_attendee, self)._compute_data(cr, uid, ids, name, arg, context)
+
+ for attdata in self.browse(cr, uid, ids, context=context):
id = attdata.id
result[id] = {}
if name == 'categ_id':
if attdata.ref:
- result[id][name] = (attdata.ref.categ_id.id,attdata.ref.categ_id.name,)
+ result[id][name] = (attdata.ref.categ_id.id, attdata.ref.categ_id.name,)
else:
result[id][name] = False
- return result
+ return result
+
_columns = {
'categ_id': fields.function(_compute_data, method=True, \
string='Event Type', type="many2one", \
relation="crm.case.categ", multi='categ_id'),
}
+
calendar_attendee()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/crm/crm_meeting_menu.xml b/addons/crm/crm_meeting_menu.xml
index 895c842574b..3f680b61f15 100644
--- a/addons/crm/crm_meeting_menu.xml
+++ b/addons/crm/crm_meeting_menu.xml
@@ -85,7 +85,7 @@
crm.meeting
calendar,tree,form,gantt
-
+
@@ -111,13 +111,15 @@
-
-
-
-
+
+
+
+
+
Meeting Invitations
@@ -125,15 +127,15 @@
calendar.attendee
form
tree,form
-
+
[('ref','like','crm.meeting,')]
{'default_sent_by_uid': uid}
-
+ sequence="10" action="action_view_attendee_form" />
+
Next Meetings
@@ -141,26 +143,31 @@
form
tree,calendar,form,gantt
-
+
+
calendar
+
tree
+
form
+
gantt
diff --git a/addons/crm/crm_meeting_view.xml b/addons/crm/crm_meeting_view.xml
index a469a722e11..7f30024235b 100755
--- a/addons/crm/crm_meeting_view.xml
+++ b/addons/crm/crm_meeting_view.xml
@@ -1,9 +1,8 @@
- # ------------------------------------------------------
- # Meetings Categories
- # ------------------------------------------------------
+
+
Meeting Categories
@@ -13,11 +12,11 @@
[('object_id.model', '=', 'crm.meeting')]
{'object_id':'crm.meeting'}
-
- # ------------------------------------------------------
- # Meetings
- # ------------------------------------------------------
+
+
+
CRM - Meetings Form
@@ -28,18 +27,28 @@
-
-
-
-
+
+
+
+
-
+
-
+
@@ -151,19 +160,29 @@
-
-
-
+
+
+
-
+ name="%(base_calendar.action_view_calendar_invite_attendee_wizard)d"
+ string="Delegate"
+ type="action"
+ icon="gtk-sort-descending"
+ states="needs-action,tentative,declined,accepted"
+ context="{'model' : 'calendar.attendee', 'attendee_field' : 'child_ids'}" />
+
@@ -179,23 +198,29 @@
+
+
CRM - Meetings Tree
crm.meeting
tree
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
CRM - Meetings Calendar
crm.meeting
@@ -210,6 +235,8 @@
+
+
CRM - Meetings Gantt
crm.meeting
@@ -223,6 +250,9 @@
+
+
+
CRM - Meetings Search
crm.meeting
@@ -230,24 +260,33 @@
-
-
-
+
+
+
-
-
-
-
+
+
+
+
+
+
calendar.attendee.form.inherit
calendar.attendee
@@ -260,6 +299,8 @@
+
+
calendar.attendee.tree.inherit
calendar.attendee
diff --git a/addons/crm/crm_operators.py b/addons/crm/crm_operators.py
index ac918de7c00..b58b9111e6c 100644
--- a/addons/crm/crm_operators.py
+++ b/addons/crm/crm_operators.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,13 +15,18 @@
# 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 .
+# along with this program. If not, see .
#
##############################################################################
import time
def som(cr, uid, partner_id, args):
+ """
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks
+ """
+
result = args['som_interval_default']
max = args['som_interval_max'] or 4
factor = args['som_interval_decrease']
@@ -32,8 +37,8 @@ def som(cr, uid, partner_id, args):
'''
select s.factor from res_partner_event e
left join res_partner_som s
- on (e.som=s.id) where partner_id=%s and date>=%s and date<%s''',
- (partner_id,
+ on (e.som=s.id) where partner_id=%s and date>=%s and date<%s''',
+ (partner_id,
time.strftime('%Y-%m-%d', time.gmtime(date_start)),
time.strftime('%Y-%m-%d', time.gmtime(next_date))))
diff --git a/addons/crm/crm_opportunity.py b/addons/crm/crm_opportunity.py
index da5a1c719a7..58c3c551638 100644
--- a/addons/crm/crm_opportunity.py
+++ b/addons/crm/crm_opportunity.py
@@ -32,12 +32,22 @@ AVAILABLE_STATES = [
]
class crm_opportunity(osv.osv):
+ """ Opportunity Cases """
+
_name = "crm.opportunity"
_description = "Opportunity Cases"
_order = "id desc"
_inherit = 'crm.case'
def _compute_openday(self, cr, uid, ids, name, args, context={}):
+
+ """
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of Openday’s IDs
+ @return: difference between current date and log date
+ @param context: A standard dictionary for contextual values
+ """
result = {}
for r in self.browse(cr, uid, ids , context):
result[r.id] = 0
@@ -58,9 +68,18 @@ class crm_opportunity(osv.osv):
return result
def _compute_closeday(self, cr, uid, ids, name, args, context={}):
+
+ """
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of closeday’s IDs
+ @return: difference between current date and closed date
+ @param context: A standard dictionary for contextual values
+ """
result = {}
for r in self.browse(cr, uid, ids , context):
result[r.id] = 0
+
if r.date_closed:
date_create = datetime.strptime(r.create_date, "%Y-%m-%d %H:%M:%S")
date_close = datetime.strptime(r.date_closed, "%Y-%m-%d %H:%M:%S")
@@ -70,14 +89,19 @@ class crm_opportunity(osv.osv):
return result
_columns = {
- 'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.opportunity')]"),
- 'categ_id': fields.many2one('crm.case.categ', 'Category', domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.opportunity')]"),
- 'type_id': fields.many2one('crm.case.resource.type', 'Resource Type', domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.opportunity')]"),
+ 'stage_id': fields.many2one ('crm.case.stage', 'Stage', \
+ domain="[('section_id','=',section_id),\
+ ('object_id.model', '=', 'crm.opportunity')]"),
+ 'categ_id': fields.many2one('crm.case.categ', 'Category', \
+ domain="[('section_id','=',section_id), \
+ ('object_id.model', '=', 'crm.opportunity')]"),
+ 'type_id': fields.many2one('crm.case.resource.type', 'Resource Type',\
+ domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.opportunity')]"),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
'probability': fields.float('Probability (%)'),
'planned_revenue': fields.float('Expected Revenue'),
- 'ref' : fields.reference('Reference', selection=crm._links_get, size=128),
- 'ref2' : fields.reference('Reference 2', selection=crm._links_get, size=128),
+ 'ref': fields.reference('Reference', selection=crm._links_get, size=128),
+ 'ref2': fields.reference('Reference 2', selection=crm._links_get, size=128),
'date_closed': fields.datetime('Closed', readonly=True),
'user_id': fields.many2one('res.users', 'Salesman'),
'phone': fields.char("Phone", size=64),
@@ -94,14 +118,29 @@ class crm_opportunity(osv.osv):
}
def onchange_stage_id(self, cr, uid, ids, stage_id, context={}):
+
+ """ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of stage’s IDs
+ @stage_id: change state id on run time """
+
if not stage_id:
return {'value':{}}
+
stage = self.pool.get('crm.case.stage').browse(cr, uid, stage_id, context)
if not stage.on_change:
return {'value':{}}
return {'value':{'probability':stage.probability}}
def stage_next(self, cr, uid, ids, context={}):
+
+ """ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of stage next’s IDs
+ @param context: A standard dictionary for contextual values """
+
res = super(crm_opportunity, self).stage_next(cr, uid, ids, context=context)
for case in self.browse(cr, uid, ids, context):
if case.stage_id and case.stage_id.on_change:
@@ -109,6 +148,13 @@ class crm_opportunity(osv.osv):
return res
def stage_previous(self, cr, uid, ids, context={}):
+
+ """ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of stage previous’s IDs
+ @param context: A standard dictionary for contextual values """
+
res = super(crm_opportunity, self).stage_previous(cr, uid, ids, context=context)
for case in self.browse(cr, uid, ids, context):
if case.stage_id and case.stage_id.on_change:
diff --git a/addons/crm/crm_opportunity_menu.xml b/addons/crm/crm_opportunity_menu.xml
index 49d0452167b..3bcdbc7bb9f 100644
--- a/addons/crm/crm_opportunity_menu.xml
+++ b/addons/crm/crm_opportunity_menu.xml
@@ -1,8 +1,7 @@
-
-
+
-
+ view_type="form"/>
+
Opportunities
crm.opportunity
@@ -48,58 +47,11 @@
-
-
+
diff --git a/addons/crm/crm_opportunity_view.xml b/addons/crm/crm_opportunity_view.xml
index 17dc6ee393a..a3c90d17954 100644
--- a/addons/crm/crm_opportunity_view.xml
+++ b/addons/crm/crm_opportunity_view.xml
@@ -2,9 +2,7 @@
- # ------------------------------------------------------
- # Opportunity Categories
- # ------------------------------------------------------
+
Opportunity Categories
@@ -14,10 +12,13 @@
[('object_id.model', '=', 'crm.opportunity')]
{'object_id':'crm.opportunity'}
-
- # ------------------------------------------------------
- # Stage
- # ------------------------------------------------------
+
+
+
+
+
Opportunity Stages
crm.case.stage
@@ -26,11 +27,13 @@
[('object_id.model', '=', 'crm.opportunity')]
{'object_id':'crm.opportunity'}
-
-
- # ------------------------------------------------------
- Resource Type
- # ------------------------------------------------------
+
+
+
+
+
Opportunity Resource Type
crm.case.resource.type
@@ -39,14 +42,13 @@
[('object_id.model', '=', 'crm.opportunity')]
{'object_id':'crm.opportunity'}
-
-
- # ------------------------------------------------------
- # Opportunities
- # ------------------------------------------------------
+
+
Opportunities
@@ -58,9 +60,15 @@
-
-
-
+
+
+
+
+
+
Opportunities Tree
crm.opportunity
@@ -181,21 +211,35 @@
-
-
+
+
-
-
-
-
+
+
+
+
+
+
+
CRM - Opportunity Graph
crm.opportunity
@@ -209,6 +253,8 @@
+
+
CRM - Opportunities Search
crm.opportunity
@@ -217,11 +263,12 @@
+ help="Todays' Opportunities" />
+
@@ -232,10 +279,12 @@
help="My Opportunities" default="1"
/>
-
-
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/crm/crm_opportunity_wizard.xml b/addons/crm/crm_opportunity_wizard.xml
deleted file mode 100644
index 24ee8257911..00000000000
--- a/addons/crm/crm_opportunity_wizard.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
diff --git a/addons/crm/crm_phonecall.py b/addons/crm/crm_phonecall.py
index 52af836d5b7..962a3883d62 100644
--- a/addons/crm/crm_phonecall.py
+++ b/addons/crm/crm_phonecall.py
@@ -24,26 +24,38 @@ import crm
import time
class crm_phonecall(osv.osv):
+ """ Phonecall Cases """
+
_name = "crm.phonecall"
_description = "Phonecall Cases"
_order = "id desc"
_inherit = 'crm.case'
+
_columns = {
'duration': fields.float('Duration'),
- 'categ_id': fields.many2one('crm.case.categ', 'Category', domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.phonecall')]"),
+ 'categ_id': fields.many2one('crm.case.categ', 'Category', \
+ domain="[('section_id','=',section_id),\
+ ('object_id.model', '=', 'crm.phonecall')]"),
'partner_phone': fields.char('Phone', size=32),
- 'partner_contact': fields.related('partner_address_id', 'name', type="char", string="Contact", size=128),
+ 'partner_contact': fields.related('partner_address_id', 'name',\
+ type="char", string="Contact", size=128),
'partner_mobile': fields.char('Mobile', size=32),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
- '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."),
+ '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."),
'date_closed': fields.datetime('Closed', readonly=True),
'date': fields.datetime('Date'),
'opportunity_id':fields.many2one ('crm.opportunity', 'Opportunity'),
}
+
_defaults = {
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
}
+
crm_phonecall()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/crm/crm_phonecall_menu.xml b/addons/crm/crm_phonecall_menu.xml
index 07554c794b5..9f1f2f946fc 100644
--- a/addons/crm/crm_phonecall_menu.xml
+++ b/addons/crm/crm_phonecall_menu.xml
@@ -12,8 +12,8 @@
domain="[('partner_id', '=', active_id)]"
/>
+
- ######################## PHONE CALLS (menu) ###########################
Phone Calls
crm.phonecall
@@ -22,26 +22,30 @@
+
tree
+
calendar
+
form
-
+
Inbound
@@ -53,25 +57,32 @@
{'set_editable':True,'default_state':'open'}
+
tree
+
calendar
+
form
-
+
+
+
Outbound
crm.phonecall
@@ -82,18 +93,21 @@
{'default_state':'open'}
+
tree
+
calendar
+
form
@@ -101,7 +115,9 @@
-
+
diff --git a/addons/crm/crm_phonecall_view.xml b/addons/crm/crm_phonecall_view.xml
index 64be1683d74..c75799c6ec5 100644
--- a/addons/crm/crm_phonecall_view.xml
+++ b/addons/crm/crm_phonecall_view.xml
@@ -2,9 +2,7 @@
- # ------------------------------------------------------
- # Phonecall Categories
- # ------------------------------------------------------
+
Phonecall Categories
@@ -15,12 +13,12 @@
{'object_id':'crm.phonecall'}
-
+
- # ------------------------------------------------------
- Resource Type
- # ------------------------------------------------------
-
+
+
+
Phonecall Resource Type
crm.case.resource.type
form
@@ -28,27 +26,28 @@
[('object_id.model', '=', 'crm.phonecall')]
{'object_id':'crm.phonecall'}
-
+
+
- # ------------------------------------------------------
- # Phone Calls
- # ------------------------------------------------------
-
+
CRM - Phone Calls Tree
crm.phonecall
tree
+
-
+
-
@@ -64,6 +63,8 @@
+
+
CRM - Phone Call Form
crm.phonecall
@@ -85,12 +86,12 @@
name="%(phonecall2opportunity_act)d"
icon="gtk-index" type="action"
attrs="{'invisible':[('opportunity_id','!=',False)]}" />
-
-
+
-
+
@@ -115,16 +116,27 @@
-
-
-
-
-
+
+
+
+
+
+
+
CRM - Phone Calls Calendar
crm.phonecall
@@ -133,11 +145,13 @@
-
+
+
+
CRM - Phone Calls Search
crm.phonecall
@@ -145,36 +159,50 @@
-
-
+
+
-
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
diff --git a/addons/crm/crm_phonecall_wizard.xml b/addons/crm/crm_phonecall_wizard.xml
deleted file mode 100644
index fa24e1a3f84..00000000000
--- a/addons/crm/crm_phonecall_wizard.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/crm/crm_report_view.xml b/addons/crm/crm_report_view.xml
index b7722ac8443..7b8b08dd7c9 100644
--- a/addons/crm/crm_report_view.xml
+++ b/addons/crm/crm_report_view.xml
@@ -2,9 +2,7 @@
- #
- # Cases by section and category2 of case
- #
+
CRM Report - Sections and Type(Tree)
@@ -25,6 +23,9 @@
+
+
+
CRM Report - Sections and Type(Form)
report.crm.case.section.categ2
@@ -44,6 +45,9 @@
+
+
+
CRM Report - Sections and Type(Graph)
report.crm.case.section.categ2
@@ -57,6 +61,8 @@
+
+
CRM Report - Sections and Type(Select)
report.crm.case.section.categ2
@@ -64,11 +70,17 @@
-
-
-
-
-
+
+
+
+
+
@@ -76,17 +88,16 @@
+
+
report.crm.case.section.categ2
form
graph,tree
-
- #
- # Cases by section and stage
- #
+
CRM Report - Sections and Stage(Tree)
@@ -106,6 +117,9 @@
+
+
+
CRM Report - Sections and Stage(Form)
report.crm.case.section.stage
@@ -124,6 +138,9 @@
+
+
+
CRM Report - Sections and Stage(Graph)
report.crm.case.section.stage
@@ -136,6 +153,9 @@
+
+
+
CRM Report - Sections and Stage(Select)
report.crm.case.section.stage
@@ -143,9 +163,13 @@
-
-
-
+
+
+
@@ -154,6 +178,8 @@
+
+
report.crm.case.section.stage
form
@@ -161,9 +187,7 @@
- #
- # Cases by section, category and stage
- #
+
CRM Report - Section, Category and Stage(Tree)
@@ -183,6 +207,9 @@
+
+
+
CRM Report - Section, Category and Stage(Form)
report.crm.case.section.categ.stage
@@ -202,6 +229,8 @@
+
+
CRM Report - Section, Category and Stage(Select)
report.crm.case.section.categ.stage
@@ -224,6 +253,9 @@
+
+
+
CRM Report - Section, Category and Stage(Select)
report.crm.case.section.categ.stage
@@ -236,6 +268,9 @@
+
+
+
report.crm.case.section.categ.stage
form
@@ -243,9 +278,7 @@
- #
- # Cases by section, category and category2
- #
+
CRM Report - Section, Category and Type(Tree)
@@ -266,6 +299,9 @@
+
+
+
CRM Report - Section, Category and Type(Form)
report.crm.case.section.categ.categ2
@@ -286,6 +322,8 @@
+
+
CRM Report - Section, Category and Type(Select)
report.crm.case.section.categ.categ2
@@ -308,6 +346,8 @@
+
+
CRM Report - Section, Category and Type(Select)
report.crm.case.section.categ.categ2
@@ -320,6 +360,9 @@
+
+
+
report.crm.case.section.categ.categ2
form
diff --git a/addons/crm/crm_segmentation.py b/addons/crm/crm_segmentation.py
index 2f0e2a1c650..516873d484f 100644
--- a/addons/crm/crm_segmentation.py
+++ b/addons/crm/crm_segmentation.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,7 +15,7 @@
# 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 .
+# along with this program. If not, see .
#
##############################################################################
@@ -31,19 +31,45 @@ class crm_segmentation(osv.osv):
'''
_name = "crm.segmentation"
_description = "Partner Segmentation"
+
_columns = {
'name': fields.char('Name', size=64, required=True, help='The name of the segmentation.'),
'description': fields.text('Description'),
- 'categ_id': fields.many2one('res.partner.category', 'Partner Category', required=True, help='The partner category that will be added to partners that match the segmentation criterions after computation.'),
- 'exclusif': fields.boolean('Exclusive', help='Check if the category is limited to partners that match the segmentation criterions. If checked, remove the category from partners that doesn\'t match segmentation criterions'),
- 'state': fields.selection([('not running','Not Running'),('running','Running')], 'Execution Status', readonly=True),
+ 'categ_id': fields.many2one('res.partner.category', 'Partner Category',\
+ required=True, help='The partner category that will be \
+ added to partners that match the segmentation criterions after computation.'),
+ 'exclusif': fields.boolean('Exclusive', help='Check if the category is \
+ limited to partners that match the segmentation criterions.\
+ If checked, remove the category from partners that doesn\'t \
+ match segmentation criterions'),
+ 'state': fields.selection([('not running','Not Running'),\
+ ('running','Running')], 'Execution Status', readonly=True),
'partner_id': fields.integer('Max Partner ID processed'),
- 'segmentation_line': fields.one2many('crm.segmentation.line', 'segmentation_id', 'Criteria', required=True),
- 'som_interval': fields.integer('Days per Periode', help="A period is the average number of days between two cycle of sale or purchase for this segmentation. It's mainly used to detect if a partner has not purchased or buy for a too long time, so we suppose that his state of mind has decreased because he probably bought goods to another supplier. Use this functionality for recurring businesses."),
- 'som_interval_max': fields.integer('Max Interval', help="The computation is made on all events that occured during this interval, the past X periods."),
- 'som_interval_decrease': fields.float('Decrease (0>1)', help="If the partner has not purchased (or bought) during a period, decrease the state of mind by this factor. It\'s a multiplication"),
- 'som_interval_default': fields.float('Default (0=None)', help="Default state of mind for period preceeding the 'Max Interval' computation. This is the starting state of mind by default if the partner has no event."),
- 'sales_purchase_active': fields.boolean('Use The Sales Purchase Rules', help='Check if you want to use this tab as part of the segmentation rule. If not checked, the criteria beneath will be ignored')
+ 'segmentation_line': fields.one2many('crm.segmentation.line', \
+ 'segmentation_id', 'Criteria', required=True),
+ 'som_interval': fields.integer('Days per Periode', help="A period is the \
+ average number of days between two cycle of sale or\
+ purchase for this segmentation. It's mainly used to\
+ detect if a partner has not purchased or buy for a too \
+ long time, so we suppose that his state of mind has \
+ decreased because he probably bought goods to another \
+ supplier. Use this functionality for recurring businesses."),
+ 'som_interval_max': fields.integer('Max Interval', help="The computation \
+ is made on all events that occured during this \
+ interval, the past X periods."),
+ 'som_interval_decrease': fields.float('Decrease (0>1)', help="If the \
+ partner has not purchased (or bought) \
+ during a period, decrease the state of \
+ mind by this factor. It\'s a multiplication"),
+ 'som_interval_default': fields.float('Default (0=None)', help="Default \
+ state of mind for period preceeding the \
+ 'Max Interval' computation. This is the \
+ starting state of mind by default if the \
+ partner has no event."),
+ 'sales_purchase_active': fields.boolean('Use The Sales Purchase Rules',\
+ help='Check if you want to use this tab as\
+ part of the segmentation rule. If not \
+ checked, the criteria beneath will be ignored')
}
_defaults = {
'partner_id': lambda *a: 0,
@@ -54,11 +80,19 @@ class crm_segmentation(osv.osv):
}
def process_continue(self, cr, uid, ids, start=False):
- categs = self.read(cr,uid,ids,['categ_id','exclusif','partner_id', 'sales_purchase_active', 'profiling_active'])
+
+ """ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of Process continue’s IDs"""
+
+ categs = self.read(cr, uid, ids, ['categ_id', 'exclusif', 'partner_id',\
+ 'sales_purchase_active', 'profiling_active'])
for categ in categs:
if start:
if categ['exclusif']:
- cr.execute('delete from res_partner_category_rel where category_id=%s', (categ['categ_id'][0],))
+ cr.execute('delete from res_partner_category_rel \
+ where category_id=%s', (categ['categ_id'][0],))
id = categ['id']
@@ -77,7 +111,8 @@ class crm_segmentation(osv.osv):
partners.remove(pid)
for partner_id in partners:
- cr.execute('insert into res_partner_category_rel (category_id,partner_id) values (%s,%s)', (categ['categ_id'][0],partner_id))
+ cr.execute('insert into res_partner_category_rel (category_id,partner_id) \
+ values (%s,%s)', (categ['categ_id'][0], partner_id))
cr.commit()
self.write(cr, uid, [id], {'state':'not running', 'partner_id':0})
@@ -85,23 +120,39 @@ class crm_segmentation(osv.osv):
return True
def process_stop(self, cr, uid, ids, *args):
+
+ """ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of Process stop’s IDs"""
+
return self.write(cr, uid, ids, {'state':'not running', 'partner_id':0})
def process_start(self, cr, uid, ids, *args):
+
+ """ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of Process start’s IDs """
+
self.write(cr, uid, ids, {'state':'running', 'partner_id':0})
return self.process_continue(cr, uid, ids, start=True)
crm_segmentation()
class crm_segmentation_line(osv.osv):
+ """ Segmentation line """
_name = "crm.segmentation.line"
_description = "Segmentation line"
+
_columns = {
'name': fields.char('Rule Name', size=64, required=True),
'segmentation_id': fields.many2one('crm.segmentation', 'Segmentation'),
- 'expr_name': fields.selection([('sale','Sale Amount'),('som','State of Mind'),('purchase','Purchase Amount')], 'Control Variable', size=64, required=True),
+ 'expr_name': fields.selection([('sale','Sale Amount'),('som','State of Mind'),\
+ ('purchase','Purchase Amount')], 'Control Variable', size=64, required=True),
'expr_operator': fields.selection([('<','<'),('=','='),('>','>')], 'Operator', required=True),
'expr_value': fields.float('Value', required=True),
- 'operator': fields.selection([('and','Mandatory Expression'),('or','Optional Expression')],'Mandatory / Optional', required=True),
+ 'operator': fields.selection([('and','Mandatory Expression'),\
+ ('or','Optional Expression')],'Mandatory / Optional', required=True),
}
_defaults = {
'expr_name': lambda *a: 'sale',
@@ -109,6 +160,12 @@ class crm_segmentation_line(osv.osv):
'operator': lambda *a: 'and'
}
def test(self, cr, uid, ids, partner_id):
+
+ """ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of Test’s IDs """
+
expression = {'<': lambda x,y: x':lambda x,y:x>y}
ok = False
lst = self.read(cr, uid, ids)
@@ -117,7 +174,8 @@ class crm_segmentation_line(osv.osv):
if cr.fetchone():
if l['expr_name']=='som':
datas = self.pool.get('crm.segmentation').read(cr, uid, [l['segmentation_id'][0]],
- ['som','som_interval','som_interval_max','som_interval_default', 'som_interval_decrease'])
+ ['som','som_interval','som_interval_max',\
+ 'som_interval_default', 'som_interval_decrease'])
value = crm_operators.som(cr, uid, partner_id, datas[0])
elif l['expr_name']=='sale':
cr.execute('SELECT SUM(l.price_unit * l.quantity) ' \
@@ -155,10 +213,8 @@ class crm_segmentation_line(osv.osv):
if res:
return True
return True
+
crm_segmentation_line()
-
-
-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/crm/crm_view.xml b/addons/crm/crm_view.xml
index a970701b735..16abc70f8b8 100644
--- a/addons/crm/crm_view.xml
+++ b/addons/crm/crm_view.xml
@@ -1,10 +1,10 @@
-
-
+
+
crm.case.section.form
crm.case.section
@@ -25,6 +25,9 @@
+
+
+
crm.case.section.tree
crm.case.section
@@ -38,6 +41,9 @@
+
+
+
Sections
crm.case.section
@@ -45,9 +51,8 @@
- # ------------------------------------------------------
- # Stage
- # ------------------------------------------------------
+
+
crm.case.stage.tree
crm.case.stage
@@ -62,6 +67,9 @@
+
+
+
crm.case.stage.form
crm.case.stage
@@ -80,16 +88,21 @@
+
+
+
Stages
crm.case.stage
form
+
-
+
+
crm.case.categ.form
crm.case.categ
@@ -102,6 +115,9 @@
+
+
+
crm.case.categ.tree
crm.case.categ
@@ -114,6 +130,8 @@
+
+
Categories
crm.case.categ
@@ -122,12 +140,13 @@
-
+
- # ------------------------------------------------------
- # Resource Type of case
- # ------------------------------------------------------
+
+
crm.case.resource.type.tree
crm.case.resource.type
@@ -140,6 +159,9 @@
+
+
+
crm.case.resource.type.form
crm.case.resource.type
@@ -153,18 +175,17 @@
+
+
Resource Type
crm.case.resource.type
form
-
+
-
-
-
-
Cases by section
crm.case.section
@@ -172,8 +193,8 @@
tree
-
+
Add CC
@@ -197,6 +218,8 @@
+
+
Add CC
ir.actions.act_window
@@ -206,9 +229,8 @@
new
+
-
-
crm.case.log.tree
crm.case.log
@@ -225,6 +247,7 @@
+
crm.case.history.tree
@@ -241,19 +264,24 @@
+
+
crm.case.calendar
crm.case
calendar
-
-
-
-
+
+
+
+
+
crm.case.tree
@@ -269,16 +297,29 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
crm.case.form
crm.case
@@ -294,25 +335,53 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
@@ -370,28 +439,37 @@
+
+
crm.case.select
crm.case
search
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -402,13 +480,14 @@
-
Open Cases
crm.case
form
- [('state','<>','done'),('state','<>','cancel'),('state','<>','pending')]
+
+ [('state','<>','done'),('state','<>','cancel'),('state','<>','pending')]
+
@@ -427,6 +506,8 @@
+
+
crm.case.history.form
crm.case.history
@@ -445,23 +526,32 @@
+
+
+
crm.case.history.select
crm.case.history
search
-
+
-
-
+
+
+
+
Histories
crm.case.history
@@ -470,7 +560,8 @@
-
+
+
crm.segmentation.line.tree
@@ -487,6 +578,8 @@
+
+
crm.segmentation.line.form
crm.segmentation.line
@@ -505,6 +598,8 @@
+
+
crm.segmentation.form
crm.segmentation
@@ -533,13 +628,23 @@
-
-
-
+
+
+
+
+
+
crm.segmentation.tree
crm.segmentation
@@ -566,18 +671,9 @@
form
tree,form
-
-
-
-
-
-
-
-
-
-
-
-
+
view.users.form.crm.modif.inherited1
@@ -586,7 +682,9 @@
form
-
+
@@ -604,6 +702,8 @@
+
+
view.res.partner.form.crm.inherited1
res.partner
diff --git a/addons/crm/security/ir.model.access.csv b/addons/crm/security/ir.model.access.csv
index ea6b704f5d8..53a8fd84347 100644
--- a/addons/crm/security/ir.model.access.csv
+++ b/addons/crm/security/ir.model.access.csv
@@ -42,3 +42,4 @@
"access_crm_phonecall2opportunity","crm.phonecall2opportunity","model_crm_phonecall2opportunity","crm.group_crm_user",1,1,1,1
"access_report_crm_helpdesk","report.crm.helpdesk","model_crm_helpdesk_report","crm.group_crm_user",1,1,1,1
"access_crm_send_mail","crm.send.mail","model_crm_send_mail","crm.group_crm_user",1,1,1,1
+"access_crm_partner2opportunity","crm.partner2opportunity","model_crm_partner2opportunity","crm.group_crm_user",1,1,1,1
diff --git a/addons/crm/wizard/crm_opportunity_to_phonecall_view.xml b/addons/crm/wizard/crm_opportunity_to_phonecall_view.xml
index ae07471e07c..827ee867169 100644
--- a/addons/crm/wizard/crm_opportunity_to_phonecall_view.xml
+++ b/addons/crm/wizard/crm_opportunity_to_phonecall_view.xml
@@ -1,9 +1,9 @@
-
+
-
+
crm.opportunity2phonecall.form
crm.opportunity2phonecall
@@ -25,9 +25,9 @@
-
+
-
+
Schedule Call
crm.opportunity2phonecall
@@ -35,8 +35,7 @@
form
new
- {'record_id' : active_id}
-
+
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/addons/crm/wizard/crm_opportunity_wizard.py b/addons/crm/wizard/crm_opportunity_wizard.py
deleted file mode 100644
index d7ec0b72cb6..00000000000
--- a/addons/crm/wizard/crm_opportunity_wizard.py
+++ /dev/null
@@ -1,264 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL (). All Rights Reserved
-# $Id$
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-from mx.DateTime import now
-
-import wizard
-import netsvc
-import ir
-import pooler
-import time
-
-from tools.translate import _
-
-class opportunity2phonecall(wizard.interface):
- case_form = """
- """
-
- case_fields = {
- 'user_id' : {'string' : 'Assign To', 'type' : 'many2one', 'relation' : 'res.users'},
- 'deadline' : {'string' : 'Planned Date', 'type' : 'datetime' ,'required' :True},
- 'note' : {'string' : 'Goals', 'type' : 'text'},
- 'category_id' : {'string' : 'Category', 'type' : 'many2one', 'relation' : 'crm.case.categ', 'required' :True},
- 'section_id' : {'string' : 'Section', 'type' : 'many2one', 'relation' : 'crm.case.section'},
-
- }
- def _default_values(self, cr, uid, data, context):
- case_obj = pooler.get_pool(cr.dbname).get('crm.opportunity')
- categ_id = pooler.get_pool(cr.dbname).get('crm.case.categ').search(cr, uid, [('name','=','Outbound')])
- case = case_obj.browse(cr, uid, data['id'])
- if case.state != 'open':
- raise wizard.except_wizard(_('Warning !'),
- _('Opportunity should be in \'Open\' state before converting to Phone Call.'))
- return {}
- return {
- 'user_id' : case.user_id and case.user_id.id,
- 'category_id' : categ_id and categ_id[0] or case.categ_id and case.categ_id.id,
- 'section_id' : case.section_id and case.section_id.id or False,
- 'note' : case.description
- }
-
- def _doIt(self, cr, uid, data, context):
- form = data['form']
- pool = pooler.get_pool(cr.dbname)
- mod_obj = pool.get('ir.model.data')
- result = mod_obj._get_id(cr, uid, 'crm', 'view_crm_case_phonecalls_filter')
- res = mod_obj.read(cr, uid, result, ['res_id'])
- phonecall_case_obj = pool.get('crm.phonecall')
- opportunity_case_obj = pool.get('crm.opportunity')
- # Select the view
-
- data_obj = pool.get('ir.model.data')
- id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_phone_tree_view')
- id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_phone_form_view')
- if id2:
- id2 = data_obj.browse(cr, uid, id2, context=context).res_id
- if id3:
- id3 = data_obj.browse(cr, uid, id3, context=context).res_id
-
- opportunites = opportunity_case_obj.browse(cr, uid, data['ids'])
- for opportunity in opportunites:
- new_case = phonecall_case_obj.create(cr, uid, {
- 'name' : opportunity.name,
- 'case_id' : opportunity.id,
- 'user_id' : form['user_id'],
- 'categ_id' : form['category_id'],
- 'description' : form['note'],
- 'date' : form['deadline'],
- 'section_id' : form['section_id'],
- 'partner_id': opportunity.partner_id and opportunity.partner_id.id or False,
- 'partner_address_id':opportunity.partner_address_id and opportunity.partner_address_id.id or False,
- 'description': data['form']['note'] or opportunity.description,
- 'partner_phone' : opportunity.phone or (opportunity.partner_address_id and opportunity.partner_address_id.phone or False),
- 'partner_mobile' : opportunity.partner_address_id and opportunity.partner_address_id.mobile or False,
- 'priority': opportunity.priority,
- 'opportunity_id':opportunity.id
- }, context=context)
- vals = {}
-
- phonecall_case_obj.case_open(cr, uid, [new_case])
-
- value = {
- 'name': _('Phone Call'),
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'crm.phonecall',
- 'res_id' : new_case,
- 'views': [(id3,'form'),(id2,'tree'),(False,'calendar'),(False,'graph')],
- 'type': 'ir.actions.act_window',
- 'search_view_id': res['res_id']
- }
- return value
-
- states = {
- 'init': {
- 'actions': [_default_values],
- 'result': {'type': 'form', 'arch': case_form, 'fields': case_fields,
- 'state' : [('end', 'Cancel','gtk-cancel'),('order', 'Schedule Phone Call','gtk-go-forward')]}
- },
- 'order': {
- 'actions': [],
- 'result': {'type': 'action', 'action': _doIt, 'state': 'end'}
- }
- }
-
-opportunity2phonecall('crm.opportunity.reschedule_phone_call')
-
-class opportunity2meeting(wizard.interface):
-
- def _makeMeeting(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- opportunity_case_obj = pool.get('crm.opportunity')
- data_obj = pool.get('ir.model.data')
- result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_meetings_filter')
- id = data_obj.read(cr, uid, result, ['res_id'])
- id1 = data_obj._get_id(cr, uid, 'crm', 'crm_case_calendar_view_meet')
- id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_form_view_meet')
- id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_tree_view_meet')
- if id1:
- id1 = data_obj.browse(cr, uid, id1, context=context).res_id
- if id2:
- id2 = data_obj.browse(cr, uid, id2, context=context).res_id
- if id3:
- id3 = data_obj.browse(cr, uid, id3, context=context).res_id
- opportunity = opportunity_case_obj.browse(cr, uid, data['id'], context=context)
- partner_id = opportunity.partner_id and opportunity.partner_id.id or False
- name = opportunity.name
- email = opportunity.email_from
- section_id = opportunity.section_id and opportunity.section_id.id or False
- return {
- 'name': _('Meetings'),
- 'domain' : "[('user_id','=',%s)]"%(uid),
- 'context': {'default_partner_id': partner_id, 'default_section_id': section_id, 'default_email_from': email, 'default_state':'open', 'default_name':name},
- 'view_type': 'form',
- 'view_mode': 'calendar,form,tree',
- 'res_model': 'crm.meeting',
- 'view_id': False,
- 'views': [(id1,'calendar'),(id2,'form'),(id3,'tree')],
- 'type': 'ir.actions.act_window',
- 'search_view_id': id['res_id']
- }
-
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'action', 'action': _makeMeeting, 'state': 'order'}
- },
- 'order': {
- 'actions': [],
- 'result': {'type': 'state', 'state': 'end'}
- }
- }
-opportunity2meeting('crm.opportunity.meeting_set')
-
-class partner_opportunity(wizard.interface):
-
- case_form = """
- """
-
- case_fields = {
- 'name' : {'type' :'char', 'size' :64, 'string' :'Opportunity Name', 'required' :True},
- 'planned_revenue' : {'type' :'float', 'digits' :(16, 2), 'string' : 'Expected Revenue'},
- 'probability' : {'type' :'float', 'digits' :(16, 2), 'string' : 'Success Probability'},
- 'partner_id' : {'type' :'many2one', 'relation' :'res.partner', 'string' :'Partner'},
- }
-
- def _select_data(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- part_obj = pool.get('res.partner')
- part = part_obj.read(cr, uid, data['id' ], ['name'])
- return {'partner_id' : data['id'], 'name' : part['name'] }
-
- def _make_opportunity(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- data_obj = pool.get('ir.model.data')
- result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_opportunities_filter')
- res = data_obj.read(cr, uid, result, ['res_id'])
-
- id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_form_view_oppor')
- id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_tree_view_oppor')
- if id2:
- id2 = data_obj.browse(cr, uid, id2, context=context).res_id
- if id3:
- id3 = data_obj.browse(cr, uid, id3, context=context).res_id
-
- part_obj = pool.get('res.partner')
- address = part_obj.address_get(cr, uid, data['ids' ])
-
-
- categ_obj = pool.get('crm.case.categ')
- categ_ids = categ_obj.search(cr, uid, [('name','ilike','Part%')])
-
- case_obj = pool.get('crm.opportunity')
- opp_id = case_obj.create(cr, uid, {
- 'name' : data['form']['name'],
- 'planned_revenue' : data['form']['planned_revenue'],
- 'probability' : data['form']['probability'],
- 'partner_id' : data['form']['partner_id'],
- 'partner_address_id' : address['default'],
- 'categ_id' : categ_ids[0],
- 'state' :'draft',
- })
- value = {
- 'name' : _('Opportunity'),
- 'view_type' : 'form',
- 'view_mode' : 'form,tree',
- 'res_model' : 'crm.opportunity',
- 'res_id' : opp_id,
- 'view_id' : False,
- 'views' : [(id2, 'form'), (id3, 'tree'), (False, 'calendar'), (False, 'graph')],
- 'type' : 'ir.actions.act_window',
- 'search_view_id' : res['res_id']
- }
- return value
-
- states = {
- 'init' : {
- 'actions' : [_select_data],
- 'result' : {'type' : 'form', 'arch' : case_form, 'fields' : case_fields,
- 'state' : [('end', 'Cancel', 'gtk-cancel'), ('confirm', 'Create Opportunity', 'gtk-go-forward')]}
- },
- 'confirm' : {
- 'actions' : [],
- 'result' : {'type' : 'action', 'action' : _make_opportunity, 'state' : 'end'}
- }
- }
-
-partner_opportunity('crm.case.opportunity.partner_opportunity')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/crm/wizard/crm_phonecall_to_phonecall.py b/addons/crm/wizard/crm_phonecall_to_phonecall.py
index e925d9ef330..fd62b3a21ca 100644
--- a/addons/crm/wizard/crm_phonecall_to_phonecall.py
+++ b/addons/crm/wizard/crm_phonecall_to_phonecall.py
@@ -56,7 +56,7 @@ class crm_phonecall2phonecall(osv.osv_memory):
if record_id:
data_obj = self.pool.get('ir.model.data')
-
+
# Get Phonecall views
result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_phonecalls_filter')
res = data_obj.read(cr, uid, result, ['res_id'])
@@ -71,16 +71,16 @@ class crm_phonecall2phonecall(osv.osv_memory):
for this in self.browse(cr, uid, ids, context=context):
values = {
- 'name': this.name,
- 'user_id': this.user_id and this.user_id.id,
- 'categ_id': phonecall.categ_id and phonecall.categ_id.id or False,
- 'section_id': phonecall.section_id and phonecall.section_id.id,
- 'description': phonecall.description or '',
- 'partner_id': phonecall.partner_id.id,
- 'partner_address_id': phonecall.partner_address_id.id,
- 'partner_mobile': phonecall.partner_mobile or False,
- 'priority': phonecall.priority,
- 'partner_phone': phonecall.partner_phone or False,
+ 'name': this.name,
+ 'user_id': this.user_id and this.user_id.id,
+ 'categ_id': phonecall.categ_id and phonecall.categ_id.id or False,
+ 'section_id': phonecall.section_id and phonecall.section_id.id,
+ 'description': phonecall.description or '',
+ 'partner_id': phonecall.partner_id.id,
+ 'partner_address_id': phonecall.partner_address_id.id,
+ 'partner_mobile': phonecall.partner_mobile or False,
+ 'priority': phonecall.priority,
+ 'partner_phone': phonecall.partner_phone or False,
'date': this.date
}
phonecall_id = phonecall_obj.create(cr, uid, values, context=context)
@@ -103,7 +103,7 @@ class crm_phonecall2phonecall(osv.osv_memory):
'date': fields.datetime('Date'),
'section_id':fields.many2one('crm.case.section','Sales Team'),
}
-
+
def default_get(self, cr, uid, fields, context=None):
"""
This function gets default values
@@ -117,8 +117,10 @@ class crm_phonecall2phonecall(osv.osv_memory):
"""
res = super(crm_phonecall2phonecall, self).default_get(cr, uid, fields, context=context)
record_id = context and context.get('active_id', False) or False
+
if record_id:
phonecall = self.pool.get('crm.phonecall').browse(cr, uid, record_id, context=context)
+
if 'name' in fields:
res.update({'name': phonecall.name})
if 'user_id' in fields: