diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 6e3990ac8d..4b1837d4d7 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -411,10 +411,10 @@ class SalesInvoice(SellingController): throw(_("Customer {0} does not belong to project {1}").format(self.customer,self.project)) def validate_pos(self): - if flt(self.paid_amount) + flt(self.write_off_amount) \ - - flt(self.grand_total) > 1/(10**(self.precision("grand_total") + 1)) and self.is_return: - frappe.throw(_("""Paid amount + Write Off Amount can not be greater than Grand Total""")) - + if self.is_return: + if flt(self.paid_amount) + flt(self.write_off_amount) - flt(self.grand_total) < \ + 1/(10**(self.precision("grand_total") + 1)): + frappe.throw(_("Paid amount + Write Off Amount can not be greater than Grand Total")) def validate_item_code(self): for d in self.get('items'): diff --git a/erpnext/patches/v7_2/update_assessment_modules.py b/erpnext/patches/v7_2/update_assessment_modules.py index 9c00902f86..ec8577040e 100644 --- a/erpnext/patches/v7_2/update_assessment_modules.py +++ b/erpnext/patches/v7_2/update_assessment_modules.py @@ -7,13 +7,15 @@ def execute(): frappe.rename_doc("DocType", "Grade Interval", "Grading Scale Interval", force=True) frappe.reload_doc("schools", "doctype", "grading_scale_interval") - rename_field("Grading Scale Interval", "to_score", "threshold") + if "to_score" in frappe.db.get_table_columns("Grading Scale Interval"): + rename_field("Grading Scale Interval", "to_score", "threshold") frappe.rename_doc("DocType", "Assessment", "Assessment Plan", force=True) #Rename Assessment Results frappe.reload_doc("schools", "doctype", "assessment_plan") - rename_field("Assessment Plan", "grading_structure", "grading_scale") + if "grading_structure" in frappe.db.get_table_columns("Assessment Plan"): + rename_field("Assessment Plan", "grading_structure", "grading_scale") frappe.reload_doc("schools", "doctype", "assessment_result") frappe.reload_doc("schools", "doctype", "assessment_result_detail")