From 9bd6693f6d7c870d910e27b75f99397815b0ef73 Mon Sep 17 00:00:00 2001 From: "pap (openerp)" Date: Thu, 29 Jul 2010 11:01:04 +0530 Subject: [PATCH] [IMP]: imp in project, project_log_term - changed type of all the dates in project phase from datetime to date - improved send mail wizard on closing a task based on projects warn_customer, war_manager fields improved yaml and demo data fields set to readonly when project, phases or tasks in done state bzr revid: pap@tinyerp.co.in-20100729053104-vx94tzk051896frz --- addons/project/project.py | 15 ++--- addons/project/project_view.xml | 12 ++-- addons/project/test/test_project.yml | 9 ++- .../project/test/test_project_delegation.yml | 15 +++-- addons/project/wizard/project_close_task.py | 58 +++++++++++++------ .../wizard/project_close_task_view.xml | 4 +- addons/project_issue/project_issue.py | 4 +- addons/project_long_term/project_long_term.py | 46 +++++++-------- .../project_long_term_demo.xml | 46 +++++++-------- .../test/schedule_phase_tasks.yml | 6 +- .../test/schedule_project_phases.yml | 12 ++-- .../test/schedule_project_tasks.yml | 2 +- .../wizard/project_compute_phases.py | 10 ++-- .../wizard/project_schedule_tasks.py | 2 +- 14 files changed, 136 insertions(+), 105 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index b05423e00dd..603154d28fe 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -152,17 +152,17 @@ where prp.id in %s''',(tuple(ids),)) 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of Projects."), 'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account', help="Link this project to an analytic account if you need financial management on projects. It enables you to connect projects with budgets, planning, cost and revenue analysis, timesheets on projects, etc."), 'priority': fields.integer('Sequence', help="Gives the sequence order when displaying a list of task"), - 'warn_manager': fields.boolean('Warn Manager', help="If you check this field, the project manager will receive a request each time a task is completed by his team."), - 'members': fields.many2many('res.users', 'project_user_rel', 'project_id', 'uid', 'Project Members', help="Project's member. Not used in any computation, just for information purpose."), + 'warn_manager': fields.boolean('Warn Manager', help="If you check this field, the project manager will receive a request each time a task is completed by his team.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}), + 'members': fields.many2many('res.users', 'project_user_rel', 'project_id', 'uid', 'Project Members', help="Project's member. Not used in any computation, just for information purpose.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}), 'tasks': fields.one2many('project.task', 'project_id', "Project tasks"), 'planned_hours': fields.function(_progress_rate, multi="progress", method=True, string='Planned Time', help="Sum of planned hours of all tasks related to this project and its child projects."), 'effective_hours': fields.function(_progress_rate, multi="progress", method=True, string='Time Spent', help="Sum of spent hours of all tasks related to this project and its child projects."), 'total_hours': fields.function(_progress_rate, multi="progress", method=True, string='Total Time', help="Sum of total hours of all tasks related to this project and its child projects."), 'progress_rate': fields.function(_progress_rate, multi="progress", method=True, string='Progress', type='float', help="Percent of tasks closed according to the total of tasks todo."), - 'warn_customer': fields.boolean('Warn Partner', help="If you check this, the user will have a popup when closing a task that propose a message to send by email to the customer."), - 'warn_header': fields.text('Mail Header', help="Header added at the beginning of the email for the warning message sent to the customer when a task is closed."), - 'warn_footer': fields.text('Mail Footer', help="Footer added at the beginning of the email for the warning message sent to the customer when a task is closed."), - 'type_ids': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Tasks Stages'), + 'warn_customer': fields.boolean('Warn Partner', help="If you check this, the user will have a popup when closing a task that propose a message to send by email to the customer.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}), + 'warn_header': fields.text('Mail Header', help="Header added at the beginning of the email for the warning message sent to the customer when a task is closed.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}), + 'warn_footer': fields.text('Mail Footer', help="Footer added at the beginning of the email for the warning message sent to the customer when a task is closed.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}), + 'type_ids': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Tasks Stages', states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}), } _order = "sequence" @@ -480,7 +480,8 @@ class task(osv.osv): 'ref_doc1': 'project.task,%d'% (task.id,), 'ref_doc2': 'project.project,%d'% (project.id,), }) - elif project.warn_manager and cntx.get('mail_send',True): + elif (project.warn_manager or project.warn_customer) and cntx.get('mail_send',True): + cntx.update({'send_manager': project.warn_manager, 'send_partner': project.warn_customer}) mail_send = True message = _('Task ') + " '" + task.name + "' "+ _("is Done.") self.log(cr, uid, task.id, message) diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 7df69fbbd40..166e64217ac 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -20,9 +20,9 @@ - - - + + + @@ -48,8 +48,8 @@