fix: Added 'status' field in Payment Entry (#19507)

This commit is contained in:
Marica 2019-11-06 18:12:29 +05:30 committed by Nabin Hait
parent d743583bf4
commit 1beed7db72
4 changed files with 30 additions and 1 deletions

View File

@ -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",

View File

@ -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()

View File

@ -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

View File

@ -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;""")