[IMP] Project->scrum->scrum Meeting-Improvement in send Email Button(wizard)
bzr revid: ron@tinyerp.com-20101006135737-5fb9bbl0bv9sc9ht
This commit is contained in:
@@ -404,8 +404,6 @@
|
||||
<separator colspan="4" string="Are there anything blocking you?"/>
|
||||
<field colspan="4" name="question_blocks" nolabel="1"/>
|
||||
<separator colspan="4" string=""/>
|
||||
<button name="button_send_to_master" type="object" string="Send to Scrum Master" icon="gtk-ok"/>
|
||||
<button name="button_send_product_owner" type="object" string="Send to Product Owner" icon="gtk-ok"/>
|
||||
</page>
|
||||
<page string="Optional Info">
|
||||
<separator colspan="4" string="Are your Sprint Backlog estimate accurate ?"/>
|
||||
|
||||
@@ -23,6 +23,7 @@ from lxml import etree
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
from datetime import datetime
|
||||
import tools
|
||||
|
||||
class project_scrum_email(osv.osv_memory):
|
||||
_name = 'project.scrum.email'
|
||||
@@ -32,7 +33,6 @@ class project_scrum_email(osv.osv_memory):
|
||||
context = {}
|
||||
active_id = context.get('active_id', False)
|
||||
res = False
|
||||
# res='master@gmail.com'
|
||||
if active_id:
|
||||
res = self.pool.get('project.scrum.meeting').browse(cr,uid,active_id,context=context).sprint_id.scrum_master_id.user_email
|
||||
return res
|
||||
@@ -42,7 +42,6 @@ class project_scrum_email(osv.osv_memory):
|
||||
context = {}
|
||||
active_id = context.get('active_id', False)
|
||||
res = False
|
||||
# res='owner@gmail.com'
|
||||
if active_id:
|
||||
res = self.pool.get('project.scrum.meeting').browse(cr, uid,active_id,context=context).sprint_id.product_owner_id.user_email
|
||||
return res
|
||||
@@ -53,11 +52,9 @@ class project_scrum_email(osv.osv_memory):
|
||||
active_id = context.get('active_id', False)
|
||||
res = False
|
||||
|
||||
# res='owner@gmail.com'
|
||||
if active_id:
|
||||
res1= self.pool.get('project.scrum.meeting').browse(cr,uid,active_id).date
|
||||
res=" Scrum Meeting of " + res1
|
||||
print res
|
||||
return res
|
||||
|
||||
def _get_message(self,cr, uid, context=None):
|
||||
@@ -66,21 +63,21 @@ class project_scrum_email(osv.osv_memory):
|
||||
active_id = context.get('active_id', False)
|
||||
res = False
|
||||
|
||||
# res='owner@gmail.com'
|
||||
if active_id:
|
||||
|
||||
res1= self.pool.get('project.scrum.meeting').browse(cr,uid,active_id).date
|
||||
sprint_name= self.pool.get('project.scrum.meeting').browse(cr,uid,active_id).sprint_id.name
|
||||
cnv_date = datetime.strptime(res1,'%Y-%m-%d')
|
||||
weekfordate=datetime.strftime(cnv_date,'%W')
|
||||
res2= self.pool.get('project.scrum.meeting').browse(cr,uid,active_id).sprint_id.project_id.name
|
||||
res=" Scrum Meeting of "+res1+" on Sprint Week "+weekfordate+" of Project "+res2
|
||||
res3='Hello , \n I am sending you Daily Meeting Details of date '+res1+' for the Sprint '+sprint_name
|
||||
res=res3+" of Project "+res2
|
||||
return res
|
||||
|
||||
|
||||
_columns = {
|
||||
'scrum_master_id': fields.char('Scrum Master Email', size=220,help="The person who is maintains the processes for the product"),
|
||||
'product_owner_id': fields.char('Product Owner Email', size=220,help="The person who is responsible for the product"),
|
||||
'subject':fields.char('Subject',size=220),
|
||||
'scrum_master_id': fields.char('Scrum Master Email', size=64,help="The person who is maintains the processes for the product"),
|
||||
'product_owner_id': fields.char('Product Owner Email', size=64,help="The person who is responsible for the product"),
|
||||
'subject':fields.char('Subject',size=64),
|
||||
'message':fields.text('Message'),
|
||||
|
||||
}
|
||||
@@ -93,41 +90,102 @@ class project_scrum_email(osv.osv_memory):
|
||||
|
||||
}
|
||||
|
||||
# def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
# res = super(project_task_reevaluate, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu=submenu)
|
||||
# users_pool = self.pool.get('res.users')
|
||||
# time_mode = users_pool.browse(cr, uid, uid, context).company_id.project_time_mode_id
|
||||
# time_mode_name = time_mode and time_mode.name or 'Hours'
|
||||
# if time_mode_name in ['Hours','Hour']:
|
||||
# return res
|
||||
#
|
||||
# eview = etree.fromstring(res['arch'])
|
||||
#
|
||||
# def _check_rec(eview):
|
||||
# if eview.attrib.get('widget','') == 'float_time':
|
||||
# eview.set('widget','float')
|
||||
# for child in eview:
|
||||
# _check_rec(child)
|
||||
# return True
|
||||
#
|
||||
# _check_rec(eview)
|
||||
#
|
||||
# res['arch'] = etree.tostring(eview)
|
||||
#
|
||||
# for field in res['fields']:
|
||||
# if 'Hours' in res['fields'][field]['string']:
|
||||
# res['fields'][field]['string'] = res['fields'][field]['string'].replace('Hours',time_mode_name)
|
||||
# return res
|
||||
|
||||
# def compute_hours(self, cr, uid, ids, context=None):
|
||||
# if context is None:
|
||||
# context = {}
|
||||
# data = self.browse(cr, uid, ids, context=context)[0]
|
||||
# task_pool = self.pool.get('project.task')
|
||||
# task_id = context.get('active_id', False)
|
||||
# if task_id:
|
||||
# task_pool.write(cr, uid, task_id, {'remaining_hours': data.remaining_hours})
|
||||
# if context.get('button_reactivate', False):
|
||||
# task_pool.do_reopen(cr, uid, [task_id], context=context)
|
||||
# return {}
|
||||
def button_send_scrum_email(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context={}
|
||||
|
||||
active_id = context.get('active_id', False)
|
||||
scrum_obj=self.pool.get('project.scrum.meeting').browse(cr, uid,active_id,context=context)
|
||||
|
||||
# wizard data
|
||||
meeting_wizard_id=self.browse(cr,uid,ids,context=context)[0]
|
||||
scrum_master_email=meeting_wizard_id.scrum_master_id
|
||||
product_owner_email=meeting_wizard_id.product_owner_id
|
||||
mail_subject=meeting_wizard_id.subject
|
||||
mail_message=meeting_wizard_id.message
|
||||
|
||||
|
||||
|
||||
# Record Data
|
||||
if active_id:
|
||||
scrum_master_name=scrum_obj.sprint_id.scrum_master_id.name
|
||||
product_owner_name=scrum_obj.sprint_id.product_owner_id.name
|
||||
last_meeting = scrum_obj.question_yesterday
|
||||
if not last_meeting:
|
||||
last_meeting=""
|
||||
next_meeting = scrum_obj.question_today
|
||||
if not next_meeting:
|
||||
next_meeting=""
|
||||
block_meeting = scrum_obj.question_blocks
|
||||
if not block_meeting:
|
||||
block_meeting=""
|
||||
backlog_accurate = scrum_obj.question_backlog
|
||||
if not backlog_accurate:
|
||||
backlog_accurate=""
|
||||
mail_date=scrum_obj.date
|
||||
sprint_name=scrum_obj.sprint_id.name
|
||||
task_record_list=[]
|
||||
for task_assign in scrum_obj.task_ids:
|
||||
task_record=task_assign.name
|
||||
task_record_list.append(task_record)
|
||||
|
||||
# Email
|
||||
if scrum_master_email:
|
||||
if product_owner_email:
|
||||
send_owner = self.email_send(cr,uid, ids,product_owner_email,mail_subject,mail_message,
|
||||
last_meeting,next_meeting,block_meeting,backlog_accurate,
|
||||
task_record_list,product_owner_name,
|
||||
mail_date,sprint_name,active_id)
|
||||
if not send_owner:
|
||||
raise osv.except_osv(_('Error !'), _(' Email Not send to the product owner !' ))
|
||||
|
||||
else:
|
||||
raise osv.except_osv(_('Error !'), _('Please provide email address for product owner defined on sprint.'))
|
||||
send_master = self.email_send(cr, uid, ids,scrum_master_email,mail_subject,mail_message,
|
||||
last_meeting,next_meeting,block_meeting,backlog_accurate,
|
||||
task_record_list,scrum_master_name,mail_date,
|
||||
sprint_name,active_id)
|
||||
if not send_master:
|
||||
raise osv.except_osv(_('Error !'), _(' Email Not send to the scrum master !' ))
|
||||
else:
|
||||
return {'type':'ir.actions.act_window_close' }
|
||||
else:
|
||||
raise osv.except_osv(_('Error !'), _('Please provide email address for scrum master defined on sprint.'))
|
||||
|
||||
return True
|
||||
|
||||
def email_send(self, cr, uid, ids, email,mail_subject,mail_message,
|
||||
last_meeting,next_meeting,block_meeting,backlog_accurate,
|
||||
task_record_list,user_own_name,mail_date,sprint_name,active_id,
|
||||
context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
email_from = tools.config.get('email_from', False)
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||
user_email = email_from or user.address_id.email
|
||||
sub_name = mail_subject
|
||||
|
||||
body ="\n"+mail_message+"\n"
|
||||
body += "\n"+ _('What did you do since the last meeting?')+ '\n_______________________\n'
|
||||
body +="\n"+last_meeting+"\n"
|
||||
body +="\n" +_("What do you plan to do till the next meeting?")+ '\n_______________________ \n'
|
||||
body +="\n"+next_meeting+"\n"
|
||||
body +="\n"+ _('Are there anything blocking you?') +'\n_______________________ \n'
|
||||
body +="\n"+block_meeting+"\n"
|
||||
body +="\n"+ _('Are your Sprint Backlog estimate accurate ?') +'\n_______________________ \n'
|
||||
body +="\n"+backlog_accurate+"\n"
|
||||
body += "\n"+ _('Tasks Summary:')+ '\n_______________________'
|
||||
str=""
|
||||
for taskassign in task_record_list:
|
||||
str=str +"\n"
|
||||
str =str + taskassign
|
||||
body +=str
|
||||
body += "\n\n"+_('Thank you')+",\n"+ user.name
|
||||
|
||||
flag = tools.email_send(user_email,[email], sub_name, body, reply_to=None,openobject_id=active_id)
|
||||
if not flag:
|
||||
return False
|
||||
return True
|
||||
|
||||
project_scrum_email()
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
<group col="2" colspan="4">
|
||||
<field name="scrum_master_id"/>
|
||||
<field name="product_owner_id"/>
|
||||
<field name="subject"/>
|
||||
</group>
|
||||
</group>
|
||||
<field name="subject"/>
|
||||
<notebook colspan="4">
|
||||
<page string="Message">
|
||||
<field name="message" nolabel="1"/>
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
<separator string="" colspan="4"/>
|
||||
<button icon="gtk-close" special="cancel" string="_Cancel"/>
|
||||
<button icon="gtk-go-forward" string="_Send" type="object" default_focus="1"/>
|
||||
<button icon="gtk-go-forward" name="button_send_scrum_email" string="_Send" type="object" default_focus="1" />
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user