added code to update timestamps in Task, Customer Issue and Support Ticket

This commit is contained in:
Rushabh Mehta
2013-01-14 15:48:00 +05:30
parent 0c42dc4c22
commit be9ef4ac89
13 changed files with 152 additions and 101 deletions

View File

@@ -17,7 +17,7 @@
from __future__ import unicode_literals
import webnotes
from webnotes.utils import getdate
from webnotes.utils import getdate, today
from webnotes.model import db_exists
from webnotes.model.wrapper import copy_doclist
from webnotes import msgprint
@@ -40,7 +40,7 @@ class DocType:
if cust:
ret = {'customer_name': cust and cust[0][0] or ''}
return ret
def validate(self):
if self.doc.exp_start_date and self.doc.exp_end_date and getdate(self.doc.exp_start_date) > getdate(self.doc.exp_end_date):
msgprint("'Expected Start Date' can not be greater than 'Expected End Date'")
@@ -49,4 +49,14 @@ class DocType:
if self.doc.act_start_date and self.doc.act_end_date and getdate(self.doc.act_start_date) > getdate(self.doc.act_end_date):
msgprint("'Actual Start Date' can not be greater than 'Actual End Date'")
raise Exception
self.update_status()
def update_status(self):
status = webnotes.conn.get_value("Task", self.doc.name, "status")
if self.doc.status=="Working" and status !="Working" and not self.doc.act_start_date:
self.doc.act_start_date = today()
if self.doc.status=="Closed" and status != "Closed" and not self.doc.act_end_date:
self.doc.act_end_date = today()

View File

@@ -2,9 +2,9 @@
{
"owner": "Administrator",
"docstatus": 0,
"creation": "2012-10-29 14:30:00",
"creation": "2013-01-10 16:34:17",
"modified_by": "Administrator",
"modified": "2013-01-02 12:40:26"
"modified": "2013-01-14 14:03:52"
},
{
"autoname": "TASK.#####",
@@ -28,6 +28,8 @@
"parent": "Task",
"read": 1,
"doctype": "DocPerm",
"submit": 0,
"report": 1,
"parenttype": "DocType",
"role": "Projects User",
"parentfield": "permissions"
@@ -191,14 +193,6 @@
"fieldname": "act_end_date",
"fieldtype": "Date"
},
{
"oldfieldtype": "Data",
"doctype": "DocField",
"label": "Total Hours (Actual)",
"oldfieldname": "act_total_hrs",
"fieldname": "act_total_hrs",
"fieldtype": "Data"
},
{
"oldfieldtype": "Currency",
"doctype": "DocField",
@@ -253,7 +247,6 @@
"amend": 0,
"create": 0,
"doctype": "DocPerm",
"submit": 0,
"cancel": 0,
"permlevel": 1
}