[REM] Removed crm_add_note.
bzr revid: tde@openerp.com-20120706155201-nsgixesgxgiru0bu
This commit is contained in:
parent
d32c2a2efb
commit
28611901c9
|
@ -85,7 +85,6 @@ Creates a dashboard for CRM that includes:
|
|||
'wizard/crm_opportunity_to_phonecall_view.xml',
|
||||
'wizard/crm_partner_to_opportunity_view.xml',
|
||||
|
||||
'wizard/crm_add_note_view.xml',
|
||||
'wizard/crm_merge_opportunities_view.xml',
|
||||
|
||||
'crm_view.xml',
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
##############################################################################
|
||||
|
||||
import mail_compose_message
|
||||
import crm_add_note
|
||||
|
||||
import crm_lead_to_partner
|
||||
import crm_lead_to_opportunity
|
||||
import crm_phonecall_to_phonecall
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
from .. import crm
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
from mail.mail_message import truncate_text
|
||||
|
||||
AVAILABLE_STATES = crm.AVAILABLE_STATES + [('unchanged', 'Unchanged')]
|
||||
|
||||
class crm_add_note(osv.osv_memory):
|
||||
"""Adds a new note to the case."""
|
||||
_name = 'crm.add.note'
|
||||
_description = "Add Internal Note"
|
||||
|
||||
_columns = {
|
||||
'body': fields.text('Note Body', required=True),
|
||||
'state': fields.selection(AVAILABLE_STATES, string='Set New State To',
|
||||
required=True),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'state': 'unchanged'
|
||||
}
|
||||
|
||||
def action_add(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
if not context.get('active_model'):
|
||||
raise osv.except_osv(_('Error'), _('Can not add note!'))
|
||||
|
||||
model = context.get('active_model')
|
||||
case_pool = self.pool.get(model)
|
||||
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
case_list = case_pool.browse(cr, uid, context['active_ids'],
|
||||
context=context)
|
||||
case = case_list[0]
|
||||
case_pool.message_append(cr, uid, [case], truncate_text(obj.body),
|
||||
body_text=obj.body)
|
||||
if obj.state == 'unchanged':
|
||||
pass
|
||||
elif obj.state == 'done':
|
||||
case_pool.case_close(cr, uid, [case.id])
|
||||
elif obj.state == 'draft':
|
||||
case_pool.case_reset(cr, uid, [case.id])
|
||||
elif obj.state in ['cancel', 'open', 'pending']:
|
||||
act = 'case_' + obj.state
|
||||
getattr(case_pool, act)(cr, uid, [case.id])
|
||||
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
crm_add_note()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -1,39 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Add New Note view -->
|
||||
|
||||
<record model="ir.ui.view" id="crm_add_new_note_view">
|
||||
<field name="name">crm.new.add.note.form</field>
|
||||
<field name="model">crm.add.note</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Add Note" version="7.0">
|
||||
<header>
|
||||
<button name="action_add" type="object" string="_Add" class="oe_highlight"/>
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel" />
|
||||
</header>
|
||||
<group>
|
||||
<separator string="Add Note"/>
|
||||
<field name="body"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Add New Note action -->
|
||||
|
||||
<record model="ir.actions.act_window" id="action_crm_add_note">
|
||||
<field name="name">Add Note</field>
|
||||
<field name="res_model">crm.add.note</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="crm_add_new_note_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
Loading…
Reference in New Issue