def validate(self): self.update_status() self.set_lead_contact(self.raised_by) if self.status == "Closed": from frappe.desk.form.assign_to import clear clear(self.doctype, self.name)
def validate(self): #Start of Inser By Basawaraj on 20th June For Ticket #1 in BitBucket/Customization #Below statement checks if address is entered or not if self.workflow_state =="Complaint Open": if not self.customer_address: frappe.throw("Please Enter Customer Address") if self.workflow_state =="Complaint Closed By Branch": if not self.service_record_details: frappe.throw(("Please Enter Service Record Details Before Closing the Complaint")) cur_date = now_datetime().date() self.complaint_closed_date = cur_date self.status = "Closed" self.resolution_date = now() #End of Inser By Basawaraj on 20th June For Ticket #1 in BitBucket/Customization if not self.raised_by: self.raised_by = frappe.session.user self.update_status() self.set_lead_contact(self.raised_by) if self.status == "Closed": from frappe.desk.form.assign_to import clear clear(self.doctype, self.name)
def validate(self): self.validate_dates() if self.status != self.get_db_value( "status") and self.status == "Closed": from frappe.desk.form.assign_to import clear clear(self.doctype, self.name)
def validate_status(self): if self.status!=self.get_db_value("status") and self.status == "Closed": for d in self.depends_on: if frappe.db.get_value("Task", d.task, "status") != "Closed": frappe.throw(_("Cannot close task as its dependant task {0} is not closed.").format(d.task)) from frappe.desk.form.assign_to import clear clear(self.doctype, self.name)
def validate(self): if (self.get("__islocal") and self.via_customer_portal): self.flags.create_communication = True if not self.raised_by: self.raised_by = frappe.session.user self.update_status() self.set_lead_contact(self.raised_by) if self.status == "Closed": from frappe.desk.form.assign_to import clear clear(self.doctype, self.name)
def do_assignment(self, doc): # clear existing assignment, to reassign assign_to.clear(doc.get('doctype'), doc.get('name')) user = self.get_user() assign_to.add( dict(assign_to=user, doctype=doc.get('doctype'), name=doc.get('name'), description=frappe.render_template(self.description, doc), assignment_rule=self.name)) # set for reference in round robin self.db_set('last_user', user)
def validate(self): if not self.raised_by: self.raised_by = frappe.session.user self.update_status() self.set_lead_contact(self.raised_by) self.validate_due_date() # set contact name if not set # if self.contact != "" and not self.contact_name: # d = frappe.get_doc("Contact", self.contact) # self.contact_name = d.first_name + " " + d.last_name if self.status == "Closed": from frappe.desk.form.assign_to import clear clear(self.doctype, self.name)
def do_assignment(self, doc): # clear existing assignment, to reassign assign_to.clear(doc.get('doctype'), doc.get('name')) user = self.get_user() assign_to.add( dict(assign_to=[user], doctype=doc.get('doctype'), name=doc.get('name'), description=frappe.render_template(self.description, doc), assignment_rule=self.name, notify=True, date=doc.get(self.due_date_based_on) if self.due_date_based_on else None)) # set for reference in round robin self.db_set('last_user', user)
def unassign_todo(self): if self.status == "Closed" or self.status == "Cancelled": from frappe.desk.form.assign_to import clear clear(self.doctype, self.name)
def validate(self): self.validate_dates() if self.status!=self.get_db_value("status") and self.status == "Closed": from frappe.desk.form.assign_to import clear clear(self.doctype, self.name)
def clear_assignment(self, doc): """Clear assignments""" if self.safe_eval("unassign_condition", doc): return assign_to.clear(doc.get("doctype"), doc.get("name"))
def unassign_todo(self): if self.status == "Completed" and frappe.db.get_single_value( "Projects Settings", "remove_assignment_on_task_completion"): close_all_assignments(self.doctype, self.name) if self.status == "Cancelled": clear(self.doctype, self.name)
def unassign_todo(self): if self.status == "Completed": close_all_assignments(self.doctype, self.name) if self.status == "Cancelled": clear(self.doctype, self.name)
def unassign_todo(self): if self.status in ("Completed", "Cancelled"): from frappe.desk.form.assign_to import clear clear(self.doctype, self.name)
def clear_assignment(self, doc): '''Clear assignments''' if self.safe_eval('unassign_condition', doc): return assign_to.clear(doc.get('doctype'), doc.get('name'))