[MERGE] jam correction + last correction by tfr

bzr revid: tfr@openerp.com-20110517132830-p42ps4qd0rkxsjf3
This commit is contained in:
tfr@openerp.com 2011-05-17 15:28:30 +02:00
commit d6d2af63d6
8 changed files with 42 additions and 62 deletions

View File

@ -331,8 +331,6 @@ class crm_case(object):
if not case.user_id:
data['user_id'] = uid
self.write(cr, uid, case.id, data)
self._action(cr, uid, cases, 'open')
return True
@ -423,11 +421,14 @@ class crm_case(object):
@param ids: List of case Ids
@param *args: Tuple Value for additional Params
"""
state = 'draft'
if 'crm.phonecall' in args:
state = 'open'
cases = self.browse(cr, uid, ids)
cases[0].state # to fill the browse record cache
self._history(cr, uid, cases, _('Draft'))
self.write(cr, uid, ids, {'state': 'draft', 'active': True})
self._action(cr, uid, cases, 'draft')
self.write(cr, uid, ids, {'state': state, 'active': True})
self._action(cr, uid, cases, state)
return True
def remind_partner(self, cr, uid, ids, context=None, attach=False):

View File

@ -54,9 +54,9 @@ class crm_phonecall(crm_case, osv.osv):
('open', 'Todo'),
('cancel', 'Cancelled'),
('done', 'Held'),
('pending', 'Pending'),
('pending', 'Not Held'),
], 'State', size=16, readonly=True,
help='The state is set to \'Draft\', when a case is created.\
help='The state is set to \'Todo\', 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\'.'),
@ -126,14 +126,14 @@ class crm_phonecall(crm_case, osv.osv):
return res
def case_reset(self, cr, uid, ids, *args):
"""Resets case as draft
"""Resets case as Todo
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case Ids
@param *args: Tuple Value for additional Params
"""
res = super(crm_phonecall, self).case_reset(cr, uid, ids, args)
res = super(crm_phonecall, self).case_reset(cr, uid, ids, args, 'crm.phonecall')
self.write(cr, uid, ids, {'duration': 0.0})
return res

View File

@ -35,16 +35,16 @@
<field name="create_date" invisible="1"/>
<button string="Convert to Opportunity"
name="%(phonecall2opportunity_act)d"
states="draft,open,pending"
states="open,pending"
icon="gtk-index"
type="action" attrs="{'invisible':[('opportunity_id','!=',False)]}" />
<button string="Meeting"
states="draft,open,pending" icon="gtk-redo"
states="open,pending" icon="gtk-redo"
name="action_make_meeting" type="object" />
<field name="state"/>
<button name="case_cancel" string="Cancel" states="draft,open,pending" type="object" icon="gtk-cancel"/>
<button name="case_open" string="Todo" states="draft,pending" type="object" icon="gtk-go-forward"/>
<button name="case_close" string="Held" states="open,draft,pending" type="object" icon="gtk-jump-to"/>
<button name="case_cancel" string="Cancel" states="open,pending" type="object" icon="gtk-cancel"/>
<button name="case_open" string="Todo" states="pending" type="object" icon="gtk-go-forward"/>
<button name="case_close" string="Held" states="open,pending" type="object" icon="gtk-jump-to"/>
<button name="case_pending" string="Not Held" states="open" type="object" icon="gtk-media-pause"/>
</tree>
</field>
@ -67,15 +67,15 @@
<field name="date"/>
<field name="user_id"/>
<field name="section_id" colspan="1" widget="selection" />
<button string="Convert to Opportunity"
name="%(phonecall2opportunity_act)d"
icon="gtk-index" type="action"
attrs="{'invisible':['|', ('opportunity_id','!=',False), ('state','=','done')]}" />
<label colspan="6" string=""/>
<button string="Schedule Other Call"
icon="terp-call-start"
name="%(phonecall_to_phonecall_act)d"
type="action" />
<label colspan="6" string=""/>
<button string="Convert to Opportunity"
name="%(phonecall2opportunity_act)d"
icon="gtk-index" type="action"
attrs="{'invisible':[('opportunity_id','!=',False)]}" />
</group>
@ -108,17 +108,17 @@
<group col="8" colspan="4">
<field name="state" select="1" />
<button name="case_cancel" string="Cancel"
states="draft,open,pending" type="object"
states="open,pending" type="object"
icon="gtk-cancel" />
<button name="case_open" string="Todo"
states="draft,pending" type="object"
states="pending" type="object"
icon="gtk-go-forward" />
<button name="case_pending" string="Not Held"
states="open" type="object" icon="gtk-media-pause" />
<button name="case_close" string="Held"
states="open,draft,pending" type="object"
states="open,pending" type="object"
icon="gtk-jump-to" />
<button name="case_reset" string="Reset to Draft"
<button name="case_reset" string="Reset to Todo"
states="cancel" type="object"
icon="gtk-convert" />
</group>
@ -183,7 +183,7 @@
<search string="Search Phonecalls">
<filter icon="terp-check" string="Current"
name="current"
domain="[('state','in', ('draft','open','pending'))]"/>
domain="[('state','in', ('open','pending'))]"/>
<filter icon="terp-go-today" string="Today"
domain="[('date','&lt;', time.strftime('%%Y-%%m-%%d 23:59:59')),
('date','&gt;=',time.strftime('%%Y-%%m-%%d 00:00:00'))]"

View File

@ -33,6 +33,7 @@ class crm_opportunity2phonecall(osv.osv_memory):
_columns = {
'name' : fields.char('Call summary', size=64, required=True, select=1),
'user_id' : fields.many2one('res.users', "Assign To"),
'partner_id' : fields.many2one('res.partner', "Partner"),
'date': fields.datetime('Date'),
'section_id': fields.many2one('crm.case.section', 'Sales Team'),
'categ_id': fields.many2one('crm.case.categ', 'Category', \
@ -71,6 +72,8 @@ class crm_opportunity2phonecall(osv.osv_memory):
res.update({'section_id': opp.section_id and opp.section_id.id or False})
if 'categ_id' in fields:
res.update({'categ_id': categ_id})
if 'partner_id' in fields:
res.update({'partner_id': opp.partner_id and opp.partner_id.id or False})
return res
def action_cancel(self, cr, uid, ids, context=None):

View File

@ -9,21 +9,22 @@
<field name="model">crm.opportunity2phonecall</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Register a call">
<separator string="Register a call" colspan="4"/>
<form string="Schedule/Log a call">
<separator string="Schedule/Log a call" colspan="4"/>
<field name="action"/>
<separator string="Call Details" colspan="4"/>
<field name="name"/>
<field name="date" string="Planned Date" attrs="{'invisible': [('action','=','log')]}"/>
<newline/>
<field name="user_id" />
<field name="partner_id" readonly="True"/>
<field name="user_id" />
<field name="section_id" widget="selection" />
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.phonecall')]"/>
<separator string="" colspan="4"/>
<group colspan="4">
<label string ="" colspan="2"/>
<group colspan="4" col="3">
<button name="action_cancel" string="_Cancel" icon="gtk-cancel" special="cancel" />
<button name="action_apply" type="object" string="Register call" icon="gtk-ok" />
<button name="action_apply" type="object" string="Log call" icon="gtk-ok" attrs="{'invisible' : [('action', '!=', 'log')]}" />
<button name="action_apply" type="object" string="Schedule call" icon="gtk-ok" attrs="{'invisible' : [('action', '!=', 'schedule')]}" />
</group>
</form>
</field>

View File

@ -31,43 +31,14 @@ class crm_phonecall2opportunity(osv.osv_memory):
def action_cancel(self, cr, uid, ids, context=None):
"""
Closes Phonecall to Opportunity form
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Phonecall to Opportunity's IDs
@param context: A standard dictionary for contextual values
"""
return {'type':'ir.actions.act_window_close'}
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 users ID for security checks,
@param fields: List of fields for default value
@param context: A standard dictionary for contextual values
"""
phonecall_obj = self.pool.get('crm.phonecall')
record_id = context and context.get('active_id', False) or False
case = phonecall_obj.browse(cr, uid, record_id, context=context)
if case.state in ['done', 'cancel']:
raise osv.except_osv(_("Warning"), _("Closed/Cancelled Phone \
Call Could not convert into Opportunity"))
def action_apply(self, cr, uid, ids, context=None):
"""
This converts Phonecall to Opportunity and opens Phonecall view
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Phonecall 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 record_id:

View File

@ -114,6 +114,7 @@ class crm_phonecall2phonecall(osv.osv_memory):
'date': fields.datetime('Date'),
'section_id':fields.many2one('crm.case.section','Sales Team'),
'action': fields.selection([('schedule','Schedule a call'), ('log','Log a call')], 'Action', required=True),
'partner_id' : fields.many2one('res.partner', "Partner"),
}
def default_get(self, cr, uid, fields, context=None):
@ -149,6 +150,8 @@ class crm_phonecall2phonecall(osv.osv_memory):
res.update({'section_id': phonecall.section_id and phonecall.section_id.id or False})
if 'categ_id' in fields:
res.update({'categ_id': categ_id})
if 'partner_id' in fields:
res.update({'partner_id': phonecall.partner_id and phonecall.partner_id.id or False})
return res
crm_phonecall2phonecall()

View File

@ -9,20 +9,21 @@
<field name="model">crm.phonecall2phonecall</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Register a call">
<separator string="Register a call" colspan="4"/>
<form string="Schedule/Log a call">
<separator string="Schedule/Log a call" colspan="4"/>
<field name="action"/>
<separator string="Call Details" colspan="4"/>
<field name="name"/>
<field name="date" string="Planned Date" attrs="{'invisible': [('action','=','log')]}"/>
<field name="partner_id" readonly="True"/>
<field name="user_id" />
<field name="section_id"/>
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.phonecall')]"/>
<separator string=" " colspan="4"/>
<group colspan="4" col="3" >
<label string=" " />
<button name="action_cancel" string="_Cancel" icon="gtk-cancel" special="cancel" />
<button name="action_apply" type="object" string="Register call" icon="gtk-ok" />
<button name="action_apply" type="object" string="Log call" icon="gtk-ok" attrs="{'invisible' : [('action', '!=', 'log')]}" />
<button name="action_apply" type="object" string="Schedule call" icon="gtk-ok" attrs="{'invisible' : [('action', '!=', 'schedule')]}" />
</group>
</form>
</field>