[IMP] project_scrum: add openchatter functionality.

bzr revid: tpa@tinyerp.com-20120508061358-ileak0qc2h8vuxz4
This commit is contained in:
Turkesh Patel (Open ERP)
2012-05-08 11:43:58 +05:30
parent b05b6720dd
commit ad486dd4ba
2 changed files with 44 additions and 7 deletions
+38 -6
View File
@@ -72,28 +72,27 @@ class project_scrum_sprint(osv.osv):
def button_cancel(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'cancel'}, context=context)
self.cancel_send_note(cr, uid, ids, context=None)
return True
def button_draft(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'draft'}, context=context)
self.draft_send_note(cr, uid, ids, context=None)
return True
def button_open(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'open'}, context=context)
for (id, name) in self.name_get(cr, uid, ids):
message = _("The sprint '%s' has been opened.") % (name,)
self.log(cr, uid, id, message)
self.open_send_note(cr, uid, ids, context=None)
return True
def button_close(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'done'}, context=context)
for (id, name) in self.name_get(cr, uid, ids):
message = _("The sprint '%s' has been closed.") % (name,)
self.log(cr, uid, id, message)
self.close_send_note(cr, uid, ids, context=None)
return True
def button_pending(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'pending'}, context=context)
self.pending_send_note(cr, uid, ids, context=None)
return True
_columns = {
@@ -139,6 +138,39 @@ class project_scrum_sprint(osv.osv):
v['date_stop'] = (datetime.now() + relativedelta(days=int(proj.sprint_size or 14))).strftime('%Y-%m-%d')
return {'value':v}
# ----------------------------------------
# OpenChatter methods and notifications
# ----------------------------------------
def create(self, cr, uid, vals, context=None):
obj_id = super(project_scrum_sprint, self).create(cr, uid, vals, context)
self.create_send_note(cr, uid, [obj_id], context=context)
return obj_id
def draft_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_append_note(cr, uid, [obj.id], body=_("Sprint has been set to <b>draft</b>."), context=context)
def create_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_append_note(cr, uid, [obj.id], body=_("Sprint has been <b>created</b>."), context=context)
def open_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_append_note(cr, uid, [obj.id], body=_("Sprint has been <b>opened</b>."), context=context)
def pending_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_append_note(cr, uid, [obj.id], body=_("Sprint has been set to <b>pending</b>."), context=context)
def cancel_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_append_note(cr, uid, [obj.id], body=_("Sprint has been <b>cancelled</b>."), context=context)
def close_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_append_note(cr, uid, [obj.id], body=_("Sprint has been <b>closed</b>."), context=context)
project_scrum_sprint()
class project_scrum_product_backlog(osv.osv):
+6 -1
View File
@@ -232,7 +232,8 @@
<field name="model">project.scrum.sprint</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Scrum Sprint">
<form string="Scrum Sprint" layout="manual">
<sheet layout="auto">
<group colspan="4" col="6">
<field name="name" select="1"/>
<field name="project_id" on_change="onchange_project_id(project_id)"/>
@@ -307,6 +308,10 @@
<button type="object" string="Close" name="button_close" states="open,pending" icon="terp-dialog-close"/>
<button type="object" string="Set to Draft" name="button_draft" states="cancel,done" icon="gtk-convert"/>
</group>
</sheet>
<div class="oe_form_sheet_width">
<field name="message_ids_social" colspan="4" widget="ThreadView" nolabel="1"/>
</div>
</form>
</field>
</record>