Пример #1
0
	def on_cancel(self):
		for d in getlist(self.doclist, 'item_maintenance_detail'):
			if d.serial_no:
				serial_nos = get_valid_serial_nos(d.serial_no)
				self.update_amc_date(serial_nos)
				
		webnotes.conn.set(self.doc, 'status', 'Cancelled')
		delete_events(self.doc.doctype, self.doc.name)
Пример #2
0
    def on_cancel(self):
        for d in getlist(self.doclist, 'item_maintenance_detail'):
            if d.serial_no:
                serial_nos = get_valid_serial_nos(d.serial_no)
                self.update_amc_date(serial_nos)

        webnotes.conn.set(self.doc, 'status', 'Cancelled')
        delete_events(self.doc.doctype, self.doc.name)
def execute():
	from utilities.transaction_base import delete_events
	
	# delete orphaned Event User
	webnotes.conn.sql("""delete from `tabEvent User`
		where not exists(select name from `tabEvent` where `tabEvent`.name = `tabEvent User`.parent)""")
		
	for dt in ["Lead", "Opportunity", "Project"]:
		for ref_name in webnotes.conn.sql_list("""select ref_name 
			from `tabEvent` where ref_type=%s and ifnull(starts_on, '')='' """, dt):
				if webnotes.conn.exists(dt, ref_name):
					if dt in ["Lead", "Opportunity"]:
						webnotes.get_obj(dt, ref_name).add_calendar_event(force=True)
					else:
						webnotes.get_obj(dt, ref_name).add_calendar_event()
				else:
					# remove events where ref doc doesn't exist
					delete_events(dt, ref_name)
Пример #4
0
	def add_calendar_event(self):
		# delete any earlier event for this project
		delete_events(self.doc.doctype, self.doc.name)
		
		# add events
		for milestone in self.doclist.get({"parentfield": "project_milestones"}):
			if milestone.milestone_date:
				description = (milestone.milestone or "Milestone") + " for " + self.doc.name
				webnotes.bean({
					"doctype": "Event",
					"owner": self.doc.owner,
					"subject": description,
					"description": description,
					"starts_on": milestone.milestone_date + " 10:00:00",
					"event_type": "Private",
					"ref_type": self.doc.doctype,
					"ref_name": self.doc.name
				}).insert()
Пример #5
0
    def add_calendar_event(self):
        # delete any earlier event for this project
        delete_events(self.doc.doctype, self.doc.name)

        # add events
        for milestone in self.doclist.get(
            {"parentfield": "project_milestones"}):
            if milestone.milestone_date:
                description = (milestone.milestone
                               or "Milestone") + " for " + self.doc.name
                webnotes.bean({
                    "doctype": "Event",
                    "owner": self.doc.owner,
                    "subject": description,
                    "description": description,
                    "starts_on": milestone.milestone_date + " 10:00:00",
                    "event_type": "Private",
                    "ref_type": self.doc.doctype,
                    "ref_name": self.doc.name
                }).insert()
Пример #6
0
def execute():
    from utilities.transaction_base import delete_events

    # delete orphaned Event User
    webnotes.conn.sql("""delete from `tabEvent User`
		where not exists(select name from `tabEvent` where `tabEvent`.name = `tabEvent User`.parent)"""
                      )

    for dt in ["Lead", "Opportunity", "Project"]:
        for ref_name in webnotes.conn.sql_list(
                """select ref_name 
			from `tabEvent` where ref_type=%s and ifnull(starts_on, '')='' """, dt):
            if webnotes.conn.exists(dt, ref_name):
                if dt in ["Lead", "Opportunity"]:
                    webnotes.get_obj(dt,
                                     ref_name).add_calendar_event(force=True)
                else:
                    webnotes.get_obj(dt, ref_name).add_calendar_event()
            else:
                # remove events where ref doc doesn't exist
                delete_events(dt, ref_name)
Пример #7
0
	def on_trash(self):
		delete_events(self.doc.doctype, self.doc.name)