diff --git a/erpnext/loan_management/doctype/loan/test_loan.py b/erpnext/loan_management/doctype/loan/test_loan.py index 1f771c2090c..c65996e65f2 100644 --- a/erpnext/loan_management/doctype/loan/test_loan.py +++ b/erpnext/loan_management/doctype/loan/test_loan.py @@ -79,10 +79,12 @@ class TestLoan(unittest.TestCase): "qty": 4000.00, }] - loan_application = create_loan_application('_Test Company', self.applicant2, 'Stock Loan', pledge, "Repay Over Number of Periods", 12) + loan_application = create_loan_application('_Test Company', self.applicant2, + 'Stock Loan', pledge, "Repay Over Number of Periods", 12) create_pledge(loan_application) - loan = create_loan_with_security(self.applicant2, "Stock Loan", "Repay Over Number of Periods", 12, loan_application) + loan = create_loan_with_security(self.applicant2, "Stock Loan", "Repay Over Number of Periods", + 12, loan_application) self.assertEquals(loan.loan_amount, 1000000) def test_loan_disbursement(self): @@ -92,6 +94,7 @@ class TestLoan(unittest.TestCase): }] loan_application = create_loan_application('_Test Company', self.applicant2, 'Stock Loan', pledge, "Repay Over Number of Periods", 12) + create_pledge(loan_application) loan = create_loan_with_security(self.applicant2, "Stock Loan", "Repay Over Number of Periods", 12, loan_application) @@ -217,7 +220,8 @@ class TestLoan(unittest.TestCase): "qty": 2000.00 }] - loan_application = create_loan_application('_Test Company', self.applicant2, 'Stock Loan', pledges) + loan_application = create_loan_application('_Test Company', self.applicant2, 'Stock Loan', pledges, + "Repay Over Number of Periods", 12) create_pledge(loan_application) loan = create_loan_with_security(self.applicant2, "Stock Loan", "Repay Over Number of Periods", 12, loan_application, @@ -247,7 +251,9 @@ class TestLoan(unittest.TestCase): "haircut": 50, }] - loan_application = create_loan_application('_Test Company', self.applicant2, 'Stock Loan', pledges) + loan_application = create_loan_application('_Test Company', self.applicant2, + 'Stock Loan', pledges, "Repay Over Number of Periods", 12) + create_pledge(loan_application) loan = create_loan_with_security(self.applicant2, "Stock Loan", "Repay Over Number of Periods", 12, loan_application) diff --git a/erpnext/payroll/doctype/salary_slip/test_salary_slip.py b/erpnext/payroll/doctype/salary_slip/test_salary_slip.py index be9a2d37284..37cd89a7349 100644 --- a/erpnext/payroll/doctype/salary_slip/test_salary_slip.py +++ b/erpnext/payroll/doctype/salary_slip/test_salary_slip.py @@ -105,7 +105,7 @@ class TestSalarySlip(unittest.TestCase): #Gross pay calculation based on attendances gross_pay = 78000 - ((78000 / (days_in_month - no_of_holidays)) * flt(ss.leave_without_pay)) - self.assertEqual(ss.gross_pay, gross_pay) + self.assertEqual(flt(ss.gross_pay, 2), flt(gross_pay, 2)) frappe.db.set_value("Payroll Settings", None, "payroll_based_on", "Leave") diff --git a/erpnext/regional/united_arab_emirates/utils.py b/erpnext/regional/united_arab_emirates/utils.py index 772bbf5914b..a0425f6b1c2 100644 --- a/erpnext/regional/united_arab_emirates/utils.py +++ b/erpnext/regional/united_arab_emirates/utils.py @@ -11,14 +11,17 @@ def update_itemised_tax_data(doc): for row in doc.items: tax_rate = 0.0 - item_tax_rate = frappe.parse_json(row.item_tax_rate) + item_tax_rate = 0.0 + + if row.item_tax_rate: + item_tax_rate = frappe.parse_json(row.item_tax_rate) # First check if tax rate is present # If not then look up in item_wise_tax_detail if item_tax_rate: for account, rate in iteritems(item_tax_rate): tax_rate += rate - elif itemised_tax.get(row.item_code): + elif row.item_code and itemised_tax.get(row.item_code): tax_rate = sum([tax.get('tax_rate', 0) for d, tax in itemised_tax.get(row.item_code).items()]) row.tax_rate = flt(tax_rate, row.precision("tax_rate"))