Ejemplo n.º 1
0
	def on_recurring(self, reference_doc):
		mcount = month_map[reference_doc.recurring_type]
		self.set("delivery_date", get_next_date(reference_doc.delivery_date, mcount,
			cint(reference_doc.repeat_on_day_of_month)))

		for d in self.get("items"):
			reference_delivery_date = frappe.db.get_value("Sales Order Item",
				{"parent": reference_doc.name, "item_code": d.item_code, "idx": d.idx}, "delivery_date")

			d.set("delivery_date",
				get_next_date(reference_delivery_date, mcount, cint(reference_doc.repeat_on_day_of_month)))
Ejemplo n.º 2
0
	def _test(i):
		obj.assertEquals(i+1, frappe.db.sql("""select count(*) from `tab%s`
			where recurring_id=%s and (docstatus=1 or docstatus=0)""" % (base_doc.doctype, '%s'),
			(base_doc.recurring_id))[0][0])

		next_date = get_next_date(base_doc.get(date_field), no_of_months,
			base_doc.repeat_on_day_of_month)

		manage_recurring_documents(base_doc.doctype, next_date=next_date, commit=False)

		recurred_documents = frappe.db.sql("""select name from `tab%s`
			where recurring_id=%s and (docstatus=1 or docstatus=0) order by name desc"""
			% (base_doc.doctype, '%s'), (base_doc.recurring_id))

		obj.assertEquals(i+2, len(recurred_documents))

		new_doc = frappe.get_doc(base_doc.doctype, recurred_documents[0][0])

		for fieldname in ["is_recurring", "recurring_type",
			"repeat_on_day_of_month", "notification_email_address"]:
				obj.assertEquals(base_doc.get(fieldname),
					new_doc.get(fieldname))

		obj.assertEquals(new_doc.get(date_field), getdate(next_date))

		obj.assertEquals(new_doc.from_date,	getdate(add_months(base_doc.from_date, no_of_months)))

		if first_and_last_day:
			obj.assertEquals(new_doc.to_date, getdate(get_last_day(add_months(base_doc.to_date, no_of_months))))
		else:
			obj.assertEquals(new_doc.to_date, getdate(add_months(base_doc.to_date, no_of_months)))

		return new_doc
	def _test(i):
		obj.assertEquals(i+1, frappe.db.sql("""select count(*) from `tab%s`
			where recurring_id=%s and (docstatus=1 or docstatus=0)""" % (base_doc.doctype, '%s'),
			(base_doc.recurring_id))[0][0])

		next_date = get_next_date(base_doc.get(date_field), no_of_months,
			base_doc.repeat_on_day_of_month)

		manage_recurring_documents(base_doc.doctype, next_date=next_date, commit=False)

		recurred_documents = frappe.db.sql("""select name from `tab%s`
			where recurring_id=%s and (docstatus=1 or docstatus=0) order by name desc"""
			% (base_doc.doctype, '%s'), (base_doc.recurring_id))

		obj.assertEquals(i+2, len(recurred_documents))

		new_doc = frappe.get_doc(base_doc.doctype, recurred_documents[0][0])

		for fieldname in ["is_recurring", "recurring_type",
			"repeat_on_day_of_month", "notification_email_address"]:
				obj.assertEquals(base_doc.get(fieldname),
					new_doc.get(fieldname))

		obj.assertEquals(new_doc.get(date_field), getdate(next_date))

		obj.assertEquals(new_doc.from_date,	getdate(add_months(base_doc.from_date, no_of_months)))

		if first_and_last_day:
			obj.assertEquals(new_doc.to_date, getdate(get_last_day(add_months(base_doc.to_date, no_of_months))))
		else:
			obj.assertEquals(new_doc.to_date, getdate(add_months(base_doc.to_date, no_of_months)))

		return new_doc
Ejemplo n.º 4
0
	def on_recurring(self, reference_doc):
		mcount = month_map[reference_doc.recurring_type]
		self.set("delivery_date", get_next_date(reference_doc.delivery_date, mcount,
						cint(reference_doc.repeat_on_day_of_month)))
Ejemplo n.º 5
0
	def on_recurring(self, reference_doc):
		mcount = month_map[reference_doc.recurring_type]
		self.set("delivery_date", get_next_date(reference_doc.delivery_date, mcount,
						cint(reference_doc.repeat_on_day_of_month)))