[fix] Reset recurring id on amendment
This commit is contained in:
parent
79a6fc9a84
commit
7504ea7033
@ -48,9 +48,12 @@ class AccountsController(TransactionBase):
|
||||
self.validate_party()
|
||||
self.validate_currency()
|
||||
|
||||
if self.meta.get_field("is_recurring") and not self.get("__islocal"):
|
||||
validate_recurring_document(self)
|
||||
convert_to_recurring(self, self.get("posting_date") or self.get("transaction_date"))
|
||||
if self.meta.get_field("is_recurring"):
|
||||
if self.amended_from and self.recurring_id:
|
||||
self.recurring_id = None
|
||||
if not self.get("__islocal"):
|
||||
validate_recurring_document(self)
|
||||
convert_to_recurring(self, self.get("posting_date") or self.get("transaction_date"))
|
||||
|
||||
def on_update_after_submit(self):
|
||||
if self.meta.get_field("is_recurring"):
|
||||
|
@ -182,12 +182,11 @@ def convert_to_recurring(doc, posting_date):
|
||||
|
||||
set_next_date(doc, posting_date)
|
||||
|
||||
elif doc.recurring_id:
|
||||
frappe.db.sql("""update `tab%s` set is_recurring = 0
|
||||
where recurring_id = %s""" % (doc.doctype, '%s'), (doc.recurring_id))
|
||||
if doc.next_date:
|
||||
validate_recurring_next_date(doc)
|
||||
|
||||
if doc.next_date:
|
||||
validate_recurring_next_date(doc)
|
||||
elif doc.recurring_id:
|
||||
doc.db_set("recurring_id", None)
|
||||
|
||||
def validate_notification_email_id(doc):
|
||||
if doc.notify_by_email:
|
||||
|
Loading…
x
Reference in New Issue
Block a user