fix: multiple changes

This commit is contained in:
Mangesh-Khairnar
2019-05-15 15:50:50 +05:30
parent cf71a84976
commit 6e3586423f
3 changed files with 12 additions and 9 deletions

View File

@@ -7,7 +7,7 @@
"type_of_payment", "type_of_payment",
"naming_series", "naming_series",
"payment_type", "payment_type",
"status", "payment_order_status",
"column_break_5", "column_break_5",
"posting_date", "posting_date",
"company", "company",
@@ -548,14 +548,16 @@
"options": "Bank Account" "options": "Bank Account"
}, },
{ {
"fieldname": "status", "fieldname": "payment_order_status",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 1,
"label": "Payment Order Status", "label": "Payment Order Status",
"options": "Initiated\nCompleted" "options": "Initiated\nPayment Ordered",
"read_only": 1
} }
], ],
"is_submittable": 1, "is_submittable": 1,
"modified": "2019-05-14 17:00:48.759155", "modified": "2019-05-15 15:43:29.229496",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Payment Entry", "name": "Payment Entry",

View File

@@ -21,8 +21,10 @@ class PaymentOrder(Document):
if cancel: if cancel:
status = 'Initiated' status = 'Initiated'
ref_field = "status" if self.payment_order_type == "Payment Request" else "payment_order_status"
for d in self.references: for d in self.references:
frappe.db.set_value(self.payment_order_type, d.get(frappe.scrub(self.payment_order_type)), 'status', status) frappe.db.set_value(self.payment_order_type, d.get(frappe.scrub(self.payment_order_type)), ref_field, status)
def get_mop_query(doctype, txt, searchfield, start, page_len, filters): def get_mop_query(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.sql(""" select mode_of_payment from `tabPayment Order Reference` return frappe.db.sql(""" select mode_of_payment from `tabPayment Order Reference`

View File

@@ -72,7 +72,6 @@ def get_batch_row(doc, no_of_records, total_amount, product_code):
batch.append(sanitize_data(doc.name, '_')[:20]) batch.append(sanitize_data(doc.name, '_')[:20])
batch.append(format_date(doc.posting_date)) batch.append(format_date(doc.posting_date))
batch.append(validate_field_size(product_code,"Product Code", 20)) batch.append(validate_field_size(product_code,"Product Code", 20))
print(batch)
return "~".join(batch) return "~".join(batch)
def get_detail_row(ref_doc, payment_entry, company_email): def get_detail_row(ref_doc, payment_entry, company_email):
@@ -172,7 +171,7 @@ def validate_amount(val, max_int_size):
int_size = len(str(val).split('.')[0]) int_size = len(str(val).split('.')[0])
if int_size > max_int_size: if int_size > max_int_size:
frappe.throw(_("Amount for a single transaction is more than maximum allowed amount, create a separate payment order by splitting the transactions")) frappe.throw(_("Amount for a single transaction exceeds maximum allowed amount, create a separate payment order by splitting the transactions"))
return val return val
@@ -182,10 +181,10 @@ def validate_information(obj, attr, max_size):
return validate_field_size(getattr(obj, attr), frappe.unscrub(attr), max_size) return validate_field_size(getattr(obj, attr), frappe.unscrub(attr), max_size)
else: else:
frappe.throw(_("%s is mandatory for generating remittance payments, set the field and try again" % attr)) frappe.throw(_("{0} is mandatory for generating remittance payments, set the field and try again".format(frappe.unscrub(attr))))
def validate_field_size(val, label, max_size): def validate_field_size(val, label, max_size):
''' check the size of the val ''' ''' check the size of the val '''
if len(cstr(val)) > max_size: if len(cstr(val)) > max_size:
frappe.throw("%s field is limited to size %d" % (label, max_size)) frappe.throw(_("{0} field is limited to size {1}".format(label, max_size)))
return cstr(val) return cstr(val)