示例#1
0
def make_new_invoice(ref_wrapper):
	from webnotes.model.wrapper import clone
	new_invoice = clone(ref_wrapper)
	
	mcount = month_map[ref_wrapper.doc.recurring_type]
	
	today = nowdate()
	
	new_invoice.doc.fields.update({
		"posting_date": today,
		"aging_date": today,
		
		"due_date": add_days(today, cint(date_diff(ref_wrapper.doc.due_date,
			ref_wrapper.doc.posting_date))),
			
		"invoice_period_from_date": \
			get_next_date(ref_wrapper.doc.invoice_period_from_date, mcount),
			
		"invoice_period_to_date": \
			get_next_date(ref_wrapper.doc.invoice_period_to_date, mcount),
		
		"owner": ref_wrapper.doc.owner,
	})
	
	new_invoice.submit()
	
	return new_invoice
示例#2
0
def make_new_invoice(ref_wrapper, posting_date):
	from webnotes.model.wrapper import clone
	from accounts.utils import get_fiscal_year
	new_invoice = clone(ref_wrapper)
	
	mcount = month_map[ref_wrapper.doc.recurring_type]
		
	new_invoice.doc.fields.update({
		"posting_date": posting_date,
		"aging_date": posting_date,
		
		"due_date": add_days(posting_date, cint(date_diff(ref_wrapper.doc.due_date,
			ref_wrapper.doc.posting_date))),
			
		"invoice_period_from_date": \
			get_next_date(ref_wrapper.doc.invoice_period_from_date, mcount),
			
		"invoice_period_to_date": \
			get_next_date(ref_wrapper.doc.invoice_period_to_date, mcount),
		"fiscal_year": get_fiscal_year(posting_date)[0],
		"owner": ref_wrapper.doc.owner,
	})
	
	new_invoice.submit()
	
	return new_invoice
示例#3
0
def create_new_invoice(prev_rv):
    # clone rv
    new_rv = clone(prev_rv)

    mdict = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, 'Yearly': 12}
    mcount = mdict[prev_rv.doc.recurring_type]

    # update new rv

    new_rv.doc.posting_date = new_rv.doc.next_date
    new_rv.doc.aging_date = new_rv.doc.next_date
    new_rv.doc.due_date = add_days(
        new_rv.doc.next_date,
        cint(date_diff(prev_rv.doc.due_date, prev_rv.doc.posting_date)))
    new_rv.doc.invoice_period_from_date = get_next_date(
        new_rv.doc.invoice_period_from_date, mcount)
    new_rv.doc.invoice_period_to_date = get_next_date(
        new_rv.doc.invoice_period_to_date, mcount)
    new_rv.doc.owner = prev_rv.doc.owner
    new_rv.doc.save()

    # submit and after submit
    new_rv.submit()
    new_rv.update_after_submit()

    return new_rv
示例#4
0
def make_new_invoice(ref_wrapper, posting_date):
    from webnotes.model.wrapper import clone
    from accounts.utils import get_fiscal_year
    new_invoice = clone(ref_wrapper)

    mcount = month_map[ref_wrapper.doc.recurring_type]

    new_invoice.doc.fields.update({
     "posting_date": posting_date,
     "aging_date": posting_date,

     "due_date": add_days(posting_date, cint(date_diff(ref_wrapper.doc.due_date,
      ref_wrapper.doc.posting_date))),

     "invoice_period_from_date": \
      get_next_date(ref_wrapper.doc.invoice_period_from_date, mcount),

     "invoice_period_to_date": \
      get_next_date(ref_wrapper.doc.invoice_period_to_date, mcount),
     "fiscal_year": get_fiscal_year(posting_date)[0],
     "owner": ref_wrapper.doc.owner,
    })

    new_invoice.submit()

    return new_invoice
示例#5
0
def create_new_invoice(prev_rv):
	# clone rv
	new_rv = clone(prev_rv)

	mdict = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, 'Yearly': 12}
	mcount = mdict[prev_rv.doc.recurring_type]

	# update new rv 

	new_rv.doc.posting_date = new_rv.doc.next_date
	new_rv.doc.aging_date = new_rv.doc.next_date
	new_rv.doc.due_date = add_days(new_rv.doc.next_date, cint(date_diff(prev_rv.doc.due_date, prev_rv.doc.posting_date)))
	new_rv.doc.invoice_period_from_date = get_next_date(new_rv.doc.invoice_period_from_date, mcount)
	new_rv.doc.invoice_period_to_date = get_next_date(new_rv.doc.invoice_period_to_date, mcount)
	new_rv.doc.owner = prev_rv.doc.owner
	new_rv.doc.save()

	# submit and after submit
	new_rv.submit()
	new_rv.update_after_submit()

	return new_rv