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
def create_new_invoice(prev_rv): # clone rv new_rv = clone(prev_rv) # 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.owner = prev_rv.doc.owner new_rv.doc.save() # submit and after submit new_rv.submit() new_rv.update_after_submit() return new_rv
def create_new_invoice(prev_rv): # clone rv new_rv = clone(prev_rv) # 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_month_date(new_rv.doc.invoice_period_from_date) new_rv.doc.invoice_period_to_date = get_next_month_date(new_rv.doc.invoice_period_to_date) 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
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