From 14422eaf59e24d2d1b6dbcd3dfd9825f1adea2fd Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Wed, 25 May 2022 20:06:31 +0530 Subject: [PATCH] chore: Update test cases --- erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py | 2 +- erpnext/healthcare/doctype/lab_test/test_lab_test.py | 1 + .../doctype/patient_appointment/patient_appointment.py | 4 ++++ erpnext/healthcare/doctype/therapy_plan/therapy_plan.py | 5 +++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py index 4b81a7d6a23..5701402811e 100644 --- a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py @@ -712,7 +712,7 @@ class TestPricingRule(unittest.TestCase): title="_Test Pricing Rule with Min Qty - 2", ) - si = create_sales_invoice(do_not_submit=True, customer="_Test Customer 1", qty=1, currency="USD") + si = create_sales_invoice(do_not_submit=True, customer="_Test Customer 1", qty=1) item = si.items[0] item.stock_qty = 1 si.save() diff --git a/erpnext/healthcare/doctype/lab_test/test_lab_test.py b/erpnext/healthcare/doctype/lab_test/test_lab_test.py index 06c02d1ea07..c08820f36be 100644 --- a/erpnext/healthcare/doctype/lab_test/test_lab_test.py +++ b/erpnext/healthcare/doctype/lab_test/test_lab_test.py @@ -164,6 +164,7 @@ def create_sales_invoice(): sales_invoice.customer = frappe.db.get_value("Patient", patient, "customer") sales_invoice.due_date = getdate() sales_invoice.company = "_Test Company" + sales_invoice.currency = "INR" sales_invoice.debit_to = get_receivable_account("_Test Company") tests = [insulin_resistance_template, blood_test_template] diff --git a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py index b6e30060437..34aa8650e19 100755 --- a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py +++ b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py @@ -12,6 +12,7 @@ from frappe.model.document import Document from frappe.model.mapper import get_mapped_doc from frappe.utils import flt, get_link_to_form, get_time, getdate +from erpnext import get_company_currency from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import ( get_income_account, get_receivable_account, @@ -252,6 +253,9 @@ def create_sales_invoice(appointment_doc): sales_invoice = frappe.new_doc("Sales Invoice") sales_invoice.patient = appointment_doc.patient sales_invoice.customer = frappe.get_value("Patient", appointment_doc.patient, "customer") + sales_invoice.currency = frappe.get_value( + "Customer", sales_invoice.customer, "default_currency" + ) or get_company_currency(appointment_doc.currency) sales_invoice.appointment = appointment_doc.name sales_invoice.due_date = getdate() sales_invoice.company = appointment_doc.company diff --git a/erpnext/healthcare/doctype/therapy_plan/therapy_plan.py b/erpnext/healthcare/doctype/therapy_plan/therapy_plan.py index 44f0a9785c4..6cb2a24e6af 100644 --- a/erpnext/healthcare/doctype/therapy_plan/therapy_plan.py +++ b/erpnext/healthcare/doctype/therapy_plan/therapy_plan.py @@ -6,6 +6,8 @@ import frappe from frappe.model.document import Document from frappe.utils import flt +from erpnext import get_company_currency + class TherapyPlan(Document): def validate(self): @@ -72,6 +74,9 @@ def make_sales_invoice(reference_name, patient, company, therapy_plan_template): si.company = company si.patient = patient si.customer = frappe.db.get_value("Patient", patient, "customer") + si.currency = frappe.get_value( + "Customer", si.customer, "default_currency" + ) or get_company_currency(si.company) item = frappe.db.get_value("Therapy Plan Template", therapy_plan_template, "linked_item") price_list, price_list_currency = frappe.db.get_values(