From a4d55c98582999ed0e98135703ece8166d7009b4 Mon Sep 17 00:00:00 2001 From: Mangesh-Khairnar Date: Wed, 8 May 2019 16:04:18 +0530 Subject: [PATCH] feat: assign pe status on creation of payment order --- .../doctype/payment_order/payment_order.json | 28 +++++++++++-------- .../doctype/payment_order/payment_order.py | 12 ++++---- .../payment_order_reference.json | 5 ++-- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/erpnext/accounts/doctype/payment_order/payment_order.json b/erpnext/accounts/doctype/payment_order/payment_order.json index 0018359134..285168f247 100644 --- a/erpnext/accounts/doctype/payment_order/payment_order.json +++ b/erpnext/accounts/doctype/payment_order/payment_order.json @@ -11,7 +11,7 @@ "party", "column_break_2", "posting_date", - "bank", + "company_bank", "company_bank_account", "section_break_5", "references", @@ -23,6 +23,7 @@ "fieldname": "naming_series", "fieldtype": "Select", "label": "Series", + "no_copy": 1, "options": "PMO-", "reqd": 1 }, @@ -34,6 +35,7 @@ "reqd": 1 }, { + "depends_on": "eval: doc.payment_order_type=='Payment Request';", "fieldname": "party", "fieldtype": "Link", "in_list_view": 1, @@ -51,14 +53,6 @@ "in_list_view": 1, "label": "Posting Date" }, - { - "fetch_from": "Company.default_bank", - "fieldname": "bank", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Bank", - "options": "Bank" - }, { "fieldname": "section_break_5", "fieldtype": "Section Break" @@ -84,17 +78,27 @@ "fieldname": "payment_order_type", "fieldtype": "Select", "label": "Payment Order Type", - "options": "\nPayment Request\nPayment Entry" + "options": "\nPayment Request\nPayment Entry", + "reqd": 1 }, { "fieldname": "company_bank_account", "fieldtype": "Link", "label": "Company Bank Account", - "options": "Bank Account" + "options": "Bank Account", + "reqd": 1 + }, + { + "fetch_from": "company_bank_account.bank", + "fieldname": "company_bank", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Bank", + "options": "Bank" } ], "is_submittable": 1, - "modified": "2019-05-06 19:57:03.661653", + "modified": "2019-05-08 16:00:09.027739", "modified_by": "Administrator", "module": "Accounts", "name": "Payment Order", diff --git a/erpnext/accounts/doctype/payment_order/payment_order.py b/erpnext/accounts/doctype/payment_order/payment_order.py index 8491bb7e10..2a29293bbf 100644 --- a/erpnext/accounts/doctype/payment_order/payment_order.py +++ b/erpnext/accounts/doctype/payment_order/payment_order.py @@ -11,18 +11,18 @@ from frappe.model.document import Document class PaymentOrder(Document): def on_submit(self): - self.update_payment_request_status() + self.update_payment_status() def on_cancel(self): - self.update_payment_request_status(cancel=True) + self.update_payment_status(cancel=True) - def update_payment_request_status(self, cancel=False): + def update_payment_status(self, cancel=False): status = 'Payment Ordered' if cancel: status = 'Initiated' for d in self.references: - frappe.db.set_value('Payment Request', d.payment_request, 'status', status) + frappe.db.set_value(self.payment_order_type, d.get(frappe.scrub(self.payment_order_type)), 'status', status) def get_mop_query(doctype, txt, searchfield, start, page_len, filters): return frappe.db.sql(""" select mode_of_payment from `tabPayment Order Reference` @@ -60,7 +60,7 @@ def make_journal_entry(doc, supplier, mode_of_payment=None): je.voucher_type = 'Bank Entry' if mode_of_payment and mode_of_payment_type.get(mode_of_payment) == 'Cash': je.voucher_type = "Cash Entry" - + paid_amt = 0 party_account = get_party_account('Supplier', supplier, doc.company) for d in doc.references: @@ -84,4 +84,4 @@ def make_journal_entry(doc, supplier, mode_of_payment=None): je.flags.ignore_mandatory = True je.save() - frappe.msgprint(_("{0} {1} created").format(je.doctype, je.name)) + frappe.msgprint(_("{0} {1} created").format(je.doctype, je.name)) \ No newline at end of file diff --git a/erpnext/accounts/doctype/payment_order_reference/payment_order_reference.json b/erpnext/accounts/doctype/payment_order_reference/payment_order_reference.json index d0ee93b1e1..db0b76135d 100644 --- a/erpnext/accounts/doctype/payment_order_reference/payment_order_reference.json +++ b/erpnext/accounts/doctype/payment_order_reference/payment_order_reference.json @@ -82,7 +82,8 @@ "fieldtype": "Link", "label": "Bank Account", "options": "Bank Account", - "read_only": 1 + "read_only": 1, + "reqd": 1 }, { "fieldname": "column_break_10", @@ -112,7 +113,7 @@ } ], "istable": 1, - "modified": "2019-05-05 22:23:32.723766", + "modified": "2019-05-08 13:56:25.724557", "modified_by": "Administrator", "module": "Accounts", "name": "Payment Order Reference",