[IMP] crm_phoncall : remove the visibilty of the draft from phonecall

bzr revid: jam@tinyerp.com-20110516061745-zlhzw0gjabqn6vh1
This commit is contained in:
Jigar Amin 2011-05-16 11:47:45 +05:30
parent 966212d0f6
commit 4ebbe5d4b6
3 changed files with 18 additions and 18 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

@ -50,13 +50,12 @@ class crm_phonecall(crm_case, osv.osv):
'company_id': fields.many2one('res.company', 'Company'),
'description': fields.text('Description'),
'state': fields.selection([
('draft', 'Draft'),
('open', 'Todo'),
('cancel', 'Cancelled'),
('done', 'Held'),
('pending', 'Pending'),
], '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 +125,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>
@ -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'))]"