[minor] [fix] status updater, only change communication status when called explicitly
This commit is contained in:
parent
9dda0fb63b
commit
acc876e0d7
@ -88,17 +88,21 @@ class StatusUpdater(DocListController):
|
|||||||
webnotes.conn.set_value(self.doc.doctype, self.doc.name, "status", self.doc.status)
|
webnotes.conn.set_value(self.doc.doctype, self.doc.name, "status", self.doc.status)
|
||||||
|
|
||||||
def on_communication(self):
|
def on_communication(self):
|
||||||
|
self.communication_set = True
|
||||||
self.set_status(update=True)
|
self.set_status(update=True)
|
||||||
|
del self.communication_set
|
||||||
|
|
||||||
def communication_received(self):
|
def communication_received(self):
|
||||||
last_comm = self.doclist.get({"doctype":"Communication"})
|
if getattr(self, "communication_set", False):
|
||||||
if last_comm:
|
last_comm = self.doclist.get({"doctype":"Communication"})
|
||||||
return last_comm[-1].sent_or_received == "Received"
|
if last_comm:
|
||||||
|
return last_comm[-1].sent_or_received == "Received"
|
||||||
|
|
||||||
def communication_sent(self):
|
def communication_sent(self):
|
||||||
last_comm = self.doclist.get({"doctype":"Communication"})
|
if getattr(self, "communication_set", False):
|
||||||
if last_comm:
|
last_comm = self.doclist.get({"doctype":"Communication"})
|
||||||
return last_comm[-1].sent_or_received == "Sent"
|
if last_comm:
|
||||||
|
return last_comm[-1].sent_or_received == "Sent"
|
||||||
|
|
||||||
def validate_qty(self):
|
def validate_qty(self):
|
||||||
"""
|
"""
|
||||||
|
@ -36,12 +36,12 @@ def execute():
|
|||||||
webnotes.conn.sql("""update `tab%s` set status=%s where status=%s""" % \
|
webnotes.conn.sql("""update `tab%s` set status=%s where status=%s""" % \
|
||||||
(dt, "%s", "%s"), (status[1], status[0]))
|
(dt, "%s", "%s"), (status[1], status[0]))
|
||||||
|
|
||||||
# for dt in ["Lead", "Opportunity"]:
|
for dt in ["Lead", "Opportunity"]:
|
||||||
# for name in webnotes.conn.sql_list("""select name from `tab%s`""" % dt):
|
for name in webnotes.conn.sql_list("""select name from `tab%s`""" % dt):
|
||||||
# bean = webnotes.bean(dt, name)
|
bean = webnotes.bean(dt, name)
|
||||||
# before_status = bean.doc.status
|
before_status = bean.doc.status
|
||||||
# bean.get_controller().set_status()
|
bean.get_controller().set_status()
|
||||||
#
|
|
||||||
# if bean.doc.status != before_status:
|
if bean.doc.status != before_status:
|
||||||
# webnotes.conn.sql("""update `tab%s` set status=%s where name=%s""" % (dt, "%s", "%s"),
|
webnotes.conn.sql("""update `tab%s` set status=%s where name=%s""" % (dt, "%s", "%s"),
|
||||||
# (bean.doc.status, name))
|
(bean.doc.status, name))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user