[MERGE]: Merge with lp:~openerp-dev/openobject-addons/rpa-dev-addons2
bzr revid: atp@tinyerp.co.in-20100428084702-q1oaod2kch8m9g4a
This commit is contained in:
@@ -33,20 +33,99 @@ class base_action_rule(osv.osv):
|
||||
|
||||
_name = 'base.action.rule'
|
||||
_description = 'Action Rules'
|
||||
|
||||
def _state_get(self, cr, uid, context={}):
|
||||
""" Get State
|
||||
@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 """
|
||||
|
||||
return self.state_get(cr, uid, context=context)
|
||||
|
||||
|
||||
def state_get(self, cr, uid, context={}):
|
||||
""" Get State
|
||||
@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 """
|
||||
|
||||
return [('','')]
|
||||
|
||||
_columns = {
|
||||
'name': fields.many2one('ir.model', 'Model', required=True),
|
||||
'max_level': fields.integer('Max Level', help='Specifies maximum level.'),
|
||||
'rule_lines': fields.one2many('base.action.rule.line','rule_id','Rule Lines'),
|
||||
'create_date': fields.datetime('Create Date', readonly=1),
|
||||
'active': fields.boolean('Active')
|
||||
'active': fields.boolean('Active', help="If the active field is set to true,\
|
||||
it will allow you to hide the rule without removing it."),
|
||||
'sequence': fields.integer('Sequence', help="Gives the sequence order when\
|
||||
displaying a list of rules."),
|
||||
'trg_date_type': fields.selection([
|
||||
('none','None'),
|
||||
('create','Creation Date'),
|
||||
('action_last','Last Action Date'),
|
||||
('date','Date'),
|
||||
('deadline', 'Deadline'),
|
||||
], 'Trigger Date', size=16),
|
||||
'trg_date_range': fields.integer('Delay after trigger date',help="Delay After Trigger Date,\
|
||||
specifies you can put a negative number " \
|
||||
"if you need a delay before the trigger date, like sending a reminder 15 minutes before a meeting."),
|
||||
'trg_date_range_type': fields.selection([('minutes', 'Minutes'),('hour','Hours'),\
|
||||
('day','Days'),('month','Months')], 'Delay type'),
|
||||
|
||||
|
||||
'trg_user_id': fields.many2one('res.users', 'Responsible'),
|
||||
|
||||
'trg_partner_id': fields.many2one('res.partner', 'Partner'),
|
||||
'trg_partner_categ_id': fields.many2one('res.partner.category', 'Partner Category'),
|
||||
'trg_state_from': fields.selection(_state_get, 'State', size=16),
|
||||
'trg_state_to': fields.selection(_state_get, 'Button Pressed', size=16),
|
||||
|
||||
'act_method': fields.char('Call Object Method', size=64),
|
||||
'act_user_id': fields.many2one('res.users', 'Set responsible to'),
|
||||
'act_state': fields.selection(_state_get, 'Set state to', size=16),
|
||||
'act_email_cc': fields.char('Add watchers (Cc)', size=250, help="These people\
|
||||
will receive a copy of the future communication between partner and users by email"),
|
||||
|
||||
'act_remind_partner': fields.boolean('Remind Partner', help="Check this if\
|
||||
you want the rule to send a reminder by email to the partner."),
|
||||
'act_remind_user': fields.boolean('Remind responsible', help="Check this if \
|
||||
you want the rule to send a reminder by email to the user."),
|
||||
'act_reply_to': fields.char('Reply-To', size=64),
|
||||
'act_remind_attach': fields.boolean('Remind with attachment', help="Check this if\
|
||||
you want that all documents attached to the object be attached \
|
||||
to the reminder email sent."),
|
||||
|
||||
'act_mail_to_user': fields.boolean('Mail to responsible',help="Check this if \
|
||||
you want the rule to send an email to the responsible person."),
|
||||
'act_mail_to_watchers': fields.boolean('Mail to watchers (CC)',help="Check this\
|
||||
if you want the rule to mark CC(mail to any other person\
|
||||
defined in actions)."),
|
||||
'act_mail_to_email': fields.char('Mail to these emails', size=128,help="Email-id \
|
||||
of the persons whom mail is to be sent"),
|
||||
'act_mail_body': fields.text('Mail body',help="Content of mail"),
|
||||
'regex_name': fields.char('Regular Expression on Model Name', size=128),
|
||||
'server_action_id': fields.many2one('ir.actions.server','Server Action',help="Describes the\
|
||||
action name." \
|
||||
"eg:on which object which action to be taken on basis of which condition"),
|
||||
'domain':fields.char('Domain', size=124, required=False, readonly=False),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'active': lambda *a: True,
|
||||
'max_level': lambda *a: 15,
|
||||
'trg_date_type': lambda *a: 'none',
|
||||
'trg_date_range_type': lambda *a: 'day',
|
||||
'act_mail_to_user': lambda *a: 0,
|
||||
'act_remind_partner': lambda *a: 0,
|
||||
'act_remind_user': lambda *a: 0,
|
||||
'act_mail_to_watchers': lambda *a: 0,
|
||||
'domain': lambda *a: '[]'
|
||||
}
|
||||
|
||||
|
||||
_order = 'sequence'
|
||||
|
||||
def format_body(self, body):
|
||||
""" Foramat Action rule's body
|
||||
@param self: The object pointer """
|
||||
@@ -56,7 +135,6 @@ class base_action_rule(osv.osv):
|
||||
def format_mail(self, obj, body):
|
||||
""" Foramat Mail
|
||||
@param self: The object pointer """
|
||||
|
||||
data = {
|
||||
'object_id': obj.id,
|
||||
'object_subject': hasattr(obj, 'name') and obj.name or False,
|
||||
@@ -105,6 +183,10 @@ class base_action_rule(osv.osv):
|
||||
@param context: A standard dictionary for contextual values """
|
||||
|
||||
ok = True
|
||||
if eval(action.domain):
|
||||
obj_ids = obj._table.search(cr, uid, eval(action.domain), context=context)
|
||||
if not obj.id in obj_ids:
|
||||
ok = False
|
||||
if hasattr(obj, 'user_id'):
|
||||
ok = ok and (not action.trg_user_id.id or action.trg_user_id.id==obj.user_id.id)
|
||||
if hasattr(obj, 'partner_id'):
|
||||
@@ -122,10 +204,6 @@ class base_action_rule(osv.osv):
|
||||
if state_to:
|
||||
ok = ok and (not action.trg_state_to or action.trg_state_to==state_to)
|
||||
|
||||
if hasattr(obj, 'priority'):
|
||||
ok = ok and (not action.trg_priority_from or action.trg_priority_from>=obj.priority)
|
||||
ok = ok and (not action.trg_priority_to or action.trg_priority_to<=obj.priority)
|
||||
|
||||
reg_name = action.regex_name
|
||||
result_name = True
|
||||
if reg_name:
|
||||
@@ -163,10 +241,6 @@ class base_action_rule(osv.osv):
|
||||
obj.categ_id = action.act_categ_id
|
||||
write['categ_id'] = action.act_categ_id.id
|
||||
|
||||
if hasattr(obj, 'priority') and action.act_priority:
|
||||
obj.priority = action.act_priority
|
||||
write['priority'] = action.act_priority
|
||||
|
||||
model_obj.write(cr, uid, [obj.id], write, context)
|
||||
|
||||
if hasattr(model_obj, 'remind_user') and action.act_remind_user:
|
||||
@@ -198,178 +272,59 @@ class base_action_rule(osv.osv):
|
||||
@param ids: List of Basic Action Rule’s IDs,
|
||||
@param objects: pass objects
|
||||
@param context: A standard dictionary for contextual values """
|
||||
|
||||
if not scrit:
|
||||
scrit = []
|
||||
rule_line_obj = self.pool.get('base.action.rule.line')
|
||||
for rule in self.browse(cr, uid, ids):
|
||||
level = rule.max_level
|
||||
cr.execute("select id from base_action_rule order by sequence")
|
||||
rule_ids = map(lambda x: x[0], cr.fetchall())
|
||||
for action in self.browse(cr, uid, rule_ids):
|
||||
level = action.max_level
|
||||
if not level:
|
||||
break
|
||||
newactions = []
|
||||
scrit += [('rule_id','=',rule.id)]
|
||||
line_ids = rule_line_obj.search(cr, uid, scrit)
|
||||
actions = rule_line_obj.browse(cr, uid, line_ids, context=context)
|
||||
model_obj = self.pool.get(rule.name.model)
|
||||
model_obj = self.pool.get(action.name.model)
|
||||
for obj in objects:
|
||||
for action in actions:
|
||||
ok = self.do_check(cr, uid, action, obj, context=context)
|
||||
if not ok:
|
||||
continue
|
||||
ok = self.do_check(cr, uid, action, obj, context=context)
|
||||
if not ok:
|
||||
continue
|
||||
|
||||
base = False
|
||||
if hasattr(obj, 'create_date') and action.trg_date_type=='create':
|
||||
base = mx.DateTime.strptime(obj.create_date[:19], '%Y-%m-%d %H:%M:%S')
|
||||
elif hasattr(obj, 'create_date') and action.trg_date_type=='action_last':
|
||||
if hasattr(obj, 'date_action_last') and obj.date_action_last:
|
||||
base = mx.DateTime.strptime(obj.date_action_last, '%Y-%m-%d %H:%M:%S')
|
||||
else:
|
||||
base = mx.DateTime.strptime(obj.create_date[:19], '%Y-%m-%d %H:%M:%S')
|
||||
elif hasattr(obj, 'date_deadline') and action.trg_date_type=='deadline' \
|
||||
and obj.date_deadline:
|
||||
base = mx.DateTime.strptime(obj.date_deadline, '%Y-%m-%d %H:%M:%S')
|
||||
elif hasattr(obj, 'date') and action.trg_date_type=='date' and obj.date:
|
||||
base = mx.DateTime.strptime(obj.date, '%Y-%m-%d %H:%M:%S')
|
||||
if base:
|
||||
fnct = {
|
||||
'minutes': lambda interval: mx.DateTime.RelativeDateTime(minutes=interval),
|
||||
'day': lambda interval: mx.DateTime.RelativeDateTime(days=interval),
|
||||
'hour': lambda interval: mx.DateTime.RelativeDateTime(hours=interval),
|
||||
'month': lambda interval: mx.DateTime.RelativeDateTime(months=interval),
|
||||
}
|
||||
d = base + fnct[action.trg_date_range_type](action.trg_date_range)
|
||||
dt = d.strftime('%Y-%m-%d %H:%M:%S')
|
||||
ok = False
|
||||
if hasattr(obj, 'date_action_last') and hasattr(obj, 'date_action_next'):
|
||||
ok = (dt <= time.strftime('%Y-%m-%d %H:%M:%S')) and \
|
||||
((not obj.date_action_next) or \
|
||||
(dt >= obj.date_action_next and \
|
||||
obj.date_action_last < obj.date_action_next))
|
||||
if not ok:
|
||||
if not obj.date_action_next or dt < obj.date_action_next:
|
||||
obj.date_action_next = dt
|
||||
model_obj.write(cr, uid, [obj.id], {'date_action_next': dt}, context)
|
||||
base = False
|
||||
if hasattr(obj, 'create_date') and action.trg_date_type=='create':
|
||||
base = mx.DateTime.strptime(obj.create_date[:19], '%Y-%m-%d %H:%M:%S')
|
||||
elif hasattr(obj, 'create_date') and action.trg_date_type=='action_last':
|
||||
if hasattr(obj, 'date_action_last') and obj.date_action_last:
|
||||
base = mx.DateTime.strptime(obj.date_action_last, '%Y-%m-%d %H:%M:%S')
|
||||
else:
|
||||
ok = action.trg_date_type=='none'
|
||||
|
||||
if ok:
|
||||
self.do_action(cr, uid, action, model_obj, obj, context)
|
||||
break
|
||||
base = mx.DateTime.strptime(obj.create_date[:19], '%Y-%m-%d %H:%M:%S')
|
||||
elif hasattr(obj, 'date_deadline') and action.trg_date_type=='deadline' \
|
||||
and obj.date_deadline:
|
||||
base = mx.DateTime.strptime(obj.date_deadline, '%Y-%m-%d %H:%M:%S')
|
||||
elif hasattr(obj, 'date') and action.trg_date_type=='date' and obj.date:
|
||||
base = mx.DateTime.strptime(obj.date, '%Y-%m-%d %H:%M:%S')
|
||||
if base:
|
||||
fnct = {
|
||||
'minutes': lambda interval: mx.DateTime.RelativeDateTime(minutes=interval),
|
||||
'day': lambda interval: mx.DateTime.RelativeDateTime(days=interval),
|
||||
'hour': lambda interval: mx.DateTime.RelativeDateTime(hours=interval),
|
||||
'month': lambda interval: mx.DateTime.RelativeDateTime(months=interval),
|
||||
}
|
||||
d = base + fnct[action.trg_date_range_type](action.trg_date_range)
|
||||
dt = d.strftime('%Y-%m-%d %H:%M:%S')
|
||||
ok = False
|
||||
if hasattr(obj, 'date_action_last') and hasattr(obj, 'date_action_next'):
|
||||
ok = (dt <= time.strftime('%Y-%m-%d %H:%M:%S')) and \
|
||||
((not obj.date_action_next) or \
|
||||
(dt >= obj.date_action_next and \
|
||||
obj.date_action_last < obj.date_action_next))
|
||||
if not ok:
|
||||
if not obj.date_action_next or dt < obj.date_action_next:
|
||||
obj.date_action_next = dt
|
||||
model_obj.write(cr, uid, [obj.id], {'date_action_next': dt}, context)
|
||||
else:
|
||||
ok = action.trg_date_type=='none'
|
||||
if ok:
|
||||
self.do_action(cr, uid, action, model_obj, obj, context)
|
||||
break
|
||||
level -= 1
|
||||
return True
|
||||
base_action_rule()
|
||||
|
||||
class base_action_rule_line(osv.osv):
|
||||
_name = 'base.action.rule.line'
|
||||
_description = 'Action Rule Lines'
|
||||
|
||||
def _state_get(self, cr, uid, context={}):
|
||||
""" Get State
|
||||
@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 """
|
||||
|
||||
return self.state_get(cr, uid, context=context)
|
||||
def _priority_get(self, cr, uid, context={}):
|
||||
""" Get Priority
|
||||
@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 """
|
||||
|
||||
return self.priority_get(cr, uid, context=context)
|
||||
|
||||
def state_get(self, cr, uid, context={}):
|
||||
""" Get State
|
||||
@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 """
|
||||
|
||||
return [('','')]
|
||||
def priority_get(self, cr, uid, context={}):
|
||||
""" Get Priority
|
||||
@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 """
|
||||
|
||||
return [('','')]
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Rule Name',size=64, required=True),
|
||||
'rule_id': fields.many2one('base.action.rule','Rule'),
|
||||
'active': fields.boolean('Active', help="If the active field is set to true,\
|
||||
it will allow you to hide the rule without removing it."),
|
||||
'sequence': fields.integer('Sequence', help="Gives the sequence order when\
|
||||
displaying a list of rules."),
|
||||
|
||||
'trg_date_type': fields.selection([
|
||||
('none','None'),
|
||||
('create','Creation Date'),
|
||||
('action_last','Last Action Date'),
|
||||
('date','Date'),
|
||||
('deadline', 'Deadline'),
|
||||
], 'Trigger Date', size=16),
|
||||
'trg_date_range': fields.integer('Delay after trigger date',help="Delay After Trigger Date,\
|
||||
specifies you can put a negative number " \
|
||||
"if you need a delay before the trigger date, like sending a reminder 15 minutes before a meeting."),
|
||||
'trg_date_range_type': fields.selection([('minutes', 'Minutes'),('hour','Hours'),\
|
||||
('day','Days'),('month','Months')], 'Delay type'),
|
||||
|
||||
|
||||
'trg_user_id': fields.many2one('res.users', 'Responsible'),
|
||||
|
||||
'trg_partner_id': fields.many2one('res.partner', 'Partner'),
|
||||
'trg_partner_categ_id': fields.many2one('res.partner.category', 'Partner Category'),
|
||||
'trg_state_from': fields.selection(_state_get, 'State', size=16),
|
||||
'trg_state_to': fields.selection(_state_get, 'Button Pressed', size=16),
|
||||
'trg_priority_from': fields.selection(_priority_get, 'Minimum Priority'),
|
||||
'trg_priority_to': fields.selection(_priority_get, 'Maximum Priority'),
|
||||
|
||||
'act_method': fields.char('Call Object Method', size=64),
|
||||
'act_user_id': fields.many2one('res.users', 'Set responsible to'),
|
||||
'act_state': fields.selection(_state_get, 'Set state to', size=16),
|
||||
'act_priority': fields.selection(_priority_get, 'Set priority to'),
|
||||
'act_email_cc': fields.char('Add watchers (Cc)', size=250, help="These people\
|
||||
will receive a copy of the future communication between partner and users by email"),
|
||||
|
||||
'act_remind_partner': fields.boolean('Remind Partner', help="Check this if\
|
||||
you want the rule to send a reminder by email to the partner."),
|
||||
'act_remind_user': fields.boolean('Remind responsible', help="Check this if \
|
||||
you want the rule to send a reminder by email to the user."),
|
||||
'act_reply_to': fields.char('Reply-To', size=64),
|
||||
'act_remind_attach': fields.boolean('Remind with attachment', help="Check this if\
|
||||
you want that all documents attached to the object be attached \
|
||||
to the reminder email sent."),
|
||||
|
||||
'act_mail_to_user': fields.boolean('Mail to responsible',help="Check this if \
|
||||
you want the rule to send an email to the responsible person."),
|
||||
'act_mail_to_watchers': fields.boolean('Mail to watchers (CC)',help="Check this\
|
||||
if you want the rule to mark CC(mail to any other person\
|
||||
defined in actions)."),
|
||||
'act_mail_to_email': fields.char('Mail to these emails', size=128,help="Email-id \
|
||||
of the persons whom mail is to be sent"),
|
||||
'act_mail_body': fields.text('Mail body',help="Content of mail"),
|
||||
'regex_name': fields.char('Regular Expression on Model Name', size=128),
|
||||
'server_action_id': fields.many2one('ir.actions.server','Server Action',help="Describes the\
|
||||
action name." \
|
||||
"eg:on which object which action to be taken on basis of which condition"),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'active': lambda *a: 1,
|
||||
'trg_date_type': lambda *a: 'none',
|
||||
'trg_date_range_type': lambda *a: 'day',
|
||||
'act_mail_to_user': lambda *a: 0,
|
||||
'act_remind_partner': lambda *a: 0,
|
||||
'act_remind_user': lambda *a: 0,
|
||||
'act_mail_to_watchers': lambda *a: 0,
|
||||
}
|
||||
|
||||
_order = 'sequence'
|
||||
|
||||
|
||||
def _check_mail(self, cr, uid, ids, context=None):
|
||||
""" Check Mail
|
||||
@@ -393,6 +348,6 @@ class base_action_rule_line(osv.osv):
|
||||
(_check_mail, 'Error: The mail is not well formated', ['act_mail_body']),
|
||||
]
|
||||
|
||||
base_action_rule_line()
|
||||
base_action_rule()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -16,52 +16,9 @@
|
||||
<form string="Action Rule">
|
||||
<field name="name" select="1"/>
|
||||
<field name="active"/>
|
||||
<field name="sequence"/>
|
||||
<field name="max_level" />
|
||||
<separator colspan="4" string="Rule lines"/>
|
||||
<field name="rule_lines" colspan="4" nolabel="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Action Rule Tree View -->
|
||||
|
||||
<record id="view_base_action_rule_tree" model="ir.ui.view">
|
||||
<field name="name">base.action.rule.tree</field>
|
||||
<field name="model">base.action.rule</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Action Rule">
|
||||
<field name="name" colspan="4"/>
|
||||
<field name="max_level"/>
|
||||
<field name="rule_lines" colspan="4" nolabel="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Action Rule Action -->
|
||||
|
||||
<record id="base_action_rule_act" model="ir.actions.act_window">
|
||||
<field name="name">Action Rules</field>
|
||||
<field name="res_model">base.action.rule</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_base_action_rule_tree"/>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_base_action_rule_form"
|
||||
parent="menu_base_action_rule" action="base_action_rule_act" />
|
||||
|
||||
<!--
|
||||
Action Rule Lines Form View
|
||||
-->
|
||||
<record id="view_base_action_rule_line_form" model="ir.ui.view">
|
||||
<field name="name">base.action.rule.line.form</field>
|
||||
<field name="model">base.action.rule.line</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Action Rule Line">
|
||||
<field name="name" select="1"/>
|
||||
<field name="active"/>
|
||||
<field name="domain" colspan="4"/>
|
||||
<notebook colspan="4">
|
||||
<page string="Conditions">
|
||||
<group col="2" colspan="2" name="model">
|
||||
@@ -79,11 +36,6 @@
|
||||
<field name="trg_state_from"/>
|
||||
<field name="trg_state_to"/>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator colspan="4" string="Conditions on Priority Range"/>
|
||||
<field name="trg_priority_from"/>
|
||||
<field name="trg_priority_to"/>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator colspan="4" string="Conditions on Timing"/>
|
||||
<field name="trg_date_type"/>
|
||||
@@ -100,7 +52,6 @@
|
||||
<separator colspan="4" string="Fields to Change"/>
|
||||
<field name="act_user_id"/>
|
||||
<field name="act_state"/>
|
||||
<field name="act_priority"/>
|
||||
<separator colspan="4" string="E-Mail Reminders (includes the content of the object)"/>
|
||||
<field name="act_remind_partner"/>
|
||||
<field name="act_remind_attach"/>
|
||||
@@ -117,7 +68,9 @@
|
||||
<field name="act_mail_to_user"/>
|
||||
<field name="act_mail_to_watchers"/>
|
||||
<field colspan="4" name="act_mail_to_email"/>
|
||||
<field colspan="4" name="act_mail_body" attrs="{'required':[('act_remind_user','=',True)]}"/>
|
||||
<separator colspan="4" string="Mail Body"/>
|
||||
<field colspan="4" name="act_mail_body"
|
||||
nolabel="1" attrs="{'required':[('act_remind_user','=',True)]}" />
|
||||
<separator colspan="4" string="Special Keywords to Be Used in The Body"/>
|
||||
<label align="0.0" string="%%(object_id)s = Object ID" colspan="2"/>
|
||||
<label align="0.0" string="%%(object_subject)s = Object subject" colspan="2"/>
|
||||
@@ -133,29 +86,37 @@
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</record>
|
||||
|
||||
<!-- Action Rule Lines Tree View -->
|
||||
<!-- Action Rule Tree View -->
|
||||
|
||||
<record id="view_base_action_rule_line_tree" model="ir.ui.view">
|
||||
<field name="name">base.action.rule.line.tree</field>
|
||||
<field name="model">base.action.rule.line</field>
|
||||
<record id="view_base_action_rule_tree" model="ir.ui.view">
|
||||
<field name="name">base.action.rule.tree</field>
|
||||
<field name="model">base.action.rule</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Action Rule Lines">
|
||||
<field name="name"/>
|
||||
<field name="active"/>
|
||||
<tree string="Action Rule">
|
||||
<field name="name" colspan="4"/>
|
||||
<field name="sequence"/>
|
||||
<field name="max_level"/>
|
||||
<field name="domain"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Action Rule Action -->
|
||||
|
||||
<record id="base_action_rule_act" model="ir.actions.act_window">
|
||||
<field name="name">Action Rules</field>
|
||||
<field name="res_model">base.action.rule</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_base_action_rule_tree"/>
|
||||
</record>
|
||||
|
||||
<act_window
|
||||
domain="[('rule_id', '=', active_id)]"
|
||||
id="act_rule_lines_open"
|
||||
name="Open Rule Lines"
|
||||
context="{'rule_id': active_id}"
|
||||
res_model="base.action.rule.line"
|
||||
src_model="base.action.rule"/>
|
||||
<menuitem id="menu_base_action_rule_form"
|
||||
parent="menu_base_action_rule" action="base_action_rule_act" />
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_base_action_rule","base.action.rule","model_base_action_rule",,1,1,1,1
|
||||
"access_base_action_rule_line","base.action.rule.line","model_base_action_rule_line",,1,1,1,1
|
||||
|
||||
|
@@ -29,6 +29,7 @@ import pytz
|
||||
import re
|
||||
import time
|
||||
import tools
|
||||
from caldav import caldav
|
||||
|
||||
months = {
|
||||
1: "January", 2: "February", 3: "March", 4: "April", \
|
||||
@@ -1213,7 +1214,52 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
||||
if isinstance(select, (str, int, long)):
|
||||
return ids and ids[0] or False
|
||||
return ids
|
||||
|
||||
|
||||
def check_import(self, cr, uid, vals, 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 vals: Get Values
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
ids = []
|
||||
model_obj = self.pool.get(context.get('model'))
|
||||
recur_pool = {}
|
||||
try:
|
||||
for val in vals:
|
||||
exists, r_id = caldav.uid2openobjectid(cr, val['id'], context.get('model'), \
|
||||
val.get('recurrent_id'))
|
||||
if val.has_key('create_date'): val.pop('create_date')
|
||||
u_id = val.get('id', None)
|
||||
val.pop('id')
|
||||
if exists and r_id:
|
||||
val.update({'recurrent_uid': exists})
|
||||
model_obj.write(cr, uid, [r_id], val)
|
||||
ids.append(r_id)
|
||||
elif exists:
|
||||
# Compute value of duration
|
||||
if 'date_deadline' in val and 'duration' not in val:
|
||||
start = datetime.strptime(val['date'], '%Y-%m-%d %H:%M:%S')
|
||||
end = datetime.strptime(val['date_deadline'], '%Y-%m-%d %H:%M:%S')
|
||||
diff = end - start
|
||||
val['duration'] = (diff.seconds/float(86400) + diff.days) * 24
|
||||
model_obj.write(cr, uid, [exists], val)
|
||||
ids.append(exists)
|
||||
else:
|
||||
if u_id in recur_pool and val.get('recurrent_id'):
|
||||
val.update({'recurrent_uid': recur_pool[u_id]})
|
||||
revent_id = model_obj.create(cr, uid, val)
|
||||
ids.append(revent_id)
|
||||
else:
|
||||
event_id = model_obj.create(cr, uid, val)
|
||||
recur_pool[u_id] = event_id
|
||||
ids.append(event_id)
|
||||
except Exception, e:
|
||||
raise osv.except_osv(('Error !'), (str(e)))
|
||||
return ids
|
||||
|
||||
|
||||
def compute_rule_string(self, cr, uid, datas, context=None, *args):
|
||||
"""
|
||||
Compute rule string.
|
||||
|
||||
@@ -190,7 +190,7 @@
|
||||
<field name="date" string="Start Date" required="1" select="1"
|
||||
on_change="onchange_dates(date,duration,False,allday)" />
|
||||
<field name="duration" widget="float_time"
|
||||
on_change="onchange_dates(date,duration,False,allday)" attrs="{'readonly': [('allday', '=', True)]}"/>
|
||||
on_change="onchange_dates(date,duration,False,allday)" attrs="{'invisible': [('allday', '=', True)]}"/>
|
||||
<field name="date_deadline" string="End Date" required="1"
|
||||
on_change="onchange_dates(date,False,date_deadline)" />
|
||||
<field name="location" />
|
||||
|
||||
@@ -24,8 +24,9 @@ import crm_mailgate
|
||||
import crm_action_rule
|
||||
import crm_segmentation
|
||||
import crm_meeting
|
||||
import crm_opportunity
|
||||
import crm_lead
|
||||
import crm_phonecall
|
||||
import crm_claim
|
||||
import crm_fundraising
|
||||
import crm_helpdesk
|
||||
|
||||
@@ -34,6 +35,5 @@ import wizard
|
||||
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
+39
-11
@@ -26,7 +26,7 @@
|
||||
'category': 'Generic Modules/CRM & SRM',
|
||||
'description': """The generic Open ERP Customer Relationship Management
|
||||
system enables a group of people to intelligently and efficiently manage
|
||||
leads, opportunities, claims, meeting, phonecall etc.
|
||||
leads, opportunities, meeting, phonecall etc.
|
||||
It manages key tasks such as communication, identification, prioritization,
|
||||
assignment, resolution and notification.
|
||||
|
||||
@@ -54,33 +54,61 @@ between mails and Open ERP.""",
|
||||
],
|
||||
'init_xml': [
|
||||
'crm_data.xml',
|
||||
'crm_meeting_data.xml',
|
||||
'crm_lead_data.xml',
|
||||
'crm_meeting_data.xml',
|
||||
'crm_opportunity_data.xml',
|
||||
'crm_phonecall_data.xml',
|
||||
],
|
||||
|
||||
'update_xml': [
|
||||
'wizard/crm_lead_to_partner_view.xml',
|
||||
'wizard/crm_lead_to_opportunity_view.xml',
|
||||
|
||||
'wizard/crm_phonecall_to_phonecall_view.xml',
|
||||
'wizard/crm_phonecall_to_partner_view.xml',
|
||||
'wizard/crm_phonecall_to_opportunity_view.xml',
|
||||
|
||||
'wizard/crm_opportunity_to_phonecall_view.xml',
|
||||
'wizard/crm_partner_to_opportunity_view.xml',
|
||||
|
||||
'wizard/crm_send_email_view.xml',
|
||||
'wizard/crm_email_add_cc_view.xml',
|
||||
'crm_view.xml',
|
||||
|
||||
'crm_action_rule_view.xml',
|
||||
'crm_lead_view.xml',
|
||||
'crm_lead_menu.xml',
|
||||
'crm_meeting_view.xml',
|
||||
'crm_meeting_menu.xml',
|
||||
'crm_phonecall_view.xml',
|
||||
'crm_phonecall_menu.xml',
|
||||
'crm_opportunity_view.xml',
|
||||
'crm_opportunity_menu.xml',
|
||||
|
||||
'security/crm_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
|
||||
'report/crm_report_view.xml',
|
||||
|
||||
'report/crm_lead_report_view.xml',
|
||||
'report/crm_opportunity_report_view.xml' ,
|
||||
'report/crm_phonecall_report_view.xml',
|
||||
|
||||
'process/crm_configuration_process.xml',
|
||||
],
|
||||
'demo_xml': [
|
||||
'crm_demo.xml',
|
||||
|
||||
'crm_lead_demo.xml',
|
||||
'crm_meeting_demo.xml',
|
||||
'crm_opportunity_demo.xml',
|
||||
'crm_phonecall_demo.xml'
|
||||
],
|
||||
# 'test': [#'test/test_crm_lead.yml',
|
||||
# 'test/test_crm_opportunity.yml',
|
||||
# 'test/test_crm_phonecall.yml',
|
||||
# 'test/test_crm_fund.yml',
|
||||
# 'test/test_crm_claim.yml',
|
||||
# 'test/test_crm_helpdesk.yml',
|
||||
# 'test/test_crm_meeting.yml',
|
||||
# ],
|
||||
'test': [
|
||||
'test/test_crm_meeting.yml',
|
||||
'test/test_crm_lead.yml',
|
||||
'test/test_crm_opportunity.yml',
|
||||
'test/test_crm_phonecall.yml',
|
||||
],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
'certificate': '0079056041421',
|
||||
|
||||
@@ -152,6 +152,18 @@ class base_action_rule(osv.osv):
|
||||
""" Base Action Rule """
|
||||
_inherit = 'base.action.rule'
|
||||
_description = 'Action Rules'
|
||||
|
||||
_columns = {
|
||||
'trg_section_id': fields.many2one('crm.case.section', 'Sales Team'),
|
||||
'trg_max_history': fields.integer('Maximum Communication History'),
|
||||
'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 Team 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."),
|
||||
}
|
||||
|
||||
|
||||
def email_send(self, cr, uid, obj, emails, body, emailfrom=tools.config.get('email_from',False), context={}):
|
||||
body = self.format_mail(obj, body)
|
||||
@@ -168,6 +180,17 @@ class base_action_rule(osv.osv):
|
||||
if not emailfrom:
|
||||
raise osv.except_osv(_('Error!'),
|
||||
_("No E-Mail ID Found for your Company address!"))
|
||||
if hasattr(obj, 'section_id'):
|
||||
smtp_pool = self.pool.get('email.smtpclient')
|
||||
if obj.section_id and obj.section_id.server_id:
|
||||
flag = smtp_pool.send_email(
|
||||
cr=cr,
|
||||
uid=uid,
|
||||
server_id=obj.section_id.server_id.id,
|
||||
emailto=emails,
|
||||
subject=name,
|
||||
body="<pre>%s</pre>" % body,
|
||||
)
|
||||
return tools.email_send(emailfrom, emails, name, body, reply_to=reply_to, openobject_id=str(obj.id))
|
||||
|
||||
def do_check(self, cr, uid, action, obj, context={}):
|
||||
@@ -207,7 +230,7 @@ class base_action_rule(osv.osv):
|
||||
res = super(base_action_rule, self).do_action(cr, uid, action, model_obj, obj, context=context)
|
||||
write = {}
|
||||
|
||||
if hasattr(action, act_section_id) and action.act_section_id:
|
||||
if hasattr(action, 'act_section_id') and action.act_section_id:
|
||||
obj.section_id = action.act_section_id
|
||||
write['section_id'] = action.act_section_id.id
|
||||
|
||||
@@ -231,13 +254,6 @@ class base_action_rule(osv.osv):
|
||||
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={}):
|
||||
|
||||
"""@param self: The object pointer
|
||||
@@ -245,28 +261,8 @@ class base_action_rule_line(osv.osv):
|
||||
@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
|
||||
res = super(base_action_rule, self).state_get(cr, uid, context=context)
|
||||
return res + [('escalate', 'Escalate')] + crm.AVAILABLE_STATES
|
||||
|
||||
def priority_get(self, cr, uid, 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 = {
|
||||
'trg_section_id': fields.many2one('crm.case.section', 'Sales Team'),
|
||||
'trg_max_history': fields.integer('Maximum Communication History'),
|
||||
'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 Team 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."),
|
||||
}
|
||||
|
||||
base_action_rule_line()
|
||||
base_action_rule()
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
<data>
|
||||
<!-- Case rules -->
|
||||
<record id="view_base_action_rule_line_form1" model="ir.ui.view">
|
||||
<field name="name">base.action.rule.line.form.inherit</field>
|
||||
<field name="model">base.action.rule.line</field>
|
||||
<field name="inherit_id" ref="base_action_rule.view_base_action_rule_line_form"/>
|
||||
<field name="name">base.action.rule.form.inherit</field>
|
||||
<field name="model">base.action.rule</field>
|
||||
<field name="inherit_id" ref="base_action_rule.view_base_action_rule_form"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<group name="partner" position="after">
|
||||
@@ -19,9 +19,9 @@
|
||||
</record>
|
||||
|
||||
<record id="view_base_action_rule_line_form2" model="ir.ui.view">
|
||||
<field name="name">base.action.rule.line.form2.inherit</field>
|
||||
<field name="model">base.action.rule.line</field>
|
||||
<field name="inherit_id" ref="base_action_rule.view_base_action_rule_line_form"/>
|
||||
<field name="name">base.action.rule.form2.inherit</field>
|
||||
<field name="model">base.action.rule</field>
|
||||
<field name="inherit_id" ref="base_action_rule.view_base_action_rule_form"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<group name="partner" position="after">
|
||||
@@ -35,9 +35,9 @@
|
||||
</record>
|
||||
|
||||
<record id="view_base_action_rule_line_form3" model="ir.ui.view">
|
||||
<field name="name">base.action.rule.line.form3.inherit</field>
|
||||
<field name="model">base.action.rule.line</field>
|
||||
<field name="inherit_id" ref="base_action_rule.view_base_action_rule_line_form"/>
|
||||
<field name="name">base.action.rule.form3.inherit</field>
|
||||
<field name="model">base.action.rule</field>
|
||||
<field name="inherit_id" ref="base_action_rule.view_base_action_rule_form"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="act_user_id" position="after">
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv, orm
|
||||
from datetime import datetime, timedelta
|
||||
import crm
|
||||
import math
|
||||
import time
|
||||
import mx.DateTime
|
||||
from tools.translate import _
|
||||
|
||||
class crm_lead(osv.osv):
|
||||
""" CRM Lead Case """
|
||||
|
||||
_name = "crm.lead"
|
||||
_description = "Leads Cases"
|
||||
_order = "priority, id desc"
|
||||
_inherit = ['res.partner.address', 'crm.case']
|
||||
|
||||
def case_open(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 case's Ids
|
||||
@param *args: Give Tuple Value
|
||||
"""
|
||||
|
||||
res = super(crm_lead, self).case_open(cr, uid, ids, *args)
|
||||
self.write(cr, uid, ids, {'date_open': time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
return res
|
||||
|
||||
def _compute_day(self, cr, uid, ids, fields, 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
|
||||
"""
|
||||
cal_obj = self.pool.get('resource.calendar')
|
||||
res_obj = self.pool.get('resource.resource')
|
||||
|
||||
res = {}
|
||||
for lead in self.browse(cr, uid, ids , context):
|
||||
for field in fields:
|
||||
res[lead.id] = {}
|
||||
duration = 0
|
||||
ans = False
|
||||
if field == 'day_open':
|
||||
if lead.date_open:
|
||||
date_create = datetime.strptime(lead.create_date, "%Y-%m-%d %H:%M:%S")
|
||||
date_open = datetime.strptime(lead.date_open, "%Y-%m-%d %H:%M:%S")
|
||||
ans = date_open - date_create
|
||||
date_until = lead.date_open
|
||||
elif field == 'day_close':
|
||||
if lead.date_closed:
|
||||
date_create = datetime.strptime(lead.create_date, "%Y-%m-%d %H:%M:%S")
|
||||
date_close = datetime.strptime(lead.date_closed, "%Y-%m-%d %H:%M:%S")
|
||||
date_until = lead.date_closed
|
||||
ans = date_close - date_create
|
||||
if ans:
|
||||
resource_id = False
|
||||
if lead.user_id:
|
||||
resource_ids = res_obj.search(cr, uid, [('user_id','=',lead.user_id.id)])
|
||||
if len(resource_ids):
|
||||
resource_id = resource_ids[0]
|
||||
|
||||
duration = float(ans.days)
|
||||
if lead.section_id.resource_calendar_id:
|
||||
duration = float(ans.days) * 24
|
||||
new_dates = cal_obj.interval_get(cr,
|
||||
uid,
|
||||
lead.section_id.resource_calendar_id and lead.section_id.resource_calendar_id.id or False,
|
||||
mx.DateTime.strptime(lead.create_date, '%Y-%m-%d %H:%M:%S'),
|
||||
duration,
|
||||
resource=resource_id
|
||||
)
|
||||
no_days = []
|
||||
date_until = mx.DateTime.strptime(date_until, '%Y-%m-%d %H:%M:%S')
|
||||
for in_time, out_time in new_dates:
|
||||
if in_time.date not in no_days:
|
||||
no_days.append(in_time.date)
|
||||
if out_time > date_until:
|
||||
break
|
||||
duration = len(no_days)
|
||||
res[lead.id][field] = abs(int(duration))
|
||||
return res
|
||||
|
||||
_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'),
|
||||
|
||||
'user_id': fields.many2one('res.users', 'Salesman'),
|
||||
'referred': fields.char('Referred By', size=64),
|
||||
'date_open': fields.datetime('Opened', readonly=True),
|
||||
'day_open': fields.function(_compute_day, string='Days to Open', \
|
||||
method=True, multi='day_open', type="float", store=True),
|
||||
'day_close': fields.function(_compute_day, string='Days to Close', \
|
||||
method=True, multi='day_close', type="float", 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),
|
||||
'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
|
||||
}
|
||||
|
||||
|
||||
def convert_opportunity(self, cr, uid, ids, context=None):
|
||||
""" Precomputation for converting lead to opportunity
|
||||
@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
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return: Value of action in dict
|
||||
"""
|
||||
if not context:
|
||||
context = {}
|
||||
context.update({'active_ids': ids})
|
||||
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
data_id = data_obj._get_id(cr, uid, 'crm', 'view_crm_lead2opportunity_create')
|
||||
value = {}
|
||||
|
||||
view_id = False
|
||||
if data_id:
|
||||
view_id = data_obj.browse(cr, uid, data_id, context=context).res_id
|
||||
for case in self.browse(cr, uid, ids):
|
||||
context.update({'opportunity_id': case.id})
|
||||
context.update({'active_id': case.id})
|
||||
if not case.partner_id:
|
||||
data_id = data_obj._get_id(cr, uid, 'crm', 'view_crm_lead2opportunity_partner')
|
||||
view_id1 = False
|
||||
if data_id:
|
||||
view_id1 = data_obj.browse(cr, uid, data_id, context=context).res_id
|
||||
value = {
|
||||
'name': _('Create Partner'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'crm.lead2opportunity.partner',
|
||||
'view_id': False,
|
||||
'context': context,
|
||||
'views': [(view_id1, 'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
'nodestroy': True
|
||||
}
|
||||
break
|
||||
else:
|
||||
value = {
|
||||
'name': _('Create Opportunity'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'crm.lead2opportunity',
|
||||
'view_id': False,
|
||||
'context': context,
|
||||
'views': [(view_id, 'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
'nodestroy': True
|
||||
}
|
||||
return value
|
||||
|
||||
crm_lead()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,81 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
|
||||
|
||||
<!-- CASE STATUS(stage_id) -->
|
||||
<record model="crm.case.stage" id="stage_lead1">
|
||||
<field name="name">New</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.stage" id="stage_lead2">
|
||||
<field name="name">Assigned</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.stage" id="stage_lead3">
|
||||
<field name="name">In Process</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.stage" id="stage_lead4">
|
||||
<field name="name">Converted</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.stage" id="stage_lead5">
|
||||
<field name="name">Recycled</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.stage" id="stage_lead6">
|
||||
<field name="name">Dead</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
<!-- CASE CATEGORY2(category2_id) -->
|
||||
<record model="crm.case.resource.type" id="type_lead1">
|
||||
<field name="name">Telesales</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.resource.type" id="type_lead2">
|
||||
<field name="name">Mail</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.resource.type" id="type_lead3">
|
||||
<field name="name">Email</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.resource.type" id="type_lead4">
|
||||
<field name="name">Print</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.resource.type" id="type_lead5">
|
||||
<field name="name">Web</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.resource.type" id="type_lead6">
|
||||
<field name="name">Radio</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.resource.type" id="type_lead7">
|
||||
<field name="name">Television</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.resource.type" id="type_lead8">
|
||||
<field name="name">Newsletter</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,112 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
<!--
|
||||
((((((((((( Demo Cases )))))))))))
|
||||
-->
|
||||
|
||||
<!--For Leads-->
|
||||
<record id="crm_case_itisatelesalescampaign0" model="crm.lead">
|
||||
<field name="type_id" ref="crm.type_lead1"/>
|
||||
<field eval="'3'" name="priority"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field eval="'Luc Latour'" name="name"/>
|
||||
<field eval="'open'" name="state"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval="'(726) 782-0636'" name="mobile"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="categ_id" ref="crm.categ_oppor6"/>
|
||||
<field name="stage_id" ref="crm.stage_lead1"/>
|
||||
<field eval="'The Oil Company'" name="partner_name"/>
|
||||
<field eval="'(769) 703-274'" name="phone"/>
|
||||
</record>
|
||||
<record id="crm_case_electonicgoodsdealer0" model="crm.lead">
|
||||
<field name="type_id" ref="crm.type_lead7"/>
|
||||
<field eval="'4'" name="priority"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field eval="'Marc Dufour'" name="name"/>
|
||||
<field eval="'open'" name="state"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval="'(392) 895-7917'" name="mobile"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="categ_id" ref="crm.categ_oppor2"/>
|
||||
<field name="stage_id" ref="crm.stage_lead2"/>
|
||||
<field eval="'Le Club SARL'" name="partner_name"/>
|
||||
<field eval="'(956) 293-2595'" name="phone"/>
|
||||
</record>
|
||||
<record id="crm_case_developingwebapplications0" model="crm.lead">
|
||||
<field name="type_id" ref="crm.type_lead5"/>
|
||||
<field eval="'2'" name="priority"/>
|
||||
<field name="user_id" ref="base.user_demo"/>
|
||||
<field eval="'Fabien Pinckaers'" name="name"/>
|
||||
<field eval="'done'" name="state"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval="'(820) 167-3208'" name="mobile"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="categ_id" ref="crm.categ_oppor4"/>
|
||||
<field name="stage_id" ref="crm.stage_lead4"/>
|
||||
<field eval="'TheKompany'" name="partner_name"/>
|
||||
<field eval="'(079) 681-2139'" name="phone"/>
|
||||
<field eval="'contact@tecsas.fr'" name="email_from"/>
|
||||
</record>
|
||||
<record id="crm_case_qrecorp0" model="crm.lead">
|
||||
<field name="type_id" ref="crm.type_lead8"/>
|
||||
<field eval="'3'" name="priority"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field eval="'Henry Mc Coy'" name="name"/>
|
||||
<field eval="'draft'" name="state"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval="'(077) 582-4035'" name="mobile"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="categ_id" ref="crm.categ_oppor1"/>
|
||||
<field name="stage_id" ref="crm.stage_lead1"/>
|
||||
<field eval="'The Gas Company'" name="partner_name"/>
|
||||
<field eval="'(514) 698-4118'" name="phone"/>
|
||||
</record>
|
||||
<record id="crm_case_itdeveloper0" model="crm.lead">
|
||||
<field name="type_id" ref="crm.type_lead4"/>
|
||||
<field eval="'3'" name="priority"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field eval="'Carrie Helle'" name="name"/>
|
||||
<field eval="'pending'" name="state"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval="'(333) 715-1450'" name="mobile"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="categ_id" ref="crm.categ_oppor6"/>
|
||||
<field name="stage_id" ref="crm.stage_lead3"/>
|
||||
<field eval="'Stonage IT'" name="partner_name"/>
|
||||
<field eval="'(855) 924-4364'" name="phone"/>
|
||||
</record>
|
||||
<record id="crm_case_mgroperations0" model="crm.lead">
|
||||
<field name="partner_address_id" ref="base.res_partner_address_1"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="type_id" ref="crm.type_lead3"/>
|
||||
<field name="partner_id" ref="base.res_partner_9"/>
|
||||
<field eval="'3'" name="priority"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field eval="'Tina Pinero'" name="name"/>
|
||||
<field eval="'cancel'" name="state"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval="'(468) 017-2684'" name="mobile"/>
|
||||
<field name="categ_id" ref="crm.categ_oppor8"/>
|
||||
<field name="stage_id" ref="crm.stage_lead6"/>
|
||||
<field eval="'Opensides SPRL'" name="partner_name"/>
|
||||
<field eval="'(373) 907-1009'" name="phone"/>
|
||||
<field eval="'info@opensides.be'" name="email_from"/>
|
||||
</record>
|
||||
<record id="crm_case_vpoperations0" model="crm.lead">
|
||||
<field eval="1" name="active"/>
|
||||
<field name="type_id" ref="crm.type_lead8"/>
|
||||
<field eval="'3'" name="priority"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field eval="'Wendi Baltz'" name="name"/>
|
||||
<field eval="'done'" name="state"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval="'(463) 014-1208'" name="mobile"/>
|
||||
<field name="categ_id" ref="crm.categ_oppor4"/>
|
||||
<field name="stage_id" ref="crm.stage_lead4"/>
|
||||
<field eval="'Gardner Group'" name="partner_name"/>
|
||||
<field eval="'(282) 603-7489'" name="phone"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
|
||||
<record model="ir.actions.act_window" id="crm_case_category_act_leads_all">
|
||||
<field name="name">Leads</field>
|
||||
<field name="res_model">crm.lead</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="crm_case_tree_view_leads"/>
|
||||
<field name="search_view_id" ref="crm.view_crm_case_leads_filter"/>
|
||||
</record>
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_view_leads_all">
|
||||
<field name="sequence" eval="1"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="crm_case_tree_view_leads"/>
|
||||
<field name="act_window_id" ref="crm_case_category_act_leads_all"/>
|
||||
</record>
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_form_view_leads_all">
|
||||
<field name="sequence" eval="3"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="crm_case_form_view_leads"/>
|
||||
<field name="act_window_id" ref="crm_case_category_act_leads_all"/>
|
||||
</record>
|
||||
|
||||
<menuitem id="base.menu_sales" name="Sales"
|
||||
parent="base.menu_base_partner" sequence="1" />
|
||||
<menuitem parent="base.menu_sales" name="Leads"
|
||||
groups="base.group_extended"
|
||||
id="menu_crm_case_categ0_act_leads"
|
||||
action="crm_case_category_act_leads_all" sequence="1" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,331 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!--Lead Stage Form view -->
|
||||
|
||||
<record id="crm_lead_stage_act" model="ir.actions.act_window">
|
||||
<field name="name">Lead Stages</field>
|
||||
<field name="res_model">crm.case.stage</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_id" ref="crm.crm_case_stage_tree"/>
|
||||
<field name="domain">[('object_id.model', '=', 'crm.lead')]</field>
|
||||
<field name="context">{'object_id':'crm.lead'}</field>
|
||||
</record>
|
||||
<menuitem action="crm_lead_stage_act" id="menu_crm_lead_stage_act"
|
||||
groups="base.group_extended"
|
||||
parent="crm.menu_crm_case_stage" />
|
||||
|
||||
<!-- Resource Type Form View -->
|
||||
|
||||
<record id="crm_lead_resource_act" model="ir.actions.act_window">
|
||||
<field name="name">Lead Resource Type</field>
|
||||
<field name="res_model">crm.case.resource.type</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_id" ref="crm.crm_case_resource_type_tree"/>
|
||||
<field name="domain">[('object_id.model', '=', 'crm.lead')]</field>
|
||||
<field name="context">{'object_id':'crm.lead'}</field>
|
||||
</record>
|
||||
<menuitem action="crm_lead_resource_act"
|
||||
id="menu_crm_lead_resource_act"
|
||||
groups="base.group_extended"
|
||||
parent="crm.menu_crm_case_resource_type" />
|
||||
|
||||
<!-- CRM Lead Form View -->
|
||||
|
||||
<record model="ir.ui.view" id="crm_case_form_view_leads">
|
||||
<field name="name">CRM - Leads Form</field>
|
||||
<field name="model">crm.lead</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Leads Form">
|
||||
<group colspan="4" col="7">
|
||||
<field name="name" required="1"/>
|
||||
<field name="priority"/>
|
||||
<field name="date_deadline"/>
|
||||
<button
|
||||
name="convert_opportunity"
|
||||
string="Convert"
|
||||
help="Convert to Opportunity"
|
||||
icon="gtk-index"
|
||||
type="object"
|
||||
attrs="{'invisible':[('opportunity_id','!=',False)]}"/>
|
||||
<newline />
|
||||
<field name="section_id" colspan="1"
|
||||
widget="selection" />
|
||||
<field name="user_id" />
|
||||
<field name="stage_id" widget="selection"
|
||||
domain="[('object_id.model', '=', 'crm.lead')]" />
|
||||
<group col="2" colspan="1">
|
||||
<button name="stage_previous" string="Previous"
|
||||
states="open,pending" type="object"
|
||||
icon="gtk-go-back" />
|
||||
<button name="stage_next" string="Next"
|
||||
states="open,pending" type="object"
|
||||
icon="gtk-go-forward" />
|
||||
</group>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Lead">
|
||||
<group colspan="2" col="4">
|
||||
<separator string="Contact" colspan="4" col="4"/>
|
||||
<field name="partner_name" string="Contact Name" colspan="4"/>
|
||||
<newline/>
|
||||
<field domain="[('domain', '=', 'contact')]" name="title"/>
|
||||
<field name="function_name" />
|
||||
<field name="street" colspan="4"/>
|
||||
<field name="street2" colspan="4"/>
|
||||
<field name="zip"/>
|
||||
<field name="city"/>
|
||||
<field name="country_id"/>
|
||||
<field name="state_id"/>
|
||||
</group>
|
||||
<group colspan="2" col="3">
|
||||
<separator string="Communication" colspan="4" col="3"/>
|
||||
<field name="email_from" widget="email"/>
|
||||
<newline/>
|
||||
<field name="phone"/>
|
||||
<newline/>
|
||||
<field name="fax"/>
|
||||
<newline/>
|
||||
<field name="mobile"/>
|
||||
<newline/>
|
||||
<separator string="Links" colspan="4" col="3"/>
|
||||
<field name="partner_id"/>
|
||||
<button
|
||||
name="%(action_crm_lead2partner)d"
|
||||
icon="gtk-index" type="action"
|
||||
string="Create"
|
||||
attrs="{'invisible':[('partner_id','!=',False)]}"/>
|
||||
<field name="opportunity_id"/>
|
||||
</group>
|
||||
<separator colspan="4" string="Notes"/>
|
||||
<field name="description" nolabel="1" colspan="4"/>
|
||||
<separator colspan="4"/>
|
||||
<group col="8" colspan="4">
|
||||
<field name="state"/>
|
||||
<button name="case_close" string="Close"
|
||||
states="open,draft,pending" type="object"
|
||||
icon="gtk-close" />
|
||||
<button name="case_open" string="Open"
|
||||
states="draft,pending" type="object"
|
||||
icon="gtk-go-forward" />
|
||||
<button name="case_cancel" string="Cancel"
|
||||
states="draft,open,pending" type="object"
|
||||
icon="gtk-cancel" />
|
||||
<button name="case_pending" string="Pending"
|
||||
states="draft,open" type="object"
|
||||
icon="gtk-media-pause" />
|
||||
<button name="case_escalate" string="Escalate"
|
||||
states="open,draft,pending" type="object"
|
||||
groups="base.group_extended"
|
||||
icon="gtk-go-up" />
|
||||
<button name="case_reset"
|
||||
string="Reset to Draft" states="done,cancel"
|
||||
type="object" icon="gtk-convert" />
|
||||
</group>
|
||||
</page>
|
||||
<page string="Extra Info" groups="base.group_extended">
|
||||
<group colspan="2" col="2">
|
||||
<separator string="Categories" colspan="2" col="2"/>
|
||||
<field name="company_id"
|
||||
groups="base.group_multi_company"
|
||||
widget="selection" colspan="2" />
|
||||
<field name="categ_id"
|
||||
widget="selection"
|
||||
domain="[('object_id.model', '=', 'crm.opportunity')]" />
|
||||
<field name="type_id" string="Campaign" select="1"/>
|
||||
<field name="referred"/>
|
||||
</group>
|
||||
<group colspan="2" col="2">
|
||||
<separator string="Dates" colspan="2" col="2"/>
|
||||
<field name="create_date"/>
|
||||
<field name="write_date"/>
|
||||
<field name="date_closed"/>
|
||||
<field name="date_open"/>
|
||||
</group>
|
||||
<group colspan="2" col="2">
|
||||
<separator string="Statistics" colspan="2" col="2"/>
|
||||
<field name="day_open"/>
|
||||
<field name="day_close"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Emails" groups="base.group_extended">
|
||||
<group colspan="4">
|
||||
<field colspan="4" name="email_cc" string="CC"/>
|
||||
</group>
|
||||
<field name="history_line" colspan="4" nolabel="1" mode="form,tree">
|
||||
<form string="Communication history">
|
||||
<group col="7" colspan="4">
|
||||
<field name="date"/>
|
||||
<field name="email_to"/>
|
||||
<field name="email_from"/>
|
||||
<button
|
||||
string="Add a CC"
|
||||
name="%(crm.action_view_crm_email_add_cc_wizard)d"
|
||||
icon="gtk-add" type="action"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<field name="description" colspan="4" nolabel="1"/>
|
||||
<button colspan="4"
|
||||
string="Reply to Last Email"
|
||||
name="%(action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
|
||||
icon="gtk-undo" type="action" />
|
||||
</form>
|
||||
<tree string="Communication history">
|
||||
<field name="description"/>
|
||||
<field name="email_to"/>
|
||||
<field name="date"/>
|
||||
</tree>
|
||||
</field>
|
||||
<button colspan="4" string="Send New Email"
|
||||
name="%(action_crm_send_mail)d"
|
||||
context="{'mail':'new', 'model': 'crm.lead'}"
|
||||
icon="gtk-go-forward" type="action" />
|
||||
</page>
|
||||
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- CRM Lead Tree View -->
|
||||
|
||||
<record model="ir.ui.view" id="crm_case_tree_view_leads">
|
||||
<field name="name">CRM - Leads Tree</field>
|
||||
<field name="model">crm.lead</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Leads Tree" colors="blue:state=='pending';grey:state in ('cancel', 'done')">
|
||||
<field name="create_date"/>
|
||||
<field name="partner_name"/>
|
||||
<field name="name"/>
|
||||
<field name="email_from"/>
|
||||
<field name="phone"/>
|
||||
|
||||
<field name="categ_id" invisible="1"/>
|
||||
<field name="type_id" invisible="1"/>
|
||||
<field name="referred" invisible="1"/>
|
||||
|
||||
<field name="stage_id"/>
|
||||
<button name="stage_previous" string="Previous"
|
||||
states="open,pending" type="object" icon="gtk-go-back" />
|
||||
<button name="stage_next" string="Next"
|
||||
states="open,pending" type="object"
|
||||
icon="gtk-go-forward" />
|
||||
<field name="section_id"
|
||||
invisible="context.get('invisible_section', True)" />
|
||||
<field name="user_id" />
|
||||
<field name="state" />
|
||||
<button name="case_open" string="Open"
|
||||
states="draft,pending" type="object"
|
||||
icon="gtk-go-forward" />
|
||||
<button name="case_close" string="Close"
|
||||
states="open,draft,pending" type="object"
|
||||
icon="gtk-close" />
|
||||
<button string="Convert to Opportunity"
|
||||
name="convert_opportunity"
|
||||
states="draft,open,pending" icon="gtk-index"
|
||||
type="object" />
|
||||
<button name="case_escalate" string="Escalate"
|
||||
states="open,draft,pending" type="object"
|
||||
icon="gtk-go-up" />
|
||||
<button name="case_cancel" string="Cancel"
|
||||
states="draft,open,pending" type="object"
|
||||
icon="gtk-cancel" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- CRM Lead Calendar View -->
|
||||
|
||||
<record model="ir.ui.view" id="crm_case_calendar_view_leads">
|
||||
<field name="name">CRM - Leads Calendar</field>
|
||||
<field name="model">crm.lead</field>
|
||||
<field name="type">calendar</field>
|
||||
<field name="priority" eval="2"/>
|
||||
<field name="arch" type="xml">
|
||||
<calendar string="Meeting For Leads Generation"
|
||||
date_start="create_date" color="user_id"
|
||||
date_delay="duration">
|
||||
<field name="name" />
|
||||
<field name="partner_name" />
|
||||
<field name="partner_contact" />
|
||||
</calendar>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- CRM Lead Search View -->
|
||||
|
||||
<record id="view_crm_case_leads_filter" model="ir.ui.view">
|
||||
<field name="name">CRM - Leads Search</field>
|
||||
<field name="model">crm.lead</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Leads">
|
||||
<filter icon="terp-project"
|
||||
string="Current"
|
||||
default="1"
|
||||
domain="[('state','in',('draft','open'))]"/>
|
||||
<filter icon="terp-project"
|
||||
string="Open"
|
||||
domain="[('state','=','open')]"/>
|
||||
<filter icon="terp-project"
|
||||
string="Pending"
|
||||
domain="[('state','=','pending')]"/>
|
||||
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="gtk-home" string="Today"
|
||||
domain="[('create_date','<', time.strftime('%%Y-%%m-%%d 23:59:59')), \
|
||||
('create_date','>=', time.strftime('%%Y-%%m-%%d 23:59:59'))]"
|
||||
help="Todays' Opportunities" />
|
||||
<filter icon="gtk-media-rewind" string="7 Days"
|
||||
help="Opportunities during last 7 days"
|
||||
domain="[('create_date','<', time.strftime('%%Y-%%m-%%d')),\
|
||||
('create_date','>=',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
|
||||
/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="partner_name"/>
|
||||
<field name="email_from"/>
|
||||
<field name="user_id" widget="selection">
|
||||
<filter icon="terp-partner"
|
||||
domain="[('user_id','=',uid)]"
|
||||
help="My Leads" default="1"
|
||||
/>
|
||||
<filter icon="terp-partner"
|
||||
domain="[('user_id','=', False)]"
|
||||
help="Unassigned Leads" />
|
||||
</field>
|
||||
<field name="section_id" default="context.get('section_id', False)" widget="selection"
|
||||
context="{'invisible_section': False}">
|
||||
<filter icon="terp-crm"
|
||||
context="{'invisible_section': False}"
|
||||
domain="[('section_id.user_id','=',uid)]"
|
||||
help="My section"/>
|
||||
<filter icon="terp-crm"
|
||||
context="{'invisible_section': False}"
|
||||
domain="[]"
|
||||
help="Show Sales Team"/>
|
||||
</field>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By..." colspan="14">
|
||||
<filter string="Stage" icon="terp-crm" domain="[]" context="{'group_by':'stage_id'}"/>
|
||||
<filter string="State" icon="terp-crm" domain="[]" context="{'group_by':'state'}"/>
|
||||
<filter string="Source" icon="terp-crm" domain="[]" context="{'group_by':'categ_id'}"/>
|
||||
<filter string="Type" icon="terp-crm" domain="[]" context="{'group_by':'type'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Team" icon="terp-crm" domain="[]" context="{'group_by':'section_id'}"/>
|
||||
<filter string="Salesman" icon="terp-crm" domain="[]" context="{'group_by':'user_id'}"/>
|
||||
<filter string="Referrer" icon="terp-crm" domain="[]" context="{'group_by':'referred'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Creation" icon="terp-project"
|
||||
domain="[]" context="{'group_by':'create_date'}" />
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -17,7 +17,7 @@
|
||||
<field eval="time.strftime('%Y-%m-03 10:20:03')" name="date"/>
|
||||
<field name="categ_id" ref="crm.categ_meet2"/>
|
||||
<field eval=""Follow-up on proposal"" name="name"/>
|
||||
<field eval="time.strftime('%Y-%m-10')" name="date_deadline"/>
|
||||
<field eval="time.strftime('%Y-%m-03 16:38:03')" name="date_deadline"/>
|
||||
<field eval="6.3" name="duration"/>
|
||||
</record>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<field eval="time.strftime('%Y-%m-05 12:01:01')" name="date"/>
|
||||
<field name="categ_id" ref="crm.categ_meet3"/>
|
||||
<field eval=""Initial discussion"" name="name"/>
|
||||
<field eval="time.strftime('%Y-%m-12')" name="date_deadline"/>
|
||||
<field eval="time.strftime('%Y-%m-05 19:01:01')" name="date_deadline"/>
|
||||
<field eval=""contact@tecsas.fr"" name="email_from"/>
|
||||
</record>
|
||||
|
||||
@@ -48,9 +48,9 @@
|
||||
<field eval="time.strftime('%Y-%m-12 15:55:05')" name="date"/>
|
||||
<field name="categ_id" ref="crm.categ_meet1"/>
|
||||
<field eval=""Discuss pricing"" name="name"/>
|
||||
<field eval="time.strftime('%Y-%m-20')" name="date_deadline"/>
|
||||
<field eval="time.strftime('%Y-%m-12 18:55:05')" name="date_deadline"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="crm_case_reviewneeds0" model="crm.meeting">
|
||||
<field name="partner_address_id" ref="base.res_partner_address_15"/>
|
||||
<field eval="1" name="active"/>
|
||||
@@ -62,9 +62,9 @@
|
||||
<field eval="time.strftime('%Y-%m-20 10:02:02')" name="date"/>
|
||||
<field name="categ_id" ref="crm.categ_meet3"/>
|
||||
<field eval=""Review needs"" name="name"/>
|
||||
<field eval="time.strftime('%Y-%m-25')" name="date_deadline"/>
|
||||
<field eval="time.strftime('%Y-%m-20 16:02:02')" name="date_deadline"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="crm_case_changesindesigning0" model="crm.meeting">
|
||||
<field name="partner_address_id" ref="base.res_partner_address_1"/>
|
||||
<field eval="1" name="active"/>
|
||||
@@ -76,7 +76,7 @@
|
||||
<field eval="time.strftime('%Y-%m-22 11:05:05')" name="date"/>
|
||||
<field name="categ_id" ref="crm.categ_meet2"/>
|
||||
<field eval=""Changes in Designing"" name="name"/>
|
||||
<field eval="time.strftime('%Y-%m-28')" name="date_deadline"/>
|
||||
<field eval="time.strftime('%Y-%m-22 16:05:05')" name="date_deadline"/>
|
||||
<field eval=""info@opensides.be"" name="email_from"/>
|
||||
</record>
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
<field name="categ_id" ref="crm.categ_meet2"/>
|
||||
<field eval=""Update the data"" name="name"/>
|
||||
<field eval="13.3" name="duration"/>
|
||||
<field eval="time.strftime('%Y-%m-28')" name="date_deadline"/>
|
||||
<field eval="time.strftime('%Y-%m-19 02:30:49')" name="date_deadline"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -25,12 +25,15 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Meetings">
|
||||
<group col="6" colspan="4">
|
||||
<field name="name" select="1" string="Summary"
|
||||
colspan="4" />
|
||||
<field name="categ_id" widget="selection"
|
||||
string="Meeting Type"
|
||||
groups="base.group_extended"
|
||||
domain="[('object_id.model', '=', 'crm.meeting')]" />
|
||||
<group col="6" colspan="6">
|
||||
<field name="name" select="1" string="Summary"
|
||||
colspan="2" />
|
||||
<field name="categ_id" widget="selection"
|
||||
string="Meeting Type"
|
||||
groups="base.group_extended"
|
||||
domain="[('object_id.model', '=', 'crm.meeting')]" />
|
||||
<field name="allday" colspan="2" on_change="onchange_allday(allday)" />
|
||||
</group>
|
||||
<newline/>
|
||||
<field name="date" string="Start Date" required="1"
|
||||
on_change="onchange_dates(date,duration,False)" />
|
||||
|
||||
@@ -231,7 +231,7 @@ class crm_opportunity(osv.osv):
|
||||
}
|
||||
value = {
|
||||
'name': _('Meetings'),
|
||||
'domain': "[('user_id','=',%s)]" % (uid),
|
||||
'domain': "[('user_id','=',%s),('opportunity_id','=',%s)]" % (uid,opp.id),
|
||||
'context': context,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'calendar,form,tree',
|
||||
@@ -242,7 +242,6 @@ class crm_opportunity(osv.osv):
|
||||
'search_view_id': res['res_id'],
|
||||
'nodestroy': True
|
||||
}
|
||||
|
||||
return value
|
||||
|
||||
crm_opportunity()
|
||||
|
||||
@@ -0,0 +1,249 @@
|
||||
#-*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from datetime import datetime
|
||||
from osv import fields,osv,orm
|
||||
from tools.translate import _
|
||||
import crm
|
||||
import time
|
||||
import mx.DateTime
|
||||
|
||||
AVAILABLE_STATES = [
|
||||
('draft','Draft'),
|
||||
('open','Open'),
|
||||
('cancel', 'Lost'),
|
||||
('done', 'Converted'),
|
||||
('pending','Pending')
|
||||
]
|
||||
|
||||
class crm_opportunity(osv.osv):
|
||||
""" Opportunity Cases """
|
||||
|
||||
_name = "crm.opportunity"
|
||||
_description = "Opportunity Cases"
|
||||
_order = "priority,date_action,id desc"
|
||||
_inherit = 'crm.case'
|
||||
|
||||
def case_open(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 case's Ids
|
||||
@param *args: Give Tuple Value
|
||||
"""
|
||||
|
||||
res = super(crm_opportunity, self).case_open(cr, uid, ids, *args)
|
||||
self.write(cr, uid, ids, {'date_open': time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
return res
|
||||
|
||||
def _compute_day(self, cr, uid, ids, fields, 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
|
||||
"""
|
||||
cal_obj = self.pool.get('resource.calendar')
|
||||
res_obj = self.pool.get('resource.resource')
|
||||
|
||||
res = {}
|
||||
for opportunity in self.browse(cr, uid, ids , context):
|
||||
for field in fields:
|
||||
res[opportunity.id] = {}
|
||||
duration = 0
|
||||
ans = False
|
||||
if field == 'day_open':
|
||||
if opportunity.date_open:
|
||||
date_create = datetime.strptime(opportunity.create_date, "%Y-%m-%d %H:%M:%S")
|
||||
date_open = datetime.strptime(opportunity.date_open, "%Y-%m-%d %H:%M:%S")
|
||||
ans = date_open - date_create
|
||||
date_until = opportunity.date_open
|
||||
elif field == 'day_close':
|
||||
if opportunity.date_closed:
|
||||
date_create = datetime.strptime(opportunity.create_date, "%Y-%m-%d %H:%M:%S")
|
||||
date_close = datetime.strptime(opportunity.date_closed, "%Y-%m-%d %H:%M:%S")
|
||||
date_until = opportunity.date_closed
|
||||
ans = date_close - date_create
|
||||
if ans:
|
||||
resource_id = False
|
||||
if opportunity.user_id:
|
||||
resource_ids = res_obj.search(cr, uid, [('user_id','=',opportunity.user_id.id)])
|
||||
if resource_ids and len(resource_ids):
|
||||
resource_id = resource_ids[0]
|
||||
|
||||
duration = float(ans.days)
|
||||
if opportunity.section_id.resource_calendar_id:
|
||||
duration = float(ans.days) * 24
|
||||
new_dates = cal_obj.interval_get(cr,
|
||||
uid,
|
||||
opportunity.section_id.resource_calendar_id and opportunity.section_id.resource_calendar_id.id or False,
|
||||
mx.DateTime.strptime(opportunity.create_date, '%Y-%m-%d %H:%M:%S'),
|
||||
duration,
|
||||
resource=resource_id
|
||||
)
|
||||
no_days = []
|
||||
date_until = mx.DateTime.strptime(date_until, '%Y-%m-%d %H:%M:%S')
|
||||
for in_time, out_time in new_dates:
|
||||
if in_time.date not in no_days:
|
||||
no_days.append(in_time.date)
|
||||
if out_time > date_until:
|
||||
break
|
||||
duration = len(no_days)
|
||||
res[opportunity.id][field] = abs(int(duration))
|
||||
return res
|
||||
|
||||
_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')]"),
|
||||
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
|
||||
'referred': fields.char('Referred By', size=64),
|
||||
'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),
|
||||
'date_closed': fields.datetime('Closed', readonly=True),
|
||||
'user_id': fields.many2one('res.users', 'Salesman'),
|
||||
'phone': fields.char("Phone", size=64),
|
||||
'date_deadline': fields.date('Expected Closing'),
|
||||
'date_action': fields.date('Next Action'),
|
||||
'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True,
|
||||
help='The state is set to \'Draft\', when a case is created.\
|
||||
\nIf the case is in progress the state is set to \'Open\'.\
|
||||
\nWhen the case is over, the state is set to \'Done\'.\
|
||||
\nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
|
||||
|
||||
'date_open': fields.datetime('Opened', readonly=True),
|
||||
'day_open': fields.function(_compute_day, string='Days to Open', \
|
||||
method=True, multi='day_open', type="float", store=True),
|
||||
'day_close': fields.function(_compute_day, string='Days to Close', \
|
||||
method=True, multi='day_close', type="float", store=True),
|
||||
}
|
||||
|
||||
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:
|
||||
self.write(cr, uid, [case.id], {'probability': case.stage_id.probability})
|
||||
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:
|
||||
self.write(cr, uid, [case.id], {'probability': case.stage_id.probability})
|
||||
return res
|
||||
|
||||
_defaults = {
|
||||
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.opportunity', context=c),
|
||||
'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
|
||||
'state' : 'draft',
|
||||
}
|
||||
|
||||
def action_makeMeeting(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
This opens Meeting's calendar view to schedule meeting on current Opportunity
|
||||
@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 Opportunity to Meeting IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : Dictionary value for created Meeting view
|
||||
"""
|
||||
value = {}
|
||||
for opp in self.browse(cr, uid, ids):
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
|
||||
# Get meeting views
|
||||
result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_meetings_filter')
|
||||
res = 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
|
||||
|
||||
context = {
|
||||
'default_opportunity_id': opp.id,
|
||||
'default_partner_id': opp.partner_id and opp.partner_id.id or False,
|
||||
'default_section_id': opp.section_id and opp.section_id.id or False,
|
||||
'default_email_from': opp.email_from,
|
||||
'default_state': 'open',
|
||||
'default_name': opp.name
|
||||
}
|
||||
value = {
|
||||
'name': _('Meetings'),
|
||||
'domain': "[('user_id','=',%s)]" % (uid),
|
||||
'context': context,
|
||||
'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': res['res_id'],
|
||||
'nodestroy': True
|
||||
}
|
||||
|
||||
return value
|
||||
|
||||
crm_opportunity()
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
<record model="crm.case.categ" id="categ_oppor1">
|
||||
<field name="name">Existing Customer</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.categ" id="categ_oppor2">
|
||||
<field name="name">Self Generated</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.categ" id="categ_oppor3">
|
||||
<field name="name">Employee</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.categ" id="categ_oppor4">
|
||||
<field name="name">Partner</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.categ" id="categ_oppor5">
|
||||
<field name="name">Campaign</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.categ" id="categ_oppor6">
|
||||
<field name="name">Website</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.categ" id="categ_oppor7">
|
||||
<field name="name">Word of mouth</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.categ" id="categ_oppor8">
|
||||
<field name="name">Other</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
<!-- CASE STATUS(stage_id) -->
|
||||
<record model="crm.case.stage" id="stage_oppor1">
|
||||
<field name="name">Prospecting</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.stage" id="stage_oppor2">
|
||||
<field name="name">Needs Analysis</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.stage" id="stage_oppor3">
|
||||
<field name="name">Value Proposition</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.stage" id="stage_oppor4">
|
||||
<field name="name">Proposal/Price Quote</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.stage" id="stage_oppor5">
|
||||
<field name="name">Negotiation/Review</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.stage" id="stage_oppor6">
|
||||
<field name="name">Closed Won</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.stage" id="stage_oppor7">
|
||||
<field name="name">Closed Lost</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
<!-- Case Resource(type_id) -->
|
||||
<record model="crm.case.resource.type" id="type_oppor1">
|
||||
<field name="name">Existing Business</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.resource.type" id="type_oppor2">
|
||||
<field name="name">New Business</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
<!--
|
||||
((((((((((( Demo Cases )))))))))))
|
||||
-->
|
||||
|
||||
<!--For Opportunity-->
|
||||
|
||||
<record id="crm_case_construstazunits0" model="crm.opportunity">
|
||||
<field eval="60" name="probability"/>
|
||||
<field name="partner_address_id" ref="base.res_partner_address_zen"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="type_id" ref="crm.type_oppor1"/>
|
||||
<field name="partner_id" ref="base.res_partner_3"/>
|
||||
<field eval=""3"" name="priority"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field eval=""open"" name="state"/>
|
||||
<field eval="85000.0" name="planned_revenue"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="categ_id" ref="crm.categ_oppor1"/>
|
||||
<field name="stage_id" ref="crm.stage_oppor3"/>
|
||||
<field eval=""CONS TRUST (AZ) 529701 - 1000 units"" name="name"/>
|
||||
</record>
|
||||
<record id="crm_case_rdroundfundingunits0" model="crm.opportunity">
|
||||
<field name="partner_address_id" ref="base.res_partner_address_15"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="type_id" ref="crm.type_oppor2"/>
|
||||
<field name="partner_id" ref="base.res_partner_11"/>
|
||||
<field eval=""3"" name="priority"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field eval=""draft"" name="state"/>
|
||||
<field eval="45000.0" name="planned_revenue"/>
|
||||
<field eval="50" name="probability"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="categ_id" ref="crm.categ_oppor5"/>
|
||||
<field name="stage_id" ref="crm.stage_oppor1"/>
|
||||
<field eval=""3rd Round Funding - 1000 units "" name="name"/>
|
||||
</record>
|
||||
<record id="crm_case_mediapoleunits0" model="crm.opportunity">
|
||||
<field eval="10" name="probability"/>
|
||||
<field name="partner_address_id" ref="base.res_partner_address_3"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="type_id" ref="crm.type_oppor1"/>
|
||||
<field name="partner_id" ref="base.res_partner_8"/>
|
||||
<field eval=""3"" name="priority"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field eval=""pending"" name="state"/>
|
||||
<field eval="55000.0" name="planned_revenue"/>
|
||||
<field eval="70" name="probability"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="categ_id" ref="crm.categ_oppor7"/>
|
||||
<field name="stage_id" ref="crm.stage_oppor5"/>
|
||||
<field eval=""Mediapole - 5000 units"" name="name"/>
|
||||
<field eval=""info@mediapole.net"" name="email_from"/>
|
||||
</record>
|
||||
<record id="crm_case_abcfuelcounits0" model="crm.opportunity">
|
||||
<field eval="40" name="probability"/>
|
||||
<field name="partner_address_id" ref="base.res_partner_address_1"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="type_id" ref="crm.type_oppor1"/>
|
||||
<field name="partner_id" ref="base.res_partner_9"/>
|
||||
<field eval=""3"" name="priority"/>
|
||||
<field name="user_id" ref="base.user_demo"/>
|
||||
<field eval=""open"" name="state"/>
|
||||
<field eval="45000.0" name="planned_revenue"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="categ_id" ref="crm.categ_oppor5"/>
|
||||
<field name="stage_id" ref="crm.stage_oppor4"/>
|
||||
<field eval=""ABC FUEL CO 829264 - 1000 units "" name="name"/>
|
||||
<field eval=""info@opensides.be"" name="email_from"/>
|
||||
</record>
|
||||
<record id="crm_case_dirtminingltdunits0" model="crm.opportunity">
|
||||
<field eval="80" name="probability"/>
|
||||
<field name="partner_address_id" ref="base.res_partner_address_wong"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="partner_id" ref="base.res_partner_maxtor"/>
|
||||
<field eval=""3"" name="priority"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field eval=""done"" name="state"/>
|
||||
<field eval="42000.0" name="planned_revenue"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="categ_id" ref="crm.categ_oppor2"/>
|
||||
<field name="stage_id" ref="crm.stage_oppor6"/>
|
||||
<field eval=""Dirt Mining Ltd 271742 - 1000 units"" name="name"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -18,8 +18,8 @@
|
||||
res_model="crm.phonecall"
|
||||
src_model="crm.opportunity"
|
||||
view_mode="calendar,tree,form"
|
||||
context="{'default_duration': 1.0}"
|
||||
domain="[('user_id','=',uid)]"
|
||||
context="{'default_duration': 1.0 ,'default_opportunity_id': active_id}"
|
||||
domain="[('user_id','=',uid),('opportunity_id', '=', active_id)]"
|
||||
view_type="form"/>
|
||||
|
||||
<record model="ir.actions.act_window" id="crm_case_category_act_oppor11">
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
|
||||
<act_window
|
||||
id="act_crm_opportunity_crm_meeting_new"
|
||||
name="Meetings"
|
||||
res_model="crm.meeting"
|
||||
src_model="crm.opportunity"
|
||||
view_mode="tree,form,calendar,"
|
||||
context="{'default_duration': 4.0, 'default_opportunity_id': active_id}"
|
||||
domain="[('user_id','=',uid), ('opportunity_id', '=', active_id)]"
|
||||
view_type="form"/>
|
||||
|
||||
<act_window
|
||||
id="act_crm_opportunity_crm_phonecall_new"
|
||||
name="Phone calls"
|
||||
res_model="crm.phonecall"
|
||||
src_model="crm.opportunity"
|
||||
view_mode="calendar,tree,form"
|
||||
context="{'default_duration': 1.0}"
|
||||
domain="[('user_id','=',uid)]"
|
||||
view_type="form"/>
|
||||
|
||||
<record model="ir.actions.act_window" id="crm_case_category_act_oppor11">
|
||||
<field name="name">Opportunities</field>
|
||||
<field name="res_model">crm.opportunity</field>
|
||||
<field name="view_mode">tree,form,graph</field>
|
||||
<field name="view_id" ref="crm_case_tree_view_oppor"/>
|
||||
<field name="search_view_id" ref="crm.view_crm_case_opportunities_filter"/>
|
||||
</record>
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_view_oppor11">
|
||||
<field name="sequence" eval="1"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="crm_case_tree_view_oppor"/>
|
||||
<field name="act_window_id" ref="crm_case_category_act_oppor11"/>
|
||||
</record>
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_form_view_oppor11">
|
||||
<field name="sequence" eval="2"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="crm_case_form_view_oppor"/>
|
||||
<field name="act_window_id" ref="crm_case_category_act_oppor11"/>
|
||||
</record>
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_graph_view_oppor11">
|
||||
<field name="sequence" eval="4"/>
|
||||
<field name="view_mode">graph</field>
|
||||
<field name="view_id" ref="crm_case_graph_view_opportunity"/>
|
||||
<field name="act_window_id" ref="crm_case_category_act_oppor11"/>
|
||||
</record>
|
||||
<menuitem id="base.menu_sales" name="Sales"
|
||||
parent="base.menu_base_partner" sequence="1" />
|
||||
<menuitem name="Opportunities" id="menu_crm_case_opp"
|
||||
parent="base.menu_sales" action="crm_case_category_act_oppor11"
|
||||
sequence="2" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,329 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Opportunity Categories Form View -->
|
||||
|
||||
<record id="crm_opportunity_categ_action" model="ir.actions.act_window">
|
||||
<field name="name">Opportunity Categories</field>
|
||||
<field name="res_model">crm.case.categ</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_id" ref="crm.crm_case_categ_tree-view"/>
|
||||
<field name="domain">[('object_id.model', '=', 'crm.opportunity')]</field>
|
||||
<field name="context">{'object_id':'crm.opportunity'}</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="crm_opportunity_categ_action"
|
||||
id="menu_crm_case_opportunity-act"
|
||||
parent="crm.menu_crm_case_categ" />
|
||||
|
||||
<!-- Opportunity Stages Form View-->
|
||||
|
||||
<record id="crm_opportunity_stage_act" model="ir.actions.act_window">
|
||||
<field name="name">Opportunity Stages</field>
|
||||
<field name="res_model">crm.case.stage</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_id" ref="crm.crm_case_stage_tree"/>
|
||||
<field name="domain">[('object_id.model', '=', 'crm.opportunity')]</field>
|
||||
<field name="context">{'object_id':'crm.opportunity'}</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="crm_opportunity_stage_act"
|
||||
id="menu_crm_opportunity_stage_act"
|
||||
parent="crm.menu_crm_case_stage" />
|
||||
|
||||
<!-- Opportunity Resource Type Form View -->
|
||||
|
||||
<record id="crm_opportunity_resource_act" model="ir.actions.act_window">
|
||||
<field name="name">Opportunity Resource Type</field>
|
||||
<field name="res_model">crm.case.resource.type</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_id" ref="crm.crm_case_resource_type_tree"/>
|
||||
<field name="domain">[('object_id.model', '=', 'crm.opportunity')]</field>
|
||||
<field name="context">{'object_id':'crm.opportunity'}</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="crm_opportunity_resource_act"
|
||||
id="menu_crm_opportunity_resource_act"
|
||||
parent="crm.menu_crm_case_resource_type" />
|
||||
|
||||
<!-- Opportunities Form View -->
|
||||
|
||||
<record model="ir.ui.view" id="crm_case_form_view_oppor">
|
||||
<field name="name">Opportunities</field>
|
||||
<field name="model">crm.opportunity</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Opportunities">
|
||||
<group colspan="4" col="7">
|
||||
<field name="name" string="Opportunity"/>
|
||||
<label string="Stage:" align="1.0"/>
|
||||
<group colspan="1" col="4">
|
||||
<field name="stage_id" nolabel="1"
|
||||
on_change="onchange_stage_id(stage_id)"
|
||||
widget="selection"
|
||||
domain="[('object_id.model', '=', 'crm.opportunity')]" />
|
||||
<button name="stage_previous"
|
||||
states="open,pending" type="object"
|
||||
icon="gtk-go-back" string="" />
|
||||
<button name="stage_next" states="open,pending"
|
||||
type="object" icon="gtk-go-forward" string="" />
|
||||
</group>
|
||||
<field name="user_id"/>
|
||||
|
||||
<button name="action_makeMeeting" type="object"
|
||||
string="Schedule Meeting" icon="gtk-redo" />
|
||||
|
||||
<field name="planned_revenue"/>
|
||||
<field name="probability"/>
|
||||
<field name="date_deadline" string="Expected Closing"/>
|
||||
<button string="Schedule Call"
|
||||
name="%(opportunity2phonecall_act)d" icon="gtk-redo" type="action" />
|
||||
|
||||
<newline/>
|
||||
<field name="date_action"/>
|
||||
<field name="priority" string="Priority"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Opportunity">
|
||||
<group col="3" colspan="2">
|
||||
<separator colspan="4" string="Contacts"/>
|
||||
<field name="partner_id" select="1"
|
||||
on_change="onchange_partner_id(partner_id, email_from)"
|
||||
colspan="2" />
|
||||
<field name="partner_address_id"
|
||||
string="Contact"
|
||||
on_change="onchange_partner_address_id(partner_address_id, email_from)"
|
||||
colspan="1" />
|
||||
<field name="email_from" string="Email" />
|
||||
<field name="phone"/>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator colspan="2" string="Categorization"/>
|
||||
<field name="section_id" colspan="1" widget="selection"/>
|
||||
<field name="categ_id" select="1"
|
||||
string="Category" widget="selection"
|
||||
domain="[('object_id.model', '=', 'crm.opportunity')]" />
|
||||
</group>
|
||||
|
||||
<separator colspan="4" string="Details"/>
|
||||
<field name="description" nolabel="1" colspan="4"/>
|
||||
|
||||
<separator colspan="4"/>
|
||||
<group col="8" colspan="4">
|
||||
<field name="state"/>
|
||||
<button name="case_open" string="Open"
|
||||
states="draft,pending" type="object"
|
||||
icon="gtk-go-forward" />
|
||||
<button name="case_escalate" string="Escalate"
|
||||
states="open,draft,pending" type="object"
|
||||
groups="base.group_extended"
|
||||
icon="gtk-go-up" />
|
||||
<button name="case_pending" string="Pending"
|
||||
states="draft,open" type="object"
|
||||
icon="gtk-media-pause" />
|
||||
<button name="case_close" string="Mark Won"
|
||||
states="open,draft,pending" type="object"
|
||||
icon="gtk-close" />
|
||||
<button name="case_cancel" string="Mark Lost"
|
||||
states="draft,open,pending" type="object"
|
||||
icon="gtk-cancel" />
|
||||
<button name="case_reset" string="Reset to New"
|
||||
states="done,cancel" type="object"
|
||||
icon="gtk-convert" />
|
||||
</group>
|
||||
</page>
|
||||
|
||||
<page string="History" groups="base.group_extended">
|
||||
<group col="2" colspan="2">
|
||||
<separator string="Dates" colspan="2"/>
|
||||
<field name="create_date"/>
|
||||
<field name="write_date"/>
|
||||
<field name="date_closed"/>
|
||||
<field name="date_open"/>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator string="Misc" colspan="2"/>
|
||||
<field name="active"/>
|
||||
<field name="day_open"/>
|
||||
<field name="day_close"/>
|
||||
<field name="referred"/>
|
||||
</group>
|
||||
<separator colspan="4" string="References"/>
|
||||
<field name="ref"/>
|
||||
<field name="ref2"/>
|
||||
<field name="log_ids" nolabel="1" colspan="4">
|
||||
<form string="Actions">
|
||||
<separator string="Action Information" colspan="4"/>
|
||||
<field name="name" colspan="4"/>
|
||||
<field name="date"/>
|
||||
<field name="user_id"/>
|
||||
</form>
|
||||
</field>
|
||||
</page>
|
||||
<page string="Emails" groups="base.group_extended">
|
||||
<group colspan="4">
|
||||
<field colspan="4" name="email_cc" string="CC"/>
|
||||
</group>
|
||||
<field name="history_line" colspan="4" nolabel="1" mode="form,tree">
|
||||
<form string="Communication history">
|
||||
<group col="7" colspan="4">
|
||||
<field name="date"/>
|
||||
<field name="email_to"/>
|
||||
<field name="email_from"/>
|
||||
<button
|
||||
string="Add a CC"
|
||||
name="%(crm.action_view_crm_email_add_cc_wizard)d"
|
||||
icon="gtk-add" type="action"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<field name="description" colspan="4" nolabel="1"/>
|
||||
<button colspan="4"
|
||||
string="Reply to Last Email"
|
||||
name="%(action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'crm.opportunity'}"
|
||||
icon="gtk-undo" type="action" />
|
||||
</form>
|
||||
<tree string="Communication history">
|
||||
<field name="description"/>
|
||||
<field name="email_to"/>
|
||||
<field name="date"/>
|
||||
</tree>
|
||||
</field>
|
||||
<button colspan="4" string="Send New Email"
|
||||
name="%(action_crm_send_mail)d"
|
||||
context="{'mail':'new', 'model': 'crm.opportunity'}"
|
||||
icon="gtk-go-forward" type="action" />
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Opportunities Tree View -->
|
||||
|
||||
<record model="ir.ui.view" id="crm_case_tree_view_oppor">
|
||||
<field name="name">Opportunities Tree</field>
|
||||
<field name="model">crm.opportunity</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Opportunities" colors="blue:state=='pending';grey:state in ('cancel','done')">
|
||||
<field name="create_date"/>
|
||||
<field name="name" string="Opportunity"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="stage_id"/>
|
||||
<field name="categ_id" invisible="1"/>
|
||||
<button name="stage_previous" string="Previous"
|
||||
states="open,pending" type="object" icon="gtk-go-back" />
|
||||
<button name="stage_next" string="Next"
|
||||
states="open,pending" type="object"
|
||||
icon="gtk-go-forward" />
|
||||
<field name="planned_revenue" sum="Total of Planned Revenue"/>
|
||||
<field name="probability" widget="progressbar" avg="Avg. of Probability"/>
|
||||
<field name="date_action"/>
|
||||
<field name="section_id"/>
|
||||
<field name="user_id"/>
|
||||
<field name="priority"/>
|
||||
<field name="state"/>
|
||||
<button name="case_open" string="Open"
|
||||
states="draft,pending" type="object"
|
||||
icon="gtk-go-forward" />
|
||||
<button name="case_close" string="Won"
|
||||
states="open,draft,pending" type="object"
|
||||
icon="gtk-close" />
|
||||
<button name="case_pending" string="Pending"
|
||||
states="open,draft" type="object"
|
||||
icon="gtk-media-pause" />
|
||||
<button name="case_cancel" string="Lost"
|
||||
states="draft,open,pending" type="object"
|
||||
icon="gtk-cancel" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Opportunities Graph View -->
|
||||
|
||||
<record model="ir.ui.view" id="crm_case_graph_view_opportunity">
|
||||
<field name="name">CRM - Opportunity Graph</field>
|
||||
<field name="model">crm.opportunity</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Opportunity by Categories" type="bar" orientation="horizontal">
|
||||
<field name="categ_id"/>
|
||||
<field name="planned_revenue" operator="+"/>
|
||||
<field name="state" group="True"/>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Opportunities Search View -->
|
||||
|
||||
<record id="view_crm_case_opportunities_filter" model="ir.ui.view">
|
||||
<field name="name">CRM - Opportunities Search</field>
|
||||
<field name="model">crm.opportunity</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Opportunities">
|
||||
<filter icon="terp-project"
|
||||
string="Current"
|
||||
default="1"
|
||||
domain="[('state','in',('draft','open'))]"/>
|
||||
<filter icon="terp-project"
|
||||
string="Open"
|
||||
domain="[('state','=','open')]"/>
|
||||
<filter icon="terp-project"
|
||||
string="Pending"
|
||||
domain="[('state','=','pending')]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="gtk-home" string="Today"
|
||||
domain="[('create_date','<', time.strftime('%%Y-%%m-%%d 23:59:59')), ('create_date','>=', time.strftime('%%Y-%%m-%%d 23:59:59'))]"
|
||||
help="Todays' Opportunities" />
|
||||
<filter icon="gtk-media-rewind" string="7 Days"
|
||||
help="Opportunities during last 7 days"
|
||||
domain="[('create_date','<', time.strftime('%%Y-%%m-%%d')),\
|
||||
('create_date','>=',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
|
||||
/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="name" string="Opportunity"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="user_id" widget="selection">
|
||||
<filter icon="terp-partner"
|
||||
domain="[('user_id','=',uid)]"
|
||||
help="My Opportunities" default="1"
|
||||
/>
|
||||
<filter icon="terp-partner"
|
||||
domain="[('user_id','=', False)]"
|
||||
help="Unassigned Opportunities" />
|
||||
</field>
|
||||
<field name="section_id"
|
||||
default="context.get('section_id', False)" select="1"
|
||||
widget="selection">
|
||||
<filter icon="terp-crm"
|
||||
domain="[('section_id','=',context.get('section_id',False))]"
|
||||
help="My section" />
|
||||
</field>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By..." colspan="16">
|
||||
<filter string="Stage" icon="terp-crm" domain="[]"
|
||||
context="{'group_by':'stage_id'}" />
|
||||
<filter string="Priority" icon="terp-crm" domain="[]"
|
||||
context="{'group_by':'priority'}" />
|
||||
<filter string="Category" icon="terp-crm"
|
||||
domain="[]" context="{'group_by':'categ_id'}" />
|
||||
|
||||
<separator orientation="vertical" />
|
||||
<filter string="Partner" icon="terp-crm" domain="[]"
|
||||
context="{'group_by':'partner_id'}" />
|
||||
<filter string="Salesman" icon="terp-crm"
|
||||
domain="[]" context="{'group_by':'user_id'}" />
|
||||
<separator orientation="vertical" />
|
||||
<filter string="Creation" icon="terp-project"
|
||||
domain="[]" context="{'group_by':'create_date'}" />
|
||||
<filter string="Exp.Closing" icon="terp-project"
|
||||
domain="[]" context="{'group_by':'date_deadline'}" />
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -21,10 +21,9 @@
|
||||
|
||||
#import report_businessopp
|
||||
import crm_report
|
||||
import crm_claim_report
|
||||
import crm_lead_report
|
||||
import crm_opportunity_report
|
||||
import crm_phonecall_report
|
||||
import crm_fundraising_report
|
||||
import crm_helpdesk_report
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields,osv
|
||||
import tools
|
||||
|
||||
AVAILABLE_STATES = [
|
||||
('draft','Draft'),
|
||||
('open','Open'),
|
||||
('cancel', 'Cancelled'),
|
||||
('done', 'Closed'),
|
||||
('pending','Pending')
|
||||
]
|
||||
|
||||
class crm_lead_report(osv.osv):
|
||||
""" CRM Lead Report """
|
||||
_name = "crm.lead.report"
|
||||
_auto = False
|
||||
_inherit = "crm.case.report"
|
||||
_description = "CRM Lead Report"
|
||||
|
||||
_columns = {
|
||||
'delay_close': fields.float('Delay to close',digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"),
|
||||
'categ_id': fields.many2one('crm.case.categ', 'Category',\
|
||||
domain="[('section_id','=',section_id),\
|
||||
('object_id.model', '=', 'crm.lead')]" , readonly=True),
|
||||
'stage_id': fields.many2one ('crm.case.stage', 'Stage', \
|
||||
domain="[('section_id','=',section_id),\
|
||||
('object_id.model', '=', 'crm.lead')]", readonly=True),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner' , readonly=True),
|
||||
'company_id': fields.many2one('res.company', 'Company', readonly=True),
|
||||
}
|
||||
def init(self, cr):
|
||||
|
||||
"""
|
||||
CRM Lead Report
|
||||
@param cr: the current row, from the database cursor
|
||||
"""
|
||||
|
||||
tools.drop_view_if_exists(cr, 'crm_lead_report')
|
||||
cr.execute("""
|
||||
create or replace view crm_lead_report as (
|
||||
select
|
||||
min(c.id) as id,
|
||||
to_char(c.create_date, 'YYYY') as name,
|
||||
to_char(c.create_date, 'MM') as month,
|
||||
to_char(c.create_date, 'YYYY-MM-DD') as day,
|
||||
c.state as state,
|
||||
c.user_id,
|
||||
c.stage_id,
|
||||
c.company_id,
|
||||
c.section_id,
|
||||
c.categ_id,
|
||||
c.partner_id,
|
||||
count(*) as nbr,
|
||||
0 as avg_answers,
|
||||
0.0 as perc_done,
|
||||
0.0 as perc_cancel,
|
||||
date_trunc('day',c.create_date) as create_date,
|
||||
avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close
|
||||
from
|
||||
crm_lead c
|
||||
group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'),\
|
||||
c.state, c.user_id,c.section_id,c.stage_id,categ_id,c.partner_id,c.company_id
|
||||
,c.create_date,to_char(c.create_date, 'YYYY-MM-DD')
|
||||
)""")
|
||||
|
||||
crm_lead_report()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Leads by user and section Tree View -->
|
||||
|
||||
<record id="view_report_crm_lead_tree" model="ir.ui.view">
|
||||
<field name="name">crm.lead.report.tree</field>
|
||||
<field name="model">crm.lead.report</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Leads">
|
||||
<field name="name" invisible="1"/>
|
||||
<field name="month" invisible="1"/>
|
||||
<field name="section_id" invisible="1"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="partner_id" invisible="1"/>
|
||||
<field name="day" invisible="1"/>
|
||||
<field name="nbr" string="#Leads" sum="#Leads"/>
|
||||
<field name="delay_close" sum='Avg Closing Delay'/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="stage_id" invisible="1"/>
|
||||
<field name="categ_id" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Leads by user and section Form View -->
|
||||
|
||||
<record id="view_report_crm_lead_form" model="ir.ui.view">
|
||||
<field name="name">crm.lead.report.form</field>
|
||||
<field name="model">crm.lead.report</field>
|
||||
<field name="inherit_id" ref="view_crm_case_form"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="nbr" position="after">
|
||||
<field name="delay_close"/>
|
||||
<field name="stage_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Leads by user and section Graph View -->
|
||||
|
||||
<record id="view_report_crm_lead_graph" model="ir.ui.view">
|
||||
<field name="name">crm.lead.report.graph</field>
|
||||
<field name="model">crm.lead.report</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph orientation="horizontal" string="Leads" type="bar">
|
||||
<field name="state"/>
|
||||
<field name="nbr" operator="+"/>
|
||||
<field group="True" name="user_id"/>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Leads by user and section Search View -->
|
||||
|
||||
<record id="view_report_crm_lead_filter" model="ir.ui.view">
|
||||
<field name="name">crm.lead.report.select</field>
|
||||
<field name="model">crm.lead.report</field>
|
||||
<field name="inherit_id" ref="view_crm_case_filter"/>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr='//search[@string="Search"]/group[@string="Extended options..."]/filter[@string="Cancel"]' position='after'>
|
||||
<group>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="stage_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]"/>
|
||||
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]"/>
|
||||
</group>
|
||||
</xpath>
|
||||
<xpath
|
||||
expr='//search[@string="Search"]/group[@string="Group By..."]/filter[@string="State"]'
|
||||
position='after'>
|
||||
<filter string="Stage" icon="terp-sale" domain="[]"
|
||||
context="{'group_by':'stage_id'}" />
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Leads by user and section Action -->
|
||||
|
||||
<record id="action_report_crm_lead" model="ir.actions.act_window">
|
||||
<field name="name">Leads</field>
|
||||
<field name="res_model">crm.lead.report</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="context">{"search_default_User":1,"search_default_This Month":1,'group_by_no_leaf':1,'group_by':[]}</field>
|
||||
<field name="view_mode">tree,graph</field>
|
||||
<field name="search_view_id" ref="view_report_crm_lead_filter"/>
|
||||
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_report_crm_lead_tree">
|
||||
<field name="sequence" eval="1"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="view_report_crm_lead_tree"/>
|
||||
<field name="act_window_id" ref="action_report_crm_lead"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_report_crm_lead_graph">
|
||||
<field name="sequence" eval="2"/>
|
||||
<field name="view_mode">graph</field>
|
||||
<field name="view_id" ref="view_report_crm_lead_graph"/>
|
||||
<field name="act_window_id" ref="action_report_crm_lead"/>
|
||||
</record>
|
||||
|
||||
<menuitem name="Leads" id="menu_report_crm_leads_tree"
|
||||
groups="base.group_extended"
|
||||
parent="base.next_id_64" action="action_report_crm_lead" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,100 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields,osv
|
||||
import tools
|
||||
|
||||
AVAILABLE_STATES = [
|
||||
('draft','Draft'),
|
||||
('open','Open'),
|
||||
('cancel', 'Cancelled'),
|
||||
('done', 'Closed'),
|
||||
('pending','Pending')
|
||||
]
|
||||
|
||||
class crm_opportunity_report(osv.osv):
|
||||
""" CRM Opportunity Report """
|
||||
_name = "crm.opportunity.report"
|
||||
_auto = False
|
||||
_inherit = "crm.case.report"
|
||||
_description = "CRM Opportunity Report"
|
||||
_columns = {
|
||||
'probability': fields.float('Avg. Probability', readonly=True,group_operator='avg'),
|
||||
'amount_revenue': fields.float('Est.Revenue', readonly=True),
|
||||
'amount_revenue_prob': fields.float('Est. Rev*Prob.', readonly=True),
|
||||
'delay_close': fields.float('Delay to close',digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"),
|
||||
'categ_id': fields.many2one('crm.case.categ', 'Category',\
|
||||
domain="[('section_id','=',section_id),\
|
||||
('object_id.model', '=', 'crm.opportunity')]", readonly=True),
|
||||
'stage_id':fields.many2one('crm.case.stage', 'Stage',\
|
||||
domain="[('section_id','=',section_id),\
|
||||
('object_id.model', '=', 'crm.opportunity')]", readonly=True),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner', readonly=True),
|
||||
'company_id': fields.many2one('res.company', 'Company', readonly=True),
|
||||
'user_id':fields.many2one('res.users', 'User', readonly=True),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
""" Display Est.Revenue , Average Probability ,Est.Revenue Probability
|
||||
@param cr: the current row, from the database cursor
|
||||
"""
|
||||
|
||||
tools.drop_view_if_exists(cr, 'crm_opportunity_report')
|
||||
cr.execute("""
|
||||
create or replace view crm_opportunity_report as (
|
||||
select
|
||||
min(c.id) as id,
|
||||
to_char(c.create_date, 'YYYY') as name,
|
||||
to_char(c.create_date, 'MM') as month,
|
||||
to_char(c.create_date, 'YYYY-MM-DD') as day,
|
||||
c.state as state,
|
||||
c.user_id,
|
||||
c.section_id,
|
||||
c.categ_id,
|
||||
c.stage_id,
|
||||
c.partner_id,
|
||||
c.company_id,
|
||||
count(*) as nbr,
|
||||
0 as avg_answers,
|
||||
0.0 as perc_done,
|
||||
0.0 as perc_cancel,
|
||||
date_trunc('day',c.create_date) as create_date,
|
||||
sum(planned_revenue) as amount_revenue,
|
||||
sum((planned_revenue*probability)/100.0)::decimal(16,2) as amount_revenue_prob,
|
||||
avg(probability)::decimal(16,2) as probability,
|
||||
avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close
|
||||
from
|
||||
crm_opportunity c
|
||||
group by
|
||||
to_char(c.create_date, 'YYYY'),
|
||||
to_char(c.create_date, 'MM'),
|
||||
to_char(c.create_date, 'YYYY-MM-DD'),
|
||||
c.state,
|
||||
c.user_id,
|
||||
c.section_id,
|
||||
c.stage_id,
|
||||
c.categ_id,
|
||||
c.partner_id,
|
||||
company_id,
|
||||
create_date
|
||||
)""")
|
||||
|
||||
crm_opportunity_report()
|
||||
@@ -0,0 +1,122 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Opportunities by user and section Tree View -->
|
||||
|
||||
<record id="view_report_crm_opportunity_tree" model="ir.ui.view">
|
||||
<field name="name">crm.opportunity.report.tree</field>
|
||||
<field name="model">crm.opportunity.report</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Opportunities">
|
||||
<field name="name" invisible="1"/>
|
||||
<field name="month" invisible="1"/>
|
||||
<field name="section_id" invisible="1"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="partner_id" invisible="1"/>
|
||||
<field name="nbr" string="#Opportunities" sum="#Opportunities"/>
|
||||
<field name="amount_revenue" sum="Total Revenue"/>
|
||||
<field name="probability" widget="progressbar" avg="Probability"/>
|
||||
<field name="amount_revenue_prob" sum="Est. Rev*Prob"/>
|
||||
<field name="delay_close" avg="Avg Closing Delay"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="stage_id" invisible="1"/>
|
||||
<field name="categ_id" invisible="1"/>
|
||||
<field name="day" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Opportunities by user and section Form View -->
|
||||
|
||||
<record id="view_report_crm_opportunity_form" model="ir.ui.view">
|
||||
<field name="name">crm.opportunity.report.form</field>
|
||||
<field name="model">crm.opportunity.report</field>
|
||||
<field name="inherit_id" ref="view_crm_case_form"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="nbr" position="after">
|
||||
<field name="delay_close"/>
|
||||
<field name="amount_revenue"/>
|
||||
<field name="amount_costs"/>
|
||||
<field name="amount_revenue_prob"/>
|
||||
<field name="probability"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Opportunities by user and section Graph View -->
|
||||
|
||||
<record id="view_report_crm_opportunity_graph" model="ir.ui.view">
|
||||
<field name="name">crm.opportunity.report.graph</field>
|
||||
<field name="model">crm.opportunity.report</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph orientation="horizontal" string="Opportunity" type="bar">
|
||||
<field name="state"/>
|
||||
<field name="nbr" operator="+"/>
|
||||
<field group="True" name="user_id"/>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Opportunities by user and section Search View -->
|
||||
|
||||
<record id="view_report_crm_opportunity_filter" model="ir.ui.view">
|
||||
<field name="name">crm.opportunity.report.select</field>
|
||||
<field name="model">crm.opportunity.report</field>
|
||||
<field name="inherit_id" ref="view_crm_case_filter"/>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr='//search[@string="Search"]/group[@string="Extended options..."]/filter[@string="Cancel"]' position='after'>
|
||||
<group>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="stage_id" widget="selection" domain="[('object_id.model', '=', 'crm.opportunity')]"/>
|
||||
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.opportunity')]"/>
|
||||
</group>
|
||||
</xpath>
|
||||
<xpath
|
||||
expr='//search[@string="Search"]/group[@string="Group By..."]/filter[@string="State"]'
|
||||
position='after'>
|
||||
<filter string="Stage" icon="terp-sale" domain="[]"
|
||||
context="{'group_by':'stage_id'}" />
|
||||
<separator orientation="vertical" />
|
||||
<filter string="Partner" icon="terp-partner"
|
||||
domain="[]" context="{'group_by':'partner_id'}" />
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Opportunities by user and section Action -->
|
||||
|
||||
<record id="action_report_crm_opportunity" model="ir.actions.act_window">
|
||||
<field name="name">Opportunities</field>
|
||||
<field name="res_model">crm.opportunity.report</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,graph</field>
|
||||
<field name="context">{"search_default_User":1,"search_default_This Month":1,'group_by_no_leaf':1,'group_by':[]}</field>
|
||||
<field name="search_view_id" ref="view_report_crm_opportunity_filter"/>
|
||||
</record>
|
||||
<record model="ir.actions.act_window.view" id="action_report_crm_opportunity_tree">
|
||||
<field name="sequence" eval="1"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="view_report_crm_opportunity_tree"/>
|
||||
<field name="act_window_id" ref="action_report_crm_opportunity"/>
|
||||
</record>
|
||||
<record model="ir.actions.act_window.view" id="action_report_crm_opportunity_graph">
|
||||
<field name="sequence" eval="2"/>
|
||||
<field name="view_mode">graph</field>
|
||||
<field name="view_id" ref="view_report_crm_opportunity_graph"/>
|
||||
<field name="act_window_id" ref="action_report_crm_opportunity"/>
|
||||
</record>
|
||||
|
||||
<menuitem name="Opportunities"
|
||||
action="action_report_crm_opportunity"
|
||||
id="menu_report_crm_opportunity_tree" parent="base.next_id_64" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -5,10 +5,9 @@
|
||||
"access_crm_case_categ","crm.case.categ","model_crm_case_categ","crm.group_crm_user",1,0,0,0
|
||||
"access_crm_case_manger","crm.case manager","model_crm_case","crm.group_crm_user",1,1,1,1
|
||||
"access_crm_case","crm.case","model_crm_case","crm.group_crm_manager",1,1,1,1
|
||||
"access_crm_claim","crm.claim","model_crm_claim","crm.group_crm_manager",1,1,1,1
|
||||
"access_crm_fundraising","crm.fundraising","model_crm_fundraising","crm.group_crm_manager",1,1,1,1
|
||||
"access_crm_helpdesk","crm.helpdesk","model_crm_helpdesk","crm.group_crm_manager",1,1,1,1
|
||||
"access_crm_meeting","crm.meeting","model_crm_meeting","crm.group_crm_manager",1,1,1,1
|
||||
"access_crm_lead","crm.lead","model_crm_lead","crm.group_crm_manager",1,1,1,1
|
||||
"access_crm_opportunity","crm.opportunity","model_crm_opportunity","crm.group_crm_manager",1,1,1,1
|
||||
"access_crm_phonecall","crm.phonecall","model_crm_phonecall","crm.group_crm_manager",1,1,1,1
|
||||
"access_crm_case_log","crm.case.log","model_crm_case_log","crm.group_crm_user",1,1,1,1
|
||||
"access_crm_case_history","crm.case.history","model_crm_case_history","crm.group_crm_user",1,1,1,1
|
||||
@@ -24,13 +23,16 @@
|
||||
"access_crm_case_resource_type_manager","crm_case_resource_type manager","model_crm_case_resource_type","crm.group_crm_manager",1,1,1,1
|
||||
"access_crm_case_report_user","crm.case.report","model_crm_case_report","crm.group_crm_user",1,0,0,0
|
||||
"access_crm_case_report_manager","crm.case.report manager","model_crm_case_report","crm.group_crm_manager",1,1,1,1
|
||||
"access_crm_claim_report_user","crm.claim.report","model_crm_claim_report","crm.group_crm_user",1,0,0,0
|
||||
"access_crm_fundraising_report_user","crm.fundraising.report","model_crm_fundraising_report","crm.group_crm_user",1,0,0,0
|
||||
"access_crm_lead_report_user","crm.lead.report","model_crm_lead_report","crm.group_crm_user",1,0,0,0
|
||||
"access_crm_phonecall_report_user","crm.phonecall.report","model_crm_phonecall_report","crm.group_crm_user",1,0,0,0
|
||||
"access_crm_opportunity_report_user","crm.opportunity.report","model_crm_opportunity_report","crm.group_crm_user",1,0,0,0
|
||||
"access_report_crm_case_service_dashboard","report.crm.case.service.dashboard","model_report_crm_case_service_dashboard","crm.group_crm_user",1,0,0,0
|
||||
"access_crm_lead2partner","crm.lead2partner","model_crm_lead2partner","crm.group_crm_user",1,1,1,1
|
||||
"access_crm_lead2opportunity","crm.lead2opportunity","model_crm_lead2opportunity","crm.group_crm_user",1,1,1,1
|
||||
"access_crm_opportunity2phonecall","crm.opportunity2phonecall","model_crm_opportunity2phonecall","crm.group_crm_user",1,1,1,1
|
||||
"access_crm_phonecall2phonecall","crm.phonecall2phonecall","model_crm_phonecall2phonecall","crm.group_crm_user",1,1,1,1
|
||||
"access_crm_phonecall2partner","crm.phonecall2partner","model_crm_phonecall2partner","crm.group_crm_user",1,1,1,1
|
||||
"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
|
||||
"access_crm_lead2opportunity_partner","crm.lead2opportunity.partner","model_crm_lead2opportunity_partner","crm.group_crm_user",1,1,1,1
|
||||
|
||||
|
@@ -0,0 +1,113 @@
|
||||
- |
|
||||
In order to test the CRM in OpenERP,
|
||||
I will do a customer qualification process that
|
||||
starts with a fist contact with a customer (a lead), which will be converted to a
|
||||
business opportunity and a partner.
|
||||
- |
|
||||
In order to test the flow, I create a two new users "user_crm" and
|
||||
I assign the group "salesman".
|
||||
-
|
||||
!record {model: res.users, id: res_users_usercrm0}:
|
||||
company_id: base.main_company
|
||||
context_lang: en_US
|
||||
context_section_id: crm.section_sales_department
|
||||
groups_id:
|
||||
- crm.group_crm_user
|
||||
login: user_crm
|
||||
name: user_crm
|
||||
password: user_crm
|
||||
|
||||
|
||||
- |
|
||||
I start by creating a new lead "New Customer" and I provide an address to this
|
||||
new customer, as well as an email "info@mycustomer.com".
|
||||
-
|
||||
!record {model: crm.lead, id: crm_lead_newcustomer0}:
|
||||
email_from: info@mycustomer.com
|
||||
name: New Customer
|
||||
partner_name: Sandip zala
|
||||
phone: (855) 924-4364
|
||||
mobile: (333) 715-1450
|
||||
section_id: crm.section_sales_department
|
||||
referred: False
|
||||
title: M.
|
||||
- |
|
||||
I check that the lead is in 'draft' state,
|
||||
-
|
||||
!assert {model: crm.lead, id: crm_lead_newcustomer0, string: Lead in Draft}:
|
||||
- state == "draft"
|
||||
-
|
||||
I open lead by click on "Open" button,
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.case_open(cr, uid, [ref("crm_lead_newcustomer0")])
|
||||
|
||||
- |
|
||||
As the lead seems to be a real business opportunity, I will convert it to a
|
||||
partner
|
||||
and a business opportunity by clicking on the "Convert" button.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
lead = self.browse(cr, uid, ref('crm_lead_newcustomer0'))
|
||||
if not lead.partner_id:
|
||||
self.convert_opportunity(cr, uid, [ref("crm_lead_newcustomer0")], {'active_ids': [ref("crm_lead_newcustomer0")]})
|
||||
-
|
||||
|
|
||||
Now, select "create a new partner" option in this wizard.
|
||||
-
|
||||
!record {model: crm.lead2opportunity.partner, id: crm_lead2opportunity_partner_create_0}:
|
||||
action: 'create'
|
||||
-
|
||||
I click on "Continue" button of this wizard.
|
||||
-
|
||||
!python {model: crm.lead2opportunity.partner}: |
|
||||
self.make_partner(cr, uid, [ref("crm_lead2opportunity_partner_create_0")], {'active_ids': [ref("crm_lead_newcustomer0")]})
|
||||
-
|
||||
Now, I give value to this wizard field.
|
||||
-
|
||||
!record {model: crm.lead2opportunity, id: crm_lead2opportunity_stonage_0}:
|
||||
name: Sandip zala
|
||||
planned_revenue: 0.00
|
||||
probability: 0.00
|
||||
-
|
||||
Then, Click on "Create Opportunity" button of this wizard.
|
||||
-
|
||||
!python {model: crm.lead2opportunity}: |
|
||||
self.action_apply(cr, uid, [ref('crm_lead2opportunity_stonage_0')], {'active_id': ref('crm_lead_newcustomer0')})
|
||||
|
||||
- |
|
||||
I can check that a lead and a business opportunity is now assigned to this
|
||||
lead.
|
||||
-
|
||||
# !python {model: crm.lead, id: crm_lead_newcustomer0}:
|
||||
# - opportunity_id.id != False
|
||||
|
||||
- |
|
||||
I check that the partner associated to this lead as the same country, phone number
|
||||
and name than the opportunity.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
lead = self.browse(cr, uid, ref("crm_lead_newcustomer0"))
|
||||
print "lead", lead.partner_name
|
||||
obj_opportunity = self.pool.get('crm.opportunity')
|
||||
ids = obj_opportunity.search(cr, uid, [('name', '=', lead.partner_name)])
|
||||
opportunity = obj_opportunity.browse(cr, uid, ids)[0]
|
||||
assert lead.partner_name == opportunity.partner_id.name
|
||||
assert lead.phone == opportunity.phone
|
||||
-
|
||||
|
|
||||
# yaml is also not working smpt server and send new email.
|
||||
|
||||
- |
|
||||
I configure with smtp server.
|
||||
- |
|
||||
And I communicate with lead through send New mail to Lead using it email address from user which are loged.
|
||||
- |
|
||||
I check that communication history generated when send email to lead.
|
||||
- |
|
||||
Then, I add a cc which receive copy of future communication between partner and users by mail.
|
||||
|
||||
- |
|
||||
I Reply to last Email to lead with some document attached.and check that communication history generated or not.
|
||||
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
- |
|
||||
I start by creating a new Opportunity. And I select partner for opportunity.
|
||||
I can see that after selecting partner his contact and email is automatically filled.
|
||||
-
|
||||
!record {model: crm.opportunity, id: crm_opportunity_abcfuelcounits0}:
|
||||
email_from: info@balmerinc.be
|
||||
name: 'ABC FUEL CO 829264 - 10002 units '
|
||||
partner_address_id: base.res_partner_address_1
|
||||
partner_id: base.res_partner_9
|
||||
probability: 1.0
|
||||
stage_id: crm.stage_oppor1
|
||||
categ_id: crm.categ_oppor2
|
||||
section_id: crm.section_sales_department
|
||||
|
||||
- |
|
||||
I check that the opportunity is in 'New' state.
|
||||
-
|
||||
!assert {model: crm.opportunity, id: crm_opportunity_abcfuelcounits0}:
|
||||
- state == "draft"
|
||||
- |
|
||||
I open opportunity by click on "Open" button,
|
||||
-
|
||||
!python {model: crm.opportunity}: |
|
||||
self.case_open(cr, uid, [ref("crm_opportunity_abcfuelcounits0")])
|
||||
|
||||
- |
|
||||
I schedule Meeting on this current opportunity by clicking on "schedule
|
||||
Meeting".
|
||||
-
|
||||
!python {model: crm.opportunity}: |
|
||||
self.action_makeMeeting(cr, uid, [ref("crm_opportunity_abcfuelcounits0")])
|
||||
|
||||
- |
|
||||
I can see that Meeting's calendar view is shown.
|
||||
then I click on the date on which I want schedule meeting.
|
||||
I fill proper data for that meeting and save it
|
||||
-
|
||||
!record {model: crm.meeting, id: crm_meeting_abcfuelcounits0}:
|
||||
alarm_id: base_calendar.alarm3
|
||||
date: '2010-04-16 00:00:00'
|
||||
date_deadline: '2010-04-16 08:00:00'
|
||||
duration: 8.0
|
||||
email_from: info@balmerinc.be
|
||||
name: 'ABC FUEL CO 829264 - 10002 units '
|
||||
opportunity_id: 'crm_opportunity_abcfuelcounits0'
|
||||
partner_address_id: base.res_partner_address_1
|
||||
partner_id: base.res_partner_9
|
||||
rrule_type: weekly
|
||||
section_id: crm.section_sales_department
|
||||
state: open
|
||||
- |
|
||||
In order to schedule a phonecall to the partner
|
||||
I click on "schedule call" button and select planned date for the call.
|
||||
-
|
||||
!record {model: crm.opportunity2phonecall, id: crm_opportunity2phonecall_abcfuelcounits0}:
|
||||
date: '2010-04-17 11:15:00'
|
||||
name: 'ABC FUEL CO 829264 - 10002 units '
|
||||
section_id: crm.section_sales_department
|
||||
user_id: base.user_demo
|
||||
- |
|
||||
schedule phonecall by apply (action_apply)function of opportunity2phoncall wizard
|
||||
-
|
||||
!python {model: crm.opportunity2phonecall}: |
|
||||
self.action_apply(cr, uid, [ref('crm_opportunity2phonecall_abcfuelcounits0')], {'active_ids': [ref("crm_opportunity_abcfuelcounits0")]})
|
||||
- |
|
||||
I check that phonecall record is created for that opportunity.
|
||||
-
|
||||
!python {model: crm.phonecall}: |
|
||||
ids = self.search(cr, uid, [('name', '=', 'ABC FUEL CO 829264 - 10002 units')])
|
||||
assert len(ids)
|
||||
- |
|
||||
I can see phonecall record after click on "Schedule call" wizard.
|
||||
-
|
||||
!record {model: crm.phonecall, id: crm_phonecall_abcfuelcounits0}:
|
||||
date: '2010-04-17 11:15:00'
|
||||
duration: 3.0
|
||||
name: 'ABC FUEL CO 829264 - 10002 units'
|
||||
partner_address_id: base.res_partner_address_1
|
||||
partner_id: base.res_partner_9
|
||||
section_id: crm.section_sales_department
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
|
||||
import crm_send_email
|
||||
import crm_email_add_cc
|
||||
|
||||
import crm_lead_to_partner
|
||||
import crm_lead_to_opportunity
|
||||
import crm_opportunity_to_phonecall
|
||||
import crm_phonecall_to_phonecall
|
||||
import crm_phonecall_to_partner
|
||||
import crm_phonecall_to_opportunity
|
||||
|
||||
@@ -0,0 +1,327 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from mx.DateTime import now
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
|
||||
|
||||
class crm_lead2opportunity(osv.osv_memory):
|
||||
_name = 'crm.lead2opportunity'
|
||||
_description = 'Lead To Opportunity'
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Closes Lead To Opportunity form
|
||||
@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 Lead to Partner's IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
"""
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
def action_apply(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
This converts lead to opportunity and opens Opportunity view
|
||||
@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 Lead to Opportunity IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : Dictionary value for created Opportunity form
|
||||
"""
|
||||
record_id = context and context.get('active_id', False) or False
|
||||
if not record_id:
|
||||
return {}
|
||||
|
||||
lead_obj = self.pool.get('crm.lead')
|
||||
opp_obj = self. pool.get('crm.opportunity')
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
history_obj = self.pool.get('crm.case.history')
|
||||
model_obj = self.pool.get('ir.model')
|
||||
|
||||
# Get Opportunity views
|
||||
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
|
||||
|
||||
lead = lead_obj.browse(cr, uid, record_id, context=context)
|
||||
model_ids = model_obj.search(cr, uid, [('model', '=', 'crm.opportunity')])
|
||||
|
||||
|
||||
for this in self.browse(cr, uid, ids, context=context):
|
||||
new_opportunity_id = opp_obj.create(cr, uid, {
|
||||
'name': this.name,
|
||||
'referred': lead.referred,
|
||||
'planned_revenue': this.planned_revenue,
|
||||
'probability': this.probability,
|
||||
'partner_id': lead.partner_id and lead.partner_id.id or False,
|
||||
'section_id': lead.section_id and lead.section_id.id or False,
|
||||
'description': lead.description or False,
|
||||
'date_deadline': lead.date_deadline or False,
|
||||
'partner_address_id': lead.partner_address_id and lead.partner_address_id.id or False ,
|
||||
'priority': lead.priority,
|
||||
'phone': lead.phone,
|
||||
'email_from': lead.email_from
|
||||
})
|
||||
new_opportunity = opp_obj.browse(cr, uid, new_opportunity_id)
|
||||
vals = {
|
||||
'partner_id': this.partner_id and this.partner_id.id or False,
|
||||
}
|
||||
if not lead.opportunity_id:
|
||||
vals.update({'opportunity_id' : new_opportunity.id})
|
||||
|
||||
model_opportunity_id = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'crm.opportunity')], context=context)[0]
|
||||
|
||||
for model in ('crm.case.log', 'crm.case.history'):
|
||||
log_proxy = self.pool.get(model)
|
||||
log_ids = log_proxy.search(cr, uid, [('model_id.model', '=', 'crm.lead'),('res_id', '=', lead.id)], context=context)
|
||||
for log_id in log_ids:
|
||||
log_proxy.copy(cr, uid, log_id, {'model_id':model_opportunity_id}, context=context)
|
||||
|
||||
lead_obj.write(cr, uid, [lead.id], vals)
|
||||
lead_obj.case_close(cr, uid, [lead.id])
|
||||
|
||||
# Copy lead history to opportunity
|
||||
for his_id in lead.history_line:
|
||||
history_ids = history_obj.copy(cr, uid, his_id.id, \
|
||||
{'model_id': model_ids[0], \
|
||||
'res_id': new_opportunity_id})
|
||||
|
||||
#opp_obj.case_open(cr, uid, [new_opportunity_id])
|
||||
|
||||
value = {
|
||||
'name': _('Opportunity'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'crm.opportunity',
|
||||
'res_id': int(new_opportunity_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
|
||||
|
||||
_columns = {
|
||||
'name' : fields.char('Opportunity Summary', size=64, required=True, select=1),
|
||||
'probability': fields.float('Success Probability'),
|
||||
'planned_revenue': fields.float('Expected Revenue'),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner'),
|
||||
}
|
||||
|
||||
def view_init(self, cr, uid, fields, context=None):
|
||||
"""
|
||||
This function checks for precondition before wizard executes
|
||||
@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 fields: List of fields for default value
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
"""
|
||||
lead_obj = self.pool.get('crm.lead')
|
||||
|
||||
for lead in lead_obj.browse(cr, uid, context.get('active_ids', [])):
|
||||
if lead.state in ['done', 'cancel']:
|
||||
raise osv.except_osv(_("Warning !"), _("Closed/Cancelled \
|
||||
Leads Could not convert into Opportunity"))
|
||||
if lead.state != 'open':
|
||||
raise osv.except_osv(_('Warning !'), _('Lead should be in \
|
||||
\'Open\' state before converting to Opportunity.'))
|
||||
return False
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
"""
|
||||
This function gets default values
|
||||
@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 fields: List of fields for default value
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : default values of fields.
|
||||
"""
|
||||
lead_obj = self.pool.get('crm.lead')
|
||||
rec_ids = context and context.get('active_ids', [])
|
||||
partner_id = context.get('partner_id', False)
|
||||
data = context and context.get('active_ids', []) or []
|
||||
res = super(crm_lead2opportunity, self).default_get(cr, uid, fields, context=context)
|
||||
for lead in lead_obj.browse(cr, uid, data, context=context):
|
||||
if 'name' in fields:
|
||||
res.update({'name': lead.partner_name})
|
||||
if 'partner_id' in fields:
|
||||
res.update({'partner_id': partner_id and partner_id[0] or False})
|
||||
return res
|
||||
|
||||
crm_lead2opportunity()
|
||||
|
||||
|
||||
class crm_lead2opportunity_partner(osv.osv_memory):
|
||||
_name = 'crm.lead2opportunity.partner'
|
||||
_description = 'Lead To Opportunity Partner'
|
||||
_inherit = 'crm.lead2partner'
|
||||
|
||||
_columns = {
|
||||
'partner_id': fields.many2one('res.partner', 'Partner'),
|
||||
'action': fields.selection([('exist', 'Link to an existing partner'), ('create', 'Create a new partner')], 'Action'),
|
||||
}
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
"""
|
||||
This function gets default values
|
||||
@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 fields: List of fields for default value
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : default values of fields.
|
||||
"""
|
||||
lead_obj = self.pool.get('crm.lead')
|
||||
partner_obj = self.pool.get('res.partner')
|
||||
contact_obj = self.pool.get('res.partner.address')
|
||||
rec_ids = context and context.get('active_ids', [])
|
||||
partner_id = False
|
||||
|
||||
data = context and context.get('active_ids', []) or []
|
||||
res = super(crm_lead2opportunity_partner, self).default_get(cr, uid, fields, context=context)
|
||||
|
||||
for lead in lead_obj.browse(cr, uid, data, context=context):
|
||||
partner_ids = partner_obj.search(cr, uid, [('name', '=', lead.partner_name or lead.name)])
|
||||
if not partner_ids and lead.email_from:
|
||||
address_ids = contact_obj.search(cr, uid, [('email', '=', lead.email_from)])
|
||||
if address_ids:
|
||||
addresses = contact_obj.browse(cr, uid, address_ids)
|
||||
partner_ids = addresses and [addresses[0].partner_id.id] or False
|
||||
partner_id = partner_ids and partner_ids[0] or False
|
||||
|
||||
if 'partner_id' in fields:
|
||||
res.update({'partner_id': partner_id})
|
||||
if 'action' in fields:
|
||||
res.update({'action': partner_id and 'exist' or 'create'})
|
||||
return res
|
||||
|
||||
def make_partner(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
This function Makes partner based on action.
|
||||
@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 Lead to Partner's IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : Dictionary value for created Partner form.
|
||||
"""
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
partner_ids = self._create_partner(cr, uid, ids, context)
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
result = mod_obj._get_id(cr, uid, 'base', 'view_res_partner_filter')
|
||||
res = mod_obj.read(cr, uid, result, ['res_id'])
|
||||
value = {}
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
data_id = data_obj._get_id(cr, uid, 'crm', 'view_crm_lead2opportunity_create')
|
||||
view_id = False
|
||||
if data_id:
|
||||
view_id = data_obj.browse(cr, uid, data_id, context=context).res_id
|
||||
|
||||
context.update({'partner_id': partner_ids})
|
||||
value = {
|
||||
'name': _('Create Opportunity'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'crm.lead2opportunity',
|
||||
'view_id': False,
|
||||
'context': context,
|
||||
'views': [(view_id, 'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
}
|
||||
return value
|
||||
|
||||
def action_skip(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
This skips partner creation
|
||||
@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 Lead to Opportunity IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : Dictionary value for Opportunity form
|
||||
"""
|
||||
value = {}
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
data_id = data_obj._get_id(cr, uid, 'crm', 'view_crm_lead2opportunity_create')
|
||||
view_id = False
|
||||
if data_id:
|
||||
view_id = data_obj.browse(cr, uid, data_id, context=context).res_id
|
||||
|
||||
context.update({'partner_id': False})
|
||||
value = {
|
||||
'name': _('Create Opportunity'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'crm.lead2opportunity',
|
||||
'view_id': False,
|
||||
'context': context,
|
||||
'views': [(view_id, 'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
}
|
||||
return value
|
||||
|
||||
|
||||
def view_init(self, cr, uid, fields, context=None):
|
||||
"""
|
||||
This function checks for precondition before wizard executes
|
||||
@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 fields: List of fields for default value
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
"""
|
||||
lead_obj = self.pool.get('crm.lead')
|
||||
|
||||
for lead in lead_obj.browse(cr, uid, context.get('active_ids', [])):
|
||||
if lead.state in ['done', 'cancel']:
|
||||
raise osv.except_osv(_("Warning !"), _("Closed/Cancelled \
|
||||
Leads Could not convert into Opportunity"))
|
||||
if lead.state != 'open':
|
||||
raise osv.except_osv(_('Warning !'), _('Lead should be in \
|
||||
\'Open\' state before converting to Opportunity.'))
|
||||
return False
|
||||
|
||||
crm_lead2opportunity_partner()
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,63 @@
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Lead to Opportunity view -->
|
||||
|
||||
<record id="view_crm_lead2opportunity_create" model="ir.ui.view">
|
||||
<field name="name">crm.lead2opportunity.create</field>
|
||||
<field name="model">crm.lead2opportunity</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Convert To Opportunity">
|
||||
<field name="name"/>
|
||||
<field name="partner_id"/>
|
||||
<newline/>
|
||||
<field name="planned_revenue"/>
|
||||
<field name="probability"/>
|
||||
<separator colspan="4"/>
|
||||
<group col="4" colspan="4">
|
||||
<label string="" colspan="2"/>
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="action_apply" string="Create Opportunity" type="object" icon="gtk-ok"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Lead to Opportunity action -->
|
||||
|
||||
<record id="action_crm_lead2opportunity" model="ir.actions.act_window">
|
||||
<field name="name">Create Opportunity</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">crm.lead2opportunity</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="view_crm_lead2opportunity_partner" model="ir.ui.view">
|
||||
<field name="name">crm.lead2opportunity.partner.form</field>
|
||||
<field name="model">crm.lead2opportunity.partner</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Create a Partner">
|
||||
<label string="Are you sure you want to create a partner based on this lead ?" colspan="4"/>
|
||||
<label string="You may have to verify that this partner does not exist already." colspan="4"/>
|
||||
<newline />
|
||||
<field name="action"/>
|
||||
<group attrs="{'invisible':[('action','!=','exist')]}">
|
||||
<field name="partner_id" attrs="{'required': [('action', '=', 'exist')]}"/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group col="4" colspan="4">
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button special="cancel" name="action_skip" string="_Skip" type="object" icon="gtk-goto-last"/>
|
||||
<button name="make_partner" string="Continue" type="object" icon="gtk-ok"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,216 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
|
||||
class crm_lead2partner(osv.osv_memory):
|
||||
""" Converts lead to partner """
|
||||
|
||||
_name = 'crm.lead2partner'
|
||||
_description = 'Lead to Partner'
|
||||
|
||||
_columns = {
|
||||
'action': fields.selection([('exist', 'Link to an existing partner'), \
|
||||
('create', 'Create a new partner')], \
|
||||
'Action', required=True),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner')
|
||||
}
|
||||
|
||||
def view_init(self, cr, uid, fields, context=None):
|
||||
"""
|
||||
This function checks for precondition before wizard executes
|
||||
@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 fields: List of fields for default value
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
"""
|
||||
|
||||
lead_obj = self.pool.get('crm.lead')
|
||||
rec_ids = context and context.get('active_ids', [])
|
||||
for lead in lead_obj.browse(cr, uid, rec_ids, context=context):
|
||||
if lead.partner_id:
|
||||
raise osv.except_osv(_('Warning !'),
|
||||
_('A partner is already defined on this lead.'))
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
"""
|
||||
This function gets default values
|
||||
@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 fields: List of fields for default value
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : default values of fields.
|
||||
"""
|
||||
lead_obj = self.pool.get('crm.lead')
|
||||
partner_obj = self.pool.get('res.partner')
|
||||
contact_obj = self.pool.get('res.partner.address')
|
||||
rec_ids = context and context.get('active_ids', [])
|
||||
partner_id = False
|
||||
|
||||
data = context and context.get('active_ids', []) or []
|
||||
res = super(crm_lead2partner, self).default_get(cr, uid, fields, context=context)
|
||||
|
||||
for lead in lead_obj.browse(cr, uid, data, context=context):
|
||||
partner_ids = partner_obj.search(cr, uid, [('name', '=', lead.partner_name or lead.name)])
|
||||
if not partner_ids and lead.email_from:
|
||||
address_ids = contact_obj.search(cr, uid, [('email', '=', lead.email_from)])
|
||||
if address_ids:
|
||||
addresses = contact_obj.browse(cr, uid, address_ids)
|
||||
partner_ids = addresses and [addresses[0].partner_id.id] or False
|
||||
partner_id = partner_ids and partner_ids[0] or False
|
||||
|
||||
if 'partner_id' in fields:
|
||||
res.update({'partner_id': partner_id})
|
||||
if 'action' in fields:
|
||||
res.update({'action': partner_id and 'exist' or 'create'})
|
||||
return res
|
||||
|
||||
def open_create_partner(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
This function Opens form of create partner.
|
||||
@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 Lead to Partner's IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : Dictionary value for next form.
|
||||
"""
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
view_obj = self.pool.get('ir.ui.view')
|
||||
view_id = view_obj.search(cr, uid, [('model', '=', 'crm.lead2partner'), \
|
||||
('name', '=', 'crm.lead2partner.view')])
|
||||
return {
|
||||
'view_mode': 'form',
|
||||
'view_type': 'form',
|
||||
'view_id': view_id or False,
|
||||
'res_model': 'crm.lead2partner',
|
||||
'context': context,
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
}
|
||||
|
||||
|
||||
def _create_partner(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
This function Creates partner based on action.
|
||||
@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 Lead to Partner's IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : Dictionary {}.
|
||||
"""
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
lead_obj = self.pool.get('crm.lead')
|
||||
partner_obj = self.pool.get('res.partner')
|
||||
contact_obj = self.pool.get('res.partner.address')
|
||||
partner_ids = []
|
||||
partner_id = False
|
||||
contact_id = False
|
||||
rec_ids = context and context.get('active_ids', [])
|
||||
|
||||
for data in self.browse(cr, uid, ids):
|
||||
for lead in lead_obj.browse(cr, uid, rec_ids):
|
||||
if data.action == 'create':
|
||||
partner_id = partner_obj.create(cr, uid, {
|
||||
'name': lead.partner_name or lead.name,
|
||||
'user_id': lead.user_id.id,
|
||||
'comment': lead.description,
|
||||
})
|
||||
function_id = self.pool.get('res.partner.function').search(cr,uid,[('name','=',lead.function_name)])
|
||||
contact_id = contact_obj.create(cr, uid, {
|
||||
'partner_id': partner_id,
|
||||
'name': lead.name,
|
||||
'phone': lead.phone,
|
||||
'mobile': lead.mobile,
|
||||
'email': lead.email_from,
|
||||
'fax': lead.fax,
|
||||
'title': lead.title,
|
||||
'function': function_id and function_id[0] or False,
|
||||
'street': lead.street,
|
||||
'street2': lead.street2,
|
||||
'zip': lead.zip,
|
||||
'city': lead.city,
|
||||
'country_id': lead.country_id and lead.country_id.id or False,
|
||||
'state_id': lead.state_id and lead.state_id.id or False,
|
||||
})
|
||||
|
||||
else:
|
||||
if data.partner_id:
|
||||
partner_id = data.partner_id.id
|
||||
contact_id = partner_obj.address_get(cr, uid, [partner_id])['default']
|
||||
|
||||
partner_ids.append(partner_id)
|
||||
|
||||
vals = {}
|
||||
if partner_id:
|
||||
vals.update({'partner_id': partner_id})
|
||||
if contact_id:
|
||||
vals.update({'partner_address_id': contact_id})
|
||||
lead_obj.write(cr, uid, [lead.id], vals)
|
||||
return partner_ids
|
||||
|
||||
def make_partner(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
This function Makes partner based on action.
|
||||
@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 Lead to Partner's IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : Dictionary value for created Partner form.
|
||||
"""
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
partner_ids = self._create_partner(cr, uid, ids, context)
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
result = mod_obj._get_id(cr, uid, 'base', 'view_res_partner_filter')
|
||||
res = mod_obj.read(cr, uid, result, ['res_id'])
|
||||
|
||||
value = {
|
||||
'domain': "[]",
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'res.partner',
|
||||
'res_id': partner_ids and int(partner_ids[0]) or False,
|
||||
'view_id': False,
|
||||
'context': context,
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': res['res_id']
|
||||
}
|
||||
return value
|
||||
|
||||
crm_lead2partner()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,53 @@
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Lead to partner confirmation form -->
|
||||
|
||||
<record id="view_crm_lead2partner_create" model="ir.ui.view">
|
||||
<field name="name">crm.lead2partner.view.create</field>
|
||||
<field name="model">crm.lead2partner</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Create a Partner?">
|
||||
<label string="Are you sure you want to create a partner based on this lead ?" colspan="4"/>
|
||||
<label string="You may have to verify that this partner does not exist already." colspan="4"/>
|
||||
<separator string="" colspan="4" />
|
||||
<group col="4" colspan="4">
|
||||
<button special="cancel" string="_Cancel" icon="gtk-cancel"/>
|
||||
<button name="open_create_partner" string="Create _Partner" type="object" icon="gtk-ok"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Lead to Partner form view -->
|
||||
|
||||
<record id="view_crm_lead2partner" model="ir.ui.view">
|
||||
<field name="name">crm.lead2partner.view</field>
|
||||
<field name="model">crm.lead2partner</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Create a Partner">
|
||||
<field name="action"/>
|
||||
<group attrs="{'invisible':[('action','!=','exist')]}">
|
||||
<field name="partner_id" attrs="{'required': [('action', '=', 'exist')]}"/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group col="4" colspan="4">
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="make_partner" string="Continue" type="object" icon="gtk-ok"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Lead to Partner wizard -->
|
||||
|
||||
<act_window id="action_crm_lead2partner"
|
||||
key2="client_action_multi" name="Create a Partner"
|
||||
res_model="crm.lead2partner" src_model="crm.lead"
|
||||
view_id="view_crm_lead2partner_create"
|
||||
view_mode="form" target="new" view_type="form" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,139 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
|
||||
class crm_opportunity2phonecall(osv.osv_memory):
|
||||
"""Converts Opportunity to Phonecall"""
|
||||
|
||||
_name = 'crm.opportunity2phonecall'
|
||||
_description = 'Opportunity to Phonecall'
|
||||
|
||||
_columns = {
|
||||
'name' : fields.char('Call summary', size=64, required=True, select=1),
|
||||
'user_id' : fields.many2one('res.users', "Assign To"),
|
||||
'date': fields.datetime('Date' , required=True),
|
||||
'section_id': fields.many2one('crm.case.section', 'Sales Team'),
|
||||
}
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
"""
|
||||
This function gets default values
|
||||
@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 fields: List of fields for default value
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : default values of fields.
|
||||
"""
|
||||
|
||||
opp_obj = self.pool.get('crm.opportunity')
|
||||
record_ids = context and context.get('active_ids', []) or []
|
||||
res = super(crm_opportunity2phonecall, self).default_get(cr, uid, fields, context=context)
|
||||
for opp in opp_obj.browse(cr, uid, record_ids, context=context):
|
||||
if 'name' in fields:
|
||||
res.update({'name': opp.name})
|
||||
if 'user_id' in fields:
|
||||
res.update({'user_id': opp.user_id and opp.user_id.id or False})
|
||||
if 'section_id' in fields:
|
||||
res.update({'section_id': opp.section_id and opp.section_id.id or False})
|
||||
return res
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Closes Opportunity to Phonecall form
|
||||
@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 Opportunity to Phonecall's IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
def action_apply(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
This converts Opportunity to Phonecall and opens Phonecall view
|
||||
@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 Opportunity to Phonecall IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : Dictionary value for created Opportunity form
|
||||
"""
|
||||
value = {}
|
||||
record_ids = context and context.get('active_ids', []) or []
|
||||
|
||||
phonecall_obj = self.pool.get('crm.phonecall')
|
||||
opp_obj = self.pool.get('crm.opportunity')
|
||||
mod_obj = self.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'])
|
||||
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
categ_id = mod_obj._get_id(cr, uid, 'crm', 'categ_phone1')
|
||||
categ_id = data_obj.browse(cr, uid, categ_id, context=context).res_id
|
||||
|
||||
# Select the view
|
||||
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
|
||||
|
||||
for this in self.browse(cr, uid, ids, context=context):
|
||||
for opp in opp_obj.browse(cr, uid, record_ids, context=context):
|
||||
new_case = phonecall_obj.create(cr, uid, {
|
||||
'name' : opp.name,
|
||||
'case_id' : opp.id ,
|
||||
'user_id' : this.user_id and this.user_id.id or False,
|
||||
'categ_id' : categ_id,
|
||||
'description' : opp.description or False,
|
||||
'date' : this.date,
|
||||
'section_id' : opp.section_id and opp.section_id.id or False,
|
||||
'partner_id': opp.partner_id and opp.partner_id.id or False,
|
||||
'partner_address_id': opp.partner_address_id and opp.partner_address_id.id or False,
|
||||
'partner_phone' : opp.phone or (opp.partner_address_id and opp.partner_address_id.phone or False),
|
||||
'partner_mobile' : opp.partner_address_id and opp.partner_address_id.mobile or False,
|
||||
'priority': opp.priority,
|
||||
'opp_id': opp.id
|
||||
}, context=context)
|
||||
|
||||
phonecall_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
|
||||
|
||||
crm_opportunity2phonecall()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Opportunity to Phonecall view -->
|
||||
|
||||
<record model="ir.ui.view" id="opportunity2phonecall_view">
|
||||
<field name="name">crm.opportunity2phonecall.form</field>
|
||||
<field name="model">crm.opportunity2phonecall</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Schedule Other Call">
|
||||
<group colspan="2" >
|
||||
<field name="name"/>
|
||||
<field name="date" string="Planned Date"/>
|
||||
<newline/>
|
||||
<field name="user_id" />
|
||||
<field name="section_id"/>
|
||||
<label string ="" colspan="2"/>
|
||||
<button name="action_cancel" string="_Cancel"
|
||||
icon="gtk-cancel" special="cancel" />
|
||||
<button name="action_apply" type="object"
|
||||
string="_Schedule Call" icon="gtk-ok" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Opportunity to Phonecall action -->
|
||||
|
||||
<record model="ir.actions.act_window" id="opportunity2phonecall_act">
|
||||
<field name="name">Schedule Call</field>
|
||||
<field name="res_model">crm.opportunity2phonecall</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="opportunity2phonecall_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -76,8 +76,7 @@ class crm_send_new_email(osv.osv_memory):
|
||||
|
||||
case = case_pool.browse(cr, uid, res_id)
|
||||
if context.get('mail', 'new') == 'new':
|
||||
if case.history_line:
|
||||
message_id = case.history_line[0].message_id
|
||||
message_id = res_id
|
||||
else:
|
||||
hist = hist_obj.browse(cr, uid, res_id)
|
||||
message_id = hist.message_id
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import crm_claim
|
||||
import report
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
{
|
||||
'name': 'Customer & Supplier Relationship Management',
|
||||
'version': '1.0',
|
||||
'category': 'Generic Modules/CRM & SRM',
|
||||
'description': """Claims""",
|
||||
'author': 'Tiny',
|
||||
'website': 'http://www.openerp.com',
|
||||
'depends': ['crm'],
|
||||
'init_xml': [
|
||||
'crm_claims_data.xml',
|
||||
],
|
||||
|
||||
'update_xml': [
|
||||
'crm_claims_view.xml',
|
||||
'crm_claims_menu.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'report/crm_claim_report_view.xml',
|
||||
],
|
||||
'demo_xml': [
|
||||
'crm_claims_demo.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -20,7 +20,7 @@
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
import crm
|
||||
from crm import crm
|
||||
|
||||
class crm_claim(osv.osv):
|
||||
"""
|
||||
@@ -70,4 +70,4 @@ class crm_claim(osv.osv):
|
||||
|
||||
crm_claim()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -8,19 +8,19 @@
|
||||
|
||||
<record model="crm.case.categ" id="categ_claim1">
|
||||
<field name="name">Factual Claims</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
<record model="crm.case.categ" id="categ_claim2">
|
||||
<field name="name">Value Claims</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
<record model="crm.case.categ" id="categ_claim3">
|
||||
<field name="name">Policy Claims</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
@@ -30,13 +30,13 @@
|
||||
|
||||
<record model="crm.case.resource.type" id="type_claim1">
|
||||
<field name="name">Corrective</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
<record model="crm.case.resource.type" id="type_claim2">
|
||||
<field name="name">Preventive</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
@@ -46,33 +46,33 @@
|
||||
|
||||
<record model="crm.case.stage" id="stage_claim1">
|
||||
<field name="name">Accepted as Claim</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
<record model="crm.case.stage" id="stage_claim2">
|
||||
<field name="name">Fixed</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
<record model="crm.case.stage" id="stage_claim3">
|
||||
<field name="name">Won't fix</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
<record model="crm.case.stage" id="stage_claim4">
|
||||
<field name="name">Invalid</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
<record model="crm.case.stage" id="stage_claim5">
|
||||
<field name="name">Awaiting Response</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</openerp>
|
||||
@@ -9,7 +9,7 @@
|
||||
<record id="crm_case_claim01" model="crm.claim">
|
||||
<field name="partner_address_id" ref="base.res_partner_address_15"/>
|
||||
<field eval="time.strftime('%Y-%m-04 10:45:36')" name="date"/>
|
||||
<field name="type_id" ref="crm.type_claim1"/>
|
||||
<field name="type_id" ref="crm_claim.type_claim1"/>
|
||||
<field name="partner_id" ref="base.res_partner_11"/>
|
||||
<field eval=""3"" name="priority"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
@@ -18,15 +18,15 @@
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval=""(726) 782-0636"" name="partner_mobile"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="categ_id" ref="crm.categ_claim1"/>
|
||||
<field name="stage_id" ref="crm.stage_claim1"/>
|
||||
<field name="categ_id" ref="crm_claim.categ_claim1"/>
|
||||
<field name="stage_id" ref="crm_claim.stage_claim1"/>
|
||||
<field eval=""(769) 703-274"" name="partner_phone"/>
|
||||
</record>
|
||||
|
||||
<record id="crm_case_claim02" model="crm.claim">
|
||||
<field name="partner_address_id" ref="base.res_partner_address_6"/>
|
||||
<field eval="time.strftime('%Y-%m-11 11:19:25')" name="date"/>
|
||||
<field name="type_id" ref="crm.type_claim2"/>
|
||||
<field name="type_id" ref="crm_claim.type_claim2"/>
|
||||
<field name="partner_id" ref="base.res_partner_6"/>
|
||||
<field eval=""4"" name="priority"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
@@ -35,15 +35,15 @@
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval=""(392) 895-7917"" name="partner_mobile"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="categ_id" ref="crm.categ_claim2"/>
|
||||
<field name="stage_id" ref="crm.stage_claim5"/>
|
||||
<field name="categ_id" ref="crm_claim.categ_claim2"/>
|
||||
<field name="stage_id" ref="crm_claim.stage_claim5"/>
|
||||
<field eval=""(956) 293-2595"" name="partner_phone"/>
|
||||
</record>
|
||||
|
||||
<record id="crm_case_claim03" model="crm.claim">
|
||||
<field name="partner_address_id" ref="base.res_partner_address_2"/>
|
||||
<field eval="time.strftime('%Y-%m-15 17:44:12')" name="date"/>
|
||||
<field name="type_id" ref="crm.type_claim1"/>
|
||||
<field name="type_id" ref="crm_claim.type_claim1"/>
|
||||
<field name="partner_id" ref="base.res_partner_10"/>
|
||||
<field eval=""2"" name="priority"/>
|
||||
<field name="user_id" ref="base.user_demo"/>
|
||||
@@ -52,15 +52,15 @@
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval=""(820) 167-3208"" name="partner_mobile"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="categ_id" ref="crm.categ_claim3"/>
|
||||
<field name="stage_id" ref="crm.stage_claim2"/>
|
||||
<field name="categ_id" ref="crm_claim.categ_claim3"/>
|
||||
<field name="stage_id" ref="crm_claim.stage_claim2"/>
|
||||
<field eval=""(079) 681-2139"" name="partner_phone"/>
|
||||
<field eval=""contact@tecsas.fr"" name="email_from"/>
|
||||
</record>
|
||||
|
||||
<record id="crm_case_claim04" model="crm.claim">
|
||||
<field eval="time.strftime('%Y-%m-21 14:10:23')" name="date"/>
|
||||
<field name="type_id" ref="crm.type_claim2"/>
|
||||
<field name="type_id" ref="crm_claim.type_claim2"/>
|
||||
<field name="partner_id" ref="base.res_partner_tinyatwork"/>
|
||||
<field eval=""3"" name="priority"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
@@ -69,15 +69,15 @@
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval=""(077) 582-4035"" name="partner_mobile"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="categ_id" ref="crm.categ_claim1"/>
|
||||
<field name="stage_id" ref="crm.stage_claim5"/>
|
||||
<field name="categ_id" ref="crm_claim.categ_claim1"/>
|
||||
<field name="stage_id" ref="crm_claim.stage_claim5"/>
|
||||
<field eval=""(514) 698-4118"" name="partner_phone"/>
|
||||
</record>
|
||||
|
||||
<record id="crm_case_claim05" model="crm.claim">
|
||||
<field name="partner_address_id" ref="base.res_partner_address_10"/>
|
||||
<field eval="time.strftime('%Y-%m-28 16:20:43')" name="date"/>
|
||||
<field name="type_id" ref="crm.type_claim1"/>
|
||||
<field name="type_id" ref="crm_claim.type_claim1"/>
|
||||
<field name="partner_id" ref="base.res_partner_5"/>
|
||||
<field eval=""3"" name="priority"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
@@ -86,15 +86,15 @@
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval=""(333) 715-1450"" name="partner_mobile"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="categ_id" ref="crm.categ_claim3"/>
|
||||
<field name="stage_id" ref="crm.stage_claim3"/>
|
||||
<field name="categ_id" ref="crm_claim.categ_claim3"/>
|
||||
<field name="stage_id" ref="crm_claim.stage_claim3"/>
|
||||
<field eval=""(855) 924-4364"" name="partner_phone"/>
|
||||
</record>
|
||||
|
||||
<record id="crm_case_claim06" model="crm.claim">
|
||||
<field name="partner_address_id" ref="base.res_partner_address_1"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field name="type_id" ref="crm.type_claim2"/>
|
||||
<field name="type_id" ref="crm_claim.type_claim2"/>
|
||||
<field name="partner_id" ref="base.res_partner_9"/>
|
||||
<field eval=""3"" name="priority"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
@@ -103,15 +103,15 @@
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval=""(468) 017-2684"" name="partner_mobile"/>
|
||||
<field eval="time.strftime('%Y-%m-28 14:15:30')" name="date"/>
|
||||
<field name="categ_id" ref="crm.categ_claim1"/>
|
||||
<field name="stage_id" ref="crm.stage_claim4"/>
|
||||
<field name="categ_id" ref="crm_claim.categ_claim1"/>
|
||||
<field name="stage_id" ref="crm_claim.stage_claim4"/>
|
||||
<field eval=""(373) 907-1009"" name="partner_phone"/>
|
||||
<field eval=""info@opensides.be"" name="email_from"/>
|
||||
</record>
|
||||
|
||||
<record id="crm_case_claims07" model="crm.claim">
|
||||
<field eval="1" name="active"/>
|
||||
<field name="type_id" ref="crm.type_claim1"/>
|
||||
<field name="type_id" ref="crm_claim.type_claim1"/>
|
||||
<field name="partner_id" ref="base.res_partner_seagate"/>
|
||||
<field eval=""3"" name="priority"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
@@ -120,8 +120,8 @@
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval="" (463) 014-1208"" name="partner_mobile"/>
|
||||
<field eval="time.strftime('%Y-%m-19 13:01:05')" name="date"/>
|
||||
<field name="categ_id" ref="crm.categ_claim3"/>
|
||||
<field name="stage_id" ref="crm.stage_claim2"/>
|
||||
<field name="categ_id" ref="crm_claim.categ_claim3"/>
|
||||
<field name="stage_id" ref="crm_claim.stage_claim2"/>
|
||||
<field eval=""(282) 603-7489"" name="partner_phone"/>
|
||||
</record>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<field name="view_mode">tree,calendar,form,graph</field>
|
||||
<field name="view_id" ref="crm_case_claims_tree_view"/>
|
||||
<field name="context">{"search_default_section_id":section_id,"search_default_current":1,"search_default_my_claims":1}</field>
|
||||
<field name="search_view_id" ref="crm.view_crm_case_claims_filter"/>
|
||||
<field name="search_view_id" ref="crm_claim.view_crm_case_claims_filter"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_claim0">
|
||||
@@ -184,7 +184,7 @@
|
||||
<field name="description" colspan="4" nolabel="1"/>
|
||||
<button colspan="4"
|
||||
string="Reply to Last Email"
|
||||
name="%(action_crm_send_mail)d"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'crm.claim'}"
|
||||
icon="gtk-undo" type="action" />
|
||||
</form>
|
||||
@@ -195,7 +195,7 @@
|
||||
</tree>
|
||||
</field>
|
||||
<button colspan="4" string="Send New Email"
|
||||
name="%(action_crm_send_mail)d"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'new', 'model': 'crm.claim'}"
|
||||
icon="gtk-go-forward" type="action" />
|
||||
</page>
|
||||
@@ -0,0 +1,25 @@
|
||||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import crm_claim_report
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
from osv import fields,osv
|
||||
import tools
|
||||
import crm_report
|
||||
from crm.report import crm_report
|
||||
|
||||
|
||||
class crm_claim_report(osv.osv):
|
||||
+2
-2
@@ -33,7 +33,7 @@
|
||||
<record id="view_report_crm_claim_form" model="ir.ui.view">
|
||||
<field name="name">crm.claim.report.form</field>
|
||||
<field name="model">crm.claim.report</field>
|
||||
<field name="inherit_id" ref="view_crm_case_form"/>
|
||||
<field name="inherit_id" ref="crm.view_crm_case_form"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="nbr" position="after">
|
||||
@@ -66,7 +66,7 @@
|
||||
<record id="view_report_crm_claim_filter" model="ir.ui.view">
|
||||
<field name="name">crm.claim.report.select</field>
|
||||
<field name="model">crm.claim.report</field>
|
||||
<field name="inherit_id" ref="view_crm_case_filter"/>
|
||||
<field name="inherit_id" ref="crm.view_crm_case_filter"/>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
@@ -0,0 +1,3 @@
|
||||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_crm_claim","crm.claim","model_crm_claim","crm.group_crm_manager",1,1,1,1
|
||||
"access_crm_claim_report_user","crm.claim.report","model_crm_claim_report","crm.group_crm_user",1,0,0,0
|
||||
|
@@ -0,0 +1,26 @@
|
||||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import crm_fundraising
|
||||
import report
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
{
|
||||
'name': 'CRM Fundraising',
|
||||
'version': '1.0',
|
||||
'category': 'Generic Modules/CRM & SRM',
|
||||
'description': """Fundraising""",
|
||||
'author': 'Tiny',
|
||||
'website': 'http://www.openerp.com',
|
||||
'depends': ['crm'],
|
||||
'init_xml': [
|
||||
'crm_fundraising_data.xml',
|
||||
],
|
||||
|
||||
'update_xml': [
|
||||
'crm_fundraising_view.xml',
|
||||
'crm_fundraising_menu.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'report/crm_fundraising_report_view.xml',
|
||||
],
|
||||
'demo_xml': [
|
||||
'crm_fundraising_demo.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -20,7 +20,7 @@
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv, orm
|
||||
import crm
|
||||
from crm import crm
|
||||
|
||||
class crm_fundraising(osv.osv):
|
||||
""" Fund Raising Cases """
|
||||
@@ -6,25 +6,25 @@
|
||||
|
||||
<record model="crm.case.categ" id="categ_fund1">
|
||||
<field name="name">Social Rehabilitation And Rural Upliftment</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
<record model="crm.case.categ" id="categ_fund2">
|
||||
<field name="name">Learning And Education</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
<record model="crm.case.categ" id="categ_fund3">
|
||||
<field name="name">Healthcare</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
<record model="crm.case.categ" id="categ_fund4">
|
||||
<field name="name">Arts And Culture</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
@@ -32,25 +32,25 @@
|
||||
|
||||
<record model="crm.case.resource.type" id="type_fund1">
|
||||
<field name="name">Cash</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
<record model="crm.case.resource.type" id="type_fund2">
|
||||
<field name="name">Cheque</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
<record model="crm.case.resource.type" id="type_fund3">
|
||||
<field name="name">Credit Card</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
<record model="crm.case.resource.type" id="type_fund4">
|
||||
<field name="name">Demand Draft</field>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<field name="user_id" ref="base.user_demo"/>
|
||||
<field eval=""open"" name="state"/>
|
||||
<field eval="250000.0" name="planned_cost"/>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval="time.strftime('%Y-%m-01 10:35:50')" name="date"/>
|
||||
<field name="categ_id" ref="categ_fund1"/>
|
||||
<field eval=""Helping Street Children"" name="name"/>
|
||||
@@ -30,7 +30,7 @@
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field eval=""draft"" name="state"/>
|
||||
<field eval="2000000.0" name="planned_cost"/>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval="time.strftime('%Y-%m-05 12:35:50')" name="date"/>
|
||||
<field eval="8.0" name="duration"/>
|
||||
<field name="categ_id" ref="categ_fund1"/>
|
||||
@@ -48,7 +48,7 @@
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field eval=""open"" name="state"/>
|
||||
<field eval="500000.0" name="planned_cost"/>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval="time.strftime('%Y-%m-07 13:50:50')" name="date"/>
|
||||
<field name="categ_id" ref="categ_fund2"/>
|
||||
<field eval=""Donating books to school libraries"" name="name"/>
|
||||
@@ -65,7 +65,7 @@
|
||||
<field name="user_id" ref="base.user_demo"/>
|
||||
<field eval=""draft"" name="state"/>
|
||||
<field eval="1000000.0" name="planned_cost"/>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval="time.strftime('%Y-%m-12 15:10:50')" name="date"/>
|
||||
<field name="categ_id" ref="categ_fund2"/>
|
||||
<field eval="4.3" name="duration"/>
|
||||
@@ -82,7 +82,7 @@
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field eval=""open"" name="state"/>
|
||||
<field eval="5000000.0" name="planned_cost"/>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval="time.strftime('%Y-%m-17 19:00:15')" name="date"/>
|
||||
<field eval="3" name="duration"/>
|
||||
<field name="categ_id" ref="categ_fund3"/>
|
||||
@@ -99,7 +99,7 @@
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field eval=""done"" name="state"/>
|
||||
<field eval="10000000.0" name="planned_cost"/>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval="time.strftime('%Y-%m-27 09:00:15')" name="date"/>
|
||||
<field eval="12" name="duration"/>
|
||||
<field name="categ_id" ref="categ_fund3"/>
|
||||
@@ -118,7 +118,7 @@
|
||||
<field name="user_id" ref="base.user_demo"/>
|
||||
<field eval=""draft"" name="state"/>
|
||||
<field eval="10000.0" name="planned_cost"/>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval="time.strftime('%Y-%m-01 10:00:15')" name="date"/>
|
||||
<field name="categ_id" ref="categ_fund4"/>
|
||||
<field eval=""Encouraging arts"" name="name"/>
|
||||
@@ -136,7 +136,7 @@
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field eval=""open"" name="state"/>
|
||||
<field eval="800000.0" name="planned_cost"/>
|
||||
<field name="section_id" ref="section_sales_department"/>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field eval="time.strftime('%Y-%m-24 22:00:15')" name="date"/>
|
||||
<field name="categ_id" ref="categ_fund4"/>
|
||||
<field eval=""Promoting cultural programs and preserving dying art forms"" name="name"/>
|
||||
@@ -12,29 +12,29 @@
|
||||
<field name="name">Funds</field>
|
||||
<field name="res_model">crm.fundraising</field>
|
||||
<field name="view_mode">tree,form,graph</field>
|
||||
<field name="view_id" ref="crm.crm_case_tree_view_fund"/>
|
||||
<field name="search_view_id" ref="crm.view_crm_case_fund_filter"/>
|
||||
<field name="view_id" ref="crm_fundraising.crm_case_tree_view_fund"/>
|
||||
<field name="search_view_id" ref="crm_fundraising.view_crm_case_fund_filter"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_view_fund_all1">
|
||||
<field name="sequence" eval="1"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="crm.crm_case_tree_view_fund"/>
|
||||
<field name="act_window_id" ref="crm_case_category_act_fund_all1"/>
|
||||
<field name="view_id" ref="crm_fundraising.crm_case_tree_view_fund"/>
|
||||
<field name="act_window_id" ref="crm_fundraising.crm_case_category_act_fund_all1"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_form_view_fund_all1">
|
||||
<field name="sequence" eval="2"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="crm.crm_case_form_view_fund"/>
|
||||
<field name="act_window_id" ref="crm_case_category_act_fund_all1"/>
|
||||
<field name="view_id" ref="crm_fundraising.crm_case_form_view_fund"/>
|
||||
<field name="act_window_id" ref="crm_fundraising.crm_case_category_act_fund_all1"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_crm_tag_graph_view_fund_all1">
|
||||
<field name="sequence" eval="3"/>
|
||||
<field name="view_mode">graph</field>
|
||||
<field name="view_id" ref="crm.crm_case_graph_view_fund"/>
|
||||
<field name="act_window_id" ref="crm_case_category_act_fund_all1"/>
|
||||
<field name="view_id" ref="crm_fundraising.crm_case_graph_view_fund"/>
|
||||
<field name="act_window_id" ref="crm_fundraising.crm_case_category_act_fund_all1"/>
|
||||
</record>
|
||||
|
||||
<menuitem name="Fund Raising" id="menu_crm_case_fund_raise"
|
||||
@@ -197,7 +197,7 @@
|
||||
<field name="description" colspan="4" nolabel="1"/>
|
||||
<button colspan="4"
|
||||
string="Reply to Last Email"
|
||||
name="%(action_crm_send_mail)d"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'crm.fundraising'}"
|
||||
icon="gtk-undo" type="action" />
|
||||
</form>
|
||||
@@ -208,7 +208,7 @@
|
||||
</tree>
|
||||
</field>
|
||||
<button colspan="4" string="Send New Email"
|
||||
name="%(action_crm_send_mail)d"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'new', 'model': 'crm.fundraising'}"
|
||||
icon="gtk-go-forward" type="action" />
|
||||
</page>
|
||||
@@ -0,0 +1,25 @@
|
||||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import crm_fundraising_report
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@
|
||||
<record id="view_report_crm_fundraising_form" model="ir.ui.view">
|
||||
<field name="name">crm.fundraising.report.form</field>
|
||||
<field name="model">crm.fundraising.report</field>
|
||||
<field name="inherit_id" ref="view_crm_case_form"/>
|
||||
<field name="inherit_id" ref="crm.view_crm_case_form"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="nbr" position="after">
|
||||
@@ -65,7 +65,7 @@
|
||||
<record id="view_report_crm_fundraising_filter" model="ir.ui.view">
|
||||
<field name="name">crm.fundraising.report.select</field>
|
||||
<field name="model">crm.fundraising.report</field>
|
||||
<field name="inherit_id" ref="view_crm_case_filter"/>
|
||||
<field name="inherit_id" ref="crm.view_crm_case_filter"/>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
@@ -0,0 +1,3 @@
|
||||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_crm_fundraising","crm.fundraising","model_crm_fundraising","crm.group_crm_manager",1,1,1,1
|
||||
"access_crm_fundraising_report_user","crm.fundraising.report","model_crm_fundraising_report","crm.group_crm_user",1,0,0,0
|
||||
|
@@ -0,0 +1,26 @@
|
||||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import crm_helpdesk
|
||||
import report
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
{
|
||||
'name': 'CRM Helpdesk',
|
||||
'version': '1.0',
|
||||
'category': 'Generic Modules/CRM & SRM',
|
||||
'description': """Helpdesk Management""",
|
||||
'author': 'Tiny',
|
||||
'website': 'http://www.openerp.com',
|
||||
'depends': ['crm'],
|
||||
'init_xml': [
|
||||
'crm_helpdesk_data.xml',
|
||||
],
|
||||
|
||||
'update_xml': [
|
||||
'crm_helpdesk_view.xml',
|
||||
'crm_helpdesk_menu.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'report/crm_helpdesk_report_view.xml',
|
||||
],
|
||||
'demo_xml': [
|
||||
'crm_helpdesk_demo.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -22,7 +22,7 @@
|
||||
from osv import fields
|
||||
from osv import orm
|
||||
from osv import osv
|
||||
import crm
|
||||
from crm import crm
|
||||
|
||||
class crm_helpdesk(osv.osv):
|
||||
""" Helpdesk Cases """
|
||||
@@ -11,7 +11,7 @@
|
||||
<field name="res_model">crm.helpdesk</field>
|
||||
<field name="view_mode">tree,calendar,form</field>
|
||||
<field name="view_id" ref="crm_case_tree_view_helpdesk"/>
|
||||
<field name="search_view_id" ref="crm.view_crm_case_helpdesk_filter"/>
|
||||
<field name="search_view_id" ref="view_crm_case_helpdesk_filter"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_crm_sec_tree_view_act111">
|
||||
@@ -127,7 +127,7 @@
|
||||
<field name="description" colspan="4" nolabel="1"/>
|
||||
<button colspan="4"
|
||||
string="Reply to Last Email"
|
||||
name="%(action_crm_send_mail)d"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'crm.helpdesk'}"
|
||||
icon="gtk-undo" type="action" />
|
||||
</form>
|
||||
@@ -138,7 +138,7 @@
|
||||
</tree>
|
||||
</field>
|
||||
<button colspan="4" string="Send New Email"
|
||||
name="%(action_crm_send_mail)d"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'new', 'model': 'crm.helpdesk'}"
|
||||
icon="gtk-go-forward" type="action" />
|
||||
</page>
|
||||
@@ -0,0 +1,25 @@
|
||||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import crm_helpdesk_report
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@
|
||||
<record id="view_report_crm_helpdesk_form" model="ir.ui.view">
|
||||
<field name="name">crm.helpdesk.report.form</field>
|
||||
<field name="model">crm.helpdesk.report</field>
|
||||
<field name="inherit_id" ref="view_crm_case_form"/>
|
||||
<field name="inherit_id" ref="crm.view_crm_case_form"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="nbr" position="after">
|
||||
@@ -0,0 +1,3 @@
|
||||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_crm_helpdesk","crm.helpdesk","model_crm_helpdesk","crm.group_crm_manager",1,1,1,1
|
||||
"access_report_crm_helpdesk","report.crm.helpdesk","model_crm_helpdesk_report","crm.group_crm_user",1,1,1,1
|
||||
|
@@ -97,7 +97,7 @@ class content_wrapper(StringIO.StringIO):
|
||||
cr = db.cursor()
|
||||
cr.commit()
|
||||
try:
|
||||
getattr(self.pool.get('document.directory.content'), 'process_write_'+self.node.content.extension[1:])(cr, self.uid, self.node, self.getvalue())
|
||||
getattr(self.pool.get('document.directory.content'), 'process_write')(cr, self.uid, self.node, self.getvalue())
|
||||
finally:
|
||||
cr.commit()
|
||||
cr.close()
|
||||
|
||||
@@ -38,7 +38,7 @@ crm modules.
|
||||
'website': 'http://www.openerp.com',
|
||||
'depends': ['sale', 'crm'],
|
||||
'init_xml': [],
|
||||
'update_xml': ['wizard/crm_make_sale_view.xml',
|
||||
'update_xml': ['sale_crm_wizard.xml',
|
||||
'sale_crm_view.xml',
|
||||
'process/sale_crm_process.xml',
|
||||
'security/sale_crm_security.xml',
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<field name="inherit_id" ref="crm.crm_case_form_view_oppor"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="priority" position="after">
|
||||
<button string="Convert to Quote" icon="terp-sale" name="%(action_crm_make_sale)d" type="action"/>
|
||||
<button string="Convert to Quote" icon="terp-sale" name="%(sale_crm_wizard)d" type="action"/>
|
||||
<label colspan="2" string=""/>
|
||||
</field>
|
||||
</field>
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<wizard
|
||||
string="Make Quotation"
|
||||
model="crm.opportunity"
|
||||
name="crm.opportunity.make_order"
|
||||
keyword="client_action_multi"
|
||||
multi="True"
|
||||
id="sale_crm_wizard"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -19,7 +19,7 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import crm_make_sale
|
||||
import makesale
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -1,177 +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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
from mx.DateTime import now
|
||||
|
||||
class crm_make_sale(osv.osv_memory):
|
||||
""" Make sale order for crm """
|
||||
|
||||
_name = "crm.make.sale"
|
||||
_description = "Make sale"
|
||||
|
||||
def _selectPartner(self, cr, uid, context=None):
|
||||
"""
|
||||
This function gets default value for partner_id field.
|
||||
@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
|
||||
@return : default value of partner_id field.
|
||||
"""
|
||||
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
data = context and context.get('active_ids', []) or []
|
||||
case_obj = self.pool.get('crm.opportunity')
|
||||
case = case_obj.read(cr, uid, data, ['partner_id'])
|
||||
return case[0]['partner_id']
|
||||
|
||||
def makeOrder(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
This function create Quotation on given case.
|
||||
@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 crm make sale' ids
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return : Dictionary value of created sale order.
|
||||
"""
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
result = mod_obj._get_id(cr, uid, 'sale', 'view_sales_order_filter')
|
||||
id = mod_obj.read(cr, uid, result, ['res_id'])
|
||||
case_obj = self.pool.get('crm.opportunity')
|
||||
sale_obj = self.pool.get('sale.order')
|
||||
partner_obj = self.pool.get('res.partner')
|
||||
sale_line_obj = self.pool.get('sale.order.line')
|
||||
|
||||
data = context and context.get('active_ids', []) or []
|
||||
|
||||
for make in self.browse(cr, uid, ids):
|
||||
default_partner_addr = partner_obj.address_get(cr, uid, [make.partner_id.id],
|
||||
['invoice', 'delivery', 'contact'])
|
||||
default_pricelist = partner_obj.browse(cr, uid, make.partner_id.id,
|
||||
context).property_product_pricelist.id
|
||||
fpos_data = partner_obj.browse(cr, uid, make.partner_id.id, context).property_account_position
|
||||
new_ids = []
|
||||
|
||||
for case in case_obj.browse(cr, uid, data):
|
||||
if case.partner_id and case.partner_id.id:
|
||||
partner_id = case.partner_id.id
|
||||
fpos = case.partner_id.property_account_position and case.partner_id.property_account_position.id or False
|
||||
partner_addr = partner_obj.address_get(cr, uid, [case.partner_id.id],
|
||||
['invoice', 'delivery', 'contact'])
|
||||
pricelist = partner_obj.browse(cr, uid, case.partner_id.id,
|
||||
context).property_product_pricelist.id
|
||||
else:
|
||||
partner_id = make.partner_id.id
|
||||
fpos = fpos_data and fpos_data.id or False
|
||||
partner_addr = default_partner_addr
|
||||
pricelist = default_pricelist
|
||||
|
||||
if False in partner_addr.values():
|
||||
raise osv.except_osv(_('Data Insufficient!'),_('Customer has no addresses defined!'))
|
||||
|
||||
vals = {
|
||||
'origin': 'CRM-Opportunity:%s' % str(case.id),
|
||||
'section_id': case.section_id and case.section_id.id or False,
|
||||
'picking_policy': make.picking_policy,
|
||||
'shop_id': make.shop_id.id,
|
||||
'partner_id': partner_id,
|
||||
'pricelist_id': pricelist,
|
||||
'partner_invoice_id': partner_addr['invoice'],
|
||||
'partner_order_id': partner_addr['contact'],
|
||||
'partner_shipping_id': partner_addr['delivery'],
|
||||
'order_policy': 'manual',
|
||||
'date_order': now(),
|
||||
'fiscal_position': fpos,
|
||||
}
|
||||
|
||||
if partner_id:
|
||||
partner = partner_obj.browse(cr, uid, partner_id, context=context)
|
||||
vals['user_id'] = partner.user_id and partner.user_id.id or uid
|
||||
|
||||
if make.analytic_account.id:
|
||||
vals['project_id'] = make.analytic_account.id
|
||||
new_id = sale_obj.create(cr, uid, vals)
|
||||
for product_id in make.product_ids:
|
||||
value = sale_line_obj.product_id_change(cr, uid, [], pricelist,
|
||||
product_id.id, qty=1, partner_id=partner_id, fiscal_position=fpos)['value']
|
||||
value['product_id'] = product_id.id
|
||||
value['order_id'] = new_id
|
||||
value['tax_id'] = [(6,0,value['tax_id'])]
|
||||
sale_line_obj.create(cr, uid, value)
|
||||
|
||||
case_obj.write(cr, uid, [case.id], {'ref': 'sale.order,%s' % new_id})
|
||||
new_ids.append(new_id)
|
||||
|
||||
if make.close:
|
||||
case_obj.case_close(cr, uid, data)
|
||||
|
||||
if not new_ids:
|
||||
return {}
|
||||
if len(new_ids)<=1:
|
||||
value = {
|
||||
'domain': str([('id', 'in', new_ids)]),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'sale.order',
|
||||
'view_id': False,
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_id': new_ids and new_ids[0]
|
||||
}
|
||||
else:
|
||||
value = {
|
||||
'domain': str([('id', 'in', new_ids)]),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'sale.order',
|
||||
'view_id': False,
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_id':new_ids
|
||||
}
|
||||
return value
|
||||
|
||||
_columns = {
|
||||
'shop_id': fields.many2one('sale.shop', 'Shop', required = True),
|
||||
'partner_id': fields.many2one('res.partner', 'Customer', required = True, help = 'Use this partner if there is no partner on the case'),
|
||||
'picking_policy': fields.selection([('direct','Direct Delivery'),
|
||||
('one','All at once')], 'Picking Policy', required = True),
|
||||
'product_ids': fields.many2many('product.product', 'product_sale_rel',\
|
||||
'sale_id', 'product_id', 'Products'),
|
||||
'analytic_account': fields.many2one('account.analytic.account', 'Analytic Account'),
|
||||
'close': fields.boolean('Close Case', help = 'Check this to close the case after having created the sale order.'),
|
||||
}
|
||||
_defaults = {
|
||||
'partner_id': _selectPartner,
|
||||
'close': lambda *a: 1
|
||||
}
|
||||
|
||||
crm_make_sale()
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -1,41 +0,0 @@
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- crm make sale's view -->
|
||||
|
||||
<record id="view_crm_make_sale" model="ir.ui.view">
|
||||
<field name="name">crm.make.sale.form</field>
|
||||
<field name="model">crm.make.sale</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Convert to Quote">
|
||||
<field name="partner_id"/>
|
||||
<field name="shop_id"/>
|
||||
<field name="analytic_account"/>
|
||||
<field name="picking_policy"/>
|
||||
<field name="close"/>
|
||||
<newline/>
|
||||
<field name="product_ids" colspan="4"/>
|
||||
<separator colspan="4"/>
|
||||
<group col="4" colspan="4">
|
||||
<label string="" colspan="2"/>
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="makeOrder" string="Create Quote" type="object" icon='gtk-go-forward'/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- crm make sale's action -->
|
||||
|
||||
<record id="action_crm_make_sale" model="ir.actions.act_window">
|
||||
<field name="name">Make Quotation</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">crm.make.sale</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,174 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from mx.DateTime import now
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
import ir
|
||||
import pooler
|
||||
from tools.translate import _
|
||||
|
||||
sale_form = """<?xml version="1.0"?>
|
||||
<form string="Convert to Quote">
|
||||
<field name="partner_id" required="True"/>
|
||||
<field name="shop_id" required="True"/>
|
||||
<field name="analytic_account"/>
|
||||
<field name="picking_policy" required="True"/>
|
||||
<field name="close"/>
|
||||
<newline/>
|
||||
<field name="products" colspan="4"/>
|
||||
</form>"""
|
||||
|
||||
sale_fields = {
|
||||
'shop_id': {'string': 'Shop', 'type': 'many2one', 'relation': 'sale.shop'},
|
||||
'partner_id': {'string': 'Customer', 'type': 'many2one',
|
||||
'relation': 'res.partner',
|
||||
'help': 'Use this partner if there is no partner on the case'},
|
||||
'picking_policy': {'string': 'Picking Policy', 'type': 'selection',
|
||||
'selection': [('direct','Direct Delivery'),('one','All at once')]},
|
||||
'products': {'string': 'Products', 'type': 'many2many',
|
||||
'relation': 'product.product'},
|
||||
'analytic_account': {'string': 'Analytic Account', 'type': 'many2one',
|
||||
'relation': 'account.analytic.account'},
|
||||
'close': {'string': 'Close Case', 'type': 'boolean', 'default': lambda *a: 1,
|
||||
'help': 'Check this to close the case after having created the sale order.'},
|
||||
}
|
||||
|
||||
|
||||
class make_sale(wizard.interface):
|
||||
|
||||
def _selectPartner(self, cr, uid, data, context):
|
||||
case_obj = pooler.get_pool(cr.dbname).get('crm.opportunity')
|
||||
case = case_obj.read(cr, uid, data['ids'], ['partner_id'])
|
||||
return {'partner_id': case[0]['partner_id']}
|
||||
|
||||
def _makeOrder(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
mod_obj = pool.get('ir.model.data')
|
||||
result = mod_obj._get_id(cr, uid, 'sale', 'view_sales_order_filter')
|
||||
id = mod_obj.read(cr, uid, result, ['res_id'])
|
||||
case_obj = pool.get('crm.opportunity')
|
||||
sale_obj = pool.get('sale.order')
|
||||
partner_obj = pool.get('res.partner')
|
||||
sale_line_obj = pool.get('sale.order.line')
|
||||
|
||||
default_partner_addr = partner_obj.address_get(cr, uid, [data['form']['partner_id']],
|
||||
['invoice', 'delivery', 'contact'])
|
||||
default_pricelist = partner_obj.browse(cr, uid, data['form']['partner_id'],
|
||||
context).property_product_pricelist.id
|
||||
fpos_data = partner_obj.browse(cr, uid, data['form']['partner_id'],context).property_account_position
|
||||
new_ids = []
|
||||
|
||||
for case in case_obj.browse(cr, uid, data['ids']):
|
||||
if case.partner_id and case.partner_id.id:
|
||||
partner_id = case.partner_id.id
|
||||
fpos = case.partner_id.property_account_position and case.partner_id.property_account_position.id or False
|
||||
partner_addr = partner_obj.address_get(cr, uid, [case.partner_id.id],
|
||||
['invoice', 'delivery', 'contact'])
|
||||
pricelist = partner_obj.browse(cr, uid, case.partner_id.id,
|
||||
context).property_product_pricelist.id
|
||||
else:
|
||||
partner_id = data['form']['partner_id']
|
||||
fpos = fpos_data and fpos_data.id or False
|
||||
partner_addr = default_partner_addr
|
||||
pricelist = default_pricelist
|
||||
|
||||
if False in partner_addr.values():
|
||||
raise wizard.except_wizard(_('Data Insufficient!'),_('Customer has no addresses defined!'))
|
||||
|
||||
vals = {
|
||||
'origin': 'CRM-Opportunity:%s' % str(case.id),
|
||||
'section_id': case.section_id and case.section_id.id or False,
|
||||
'picking_policy': data['form']['picking_policy'],
|
||||
'shop_id': data['form']['shop_id'],
|
||||
'partner_id': partner_id,
|
||||
'pricelist_id': pricelist,
|
||||
'partner_invoice_id': partner_addr['invoice'],
|
||||
'partner_order_id': partner_addr['contact'],
|
||||
'partner_shipping_id': partner_addr['delivery'],
|
||||
'order_policy': 'manual',
|
||||
'date_order': now(),
|
||||
'fiscal_position': fpos,
|
||||
}
|
||||
|
||||
if partner_id:
|
||||
partner = partner_obj.browse(cr, uid, partner_id, context=context)
|
||||
vals['user_id'] = partner.user_id and partner.user_id.id or uid
|
||||
|
||||
if data['form']['analytic_account']:
|
||||
vals['project_id'] = data['form']['analytic_account']
|
||||
new_id = sale_obj.create(cr, uid, vals)
|
||||
for product_id in data['form']['products'][0][2]:
|
||||
value = sale_line_obj.product_id_change(cr, uid, [], pricelist,
|
||||
product_id, qty=1, partner_id=partner_id, fiscal_position=fpos)['value']
|
||||
value['product_id'] = product_id
|
||||
value['order_id'] = new_id
|
||||
value['tax_id'] = [(6,0,value['tax_id'])]
|
||||
sale_line_obj.create(cr, uid, value)
|
||||
|
||||
case_obj.write(cr, uid, [case.id], {'ref': 'sale.order,%s' % new_id})
|
||||
new_ids.append(new_id)
|
||||
|
||||
if data['form']['close']:
|
||||
case_obj.case_close(cr, uid, data['ids'])
|
||||
|
||||
if not new_ids:
|
||||
return {}
|
||||
|
||||
if len(new_ids)<=1:
|
||||
value = {
|
||||
'domain': str([('id', 'in', new_ids)]),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'sale.order',
|
||||
'view_id': False,
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_id': new_ids and new_ids[0]
|
||||
}
|
||||
else:
|
||||
value = {
|
||||
'domain': str([('id', 'in', new_ids)]),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'sale.order',
|
||||
'view_id': False,
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_id':new_ids
|
||||
}
|
||||
|
||||
return value
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_selectPartner],
|
||||
'result': {'type': 'form', 'arch': sale_form, 'fields': sale_fields,
|
||||
'state' : [('end', 'Cancel', 'gtk-cancel'),('order', 'Create Quote', 'gtk-go-forward')]}
|
||||
},
|
||||
'order': {
|
||||
'actions': [],
|
||||
'result': {'type': 'action', 'action': _makeOrder, 'state': 'end'}
|
||||
}
|
||||
}
|
||||
|
||||
make_sale('crm.opportunity.make_order')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -539,8 +539,8 @@ class smtpclient(osv.osv):
|
||||
sids = queue.search(cr, uid, [('state','not in',['send','sending']), ('server_id','in',ids)], order="priority", limit=30)
|
||||
|
||||
message = ""
|
||||
if len(ids) > 0:
|
||||
message = "sending %s emails from message queuq !" % (len(ids))
|
||||
if len(sids) > 0:
|
||||
message = "sending %s emails from message queue !" % (len(sids))
|
||||
logger.notifyChannel('smtp', netsvc.LOG_INFO, message)
|
||||
|
||||
result = self. _send_emails(cr, uid, sids, {})
|
||||
|
||||
Reference in New Issue
Block a user