diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.json b/erpnext/accounts/doctype/payment_entry/payment_entry.json index a85eccd30a..acfc660c4f 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.json +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.json @@ -62,6 +62,7 @@ "dimension_col_break", "cost_center", "section_break_12", + "status", "remarks", "column_break_16", "letter_head", @@ -563,10 +564,18 @@ { "fieldname": "dimension_col_break", "fieldtype": "Column Break" + }, + { + "default": "Draft", + "fieldname": "status", + "fieldtype": "Select", + "label": "Status", + "options": "\nDraft\nSubmitted\nCancelled", + "read_only": 1 } ], "is_submittable": 1, - "modified": "2019-05-27 15:53:21.108857", + "modified": "2019-11-06 12:59:43.151721", "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 89aaffbc2d..bf7e833285 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -61,6 +61,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() @@ -70,6 +71,7 @@ class PaymentEntry(AccountsController): self.update_outstanding_amounts() self.update_advance_paid() self.update_expense_claim() + self.set_status() def on_cancel(self): @@ -79,6 +81,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) @@ -275,6 +278,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 ee6bdff661..cc00b7e412 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -641,3 +641,4 @@ erpnext.patches.v12_0.set_produced_qty_field_in_sales_order_for_work_order erpnext.patches.v12_0.generate_leave_ledger_entries erpnext.patches.v12_0.set_default_shopify_app_type erpnext.patches.v12_0.replace_accounting_with_accounts_in_home_settings +erpnext.patches.v12_0.set_payment_entry_status diff --git a/erpnext/patches/v12_0/set_payment_entry_status.py b/erpnext/patches/v12_0/set_payment_entry_status.py new file mode 100644 index 0000000000..af95ed7e8b --- /dev/null +++ b/erpnext/patches/v12_0/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