diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.json b/erpnext/accounts/doctype/payment_entry/payment_entry.json index 96e1e1eb162..5a53a0e4214 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.json +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.json @@ -1791,6 +1791,41 @@ "translatable": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Draft", + "fetch_if_empty": 0, + "fieldname": "status", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Status", + "length": 0, + "no_copy": 0, + "options": "\nDraft\nSubmitted\nCancelled", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_in_quick_entry": 0, @@ -2205,7 +2240,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2019-03-27 17:39:54.163016", + "modified": "2019-11-06 15:15:45.223497", "modified_by": "Administrator", "module": "Accounts", "name": "Payment Entry", diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index d57f2c59052..21634c1df3c 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -60,6 +60,7 @@ class PaymentEntry(AccountsController): self.validate_duplicate_entry() self.validate_allocated_amount() self.ensure_supplier_is_not_blocked() + self.set_status() def on_submit(self): self.setup_party_account_field() @@ -69,6 +70,7 @@ class PaymentEntry(AccountsController): self.update_outstanding_amounts() self.update_advance_paid() self.update_expense_claim() + self.set_status() def on_cancel(self): @@ -78,6 +80,7 @@ class PaymentEntry(AccountsController): self.update_advance_paid() self.update_expense_claim() self.delink_advance_entry_references() + self.set_status() def update_outstanding_amounts(self): self.set_missing_ref_details(force=True) @@ -274,6 +277,14 @@ class PaymentEntry(AccountsController): frappe.throw(_("Against Journal Entry {0} does not have any unmatched {1} entry") .format(d.reference_name, dr_or_cr)) + def set_status(self): + if self.docstatus == 2: + self.status = 'Cancelled' + elif self.docstatus == 1: + self.status = 'Submitted' + else: + self.status = 'Draft' + def set_amounts(self): self.set_amounts_in_company_currency() self.set_total_allocated_amount() diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 37a91d07783..3928c639ca4 100755 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -607,3 +607,4 @@ erpnext.patches.v11_1.set_quotation_status erpnext.patches.v11_1.update_default_supplier_in_item_defaults erpnext.patches.v11_1.set_status_for_material_request_type_manufacture erpnext.patches.v11_1.set_produced_qty_field_in_sales_order_for_work_order +erpnext.patches.v11_1.set_payment_entry_status \ No newline at end of file diff --git a/erpnext/patches/v11_1/set_payment_entry_status.py b/erpnext/patches/v11_1/set_payment_entry_status.py new file mode 100644 index 00000000000..af95ed7e8b5 --- /dev/null +++ b/erpnext/patches/v11_1/set_payment_entry_status.py @@ -0,0 +1,8 @@ +import frappe + +def execute(): + frappe.db.sql("""update `tabPayment Entry` set status = CASE + WHEN docstatus = 1 THEN 'Submitted' + WHEN docstatus = 2 THEN 'Cancelled' + ELSE 'Draft' + END;""") \ No newline at end of file