mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-13 03:45:08 +00:00
test: Update test cases for currency change validation
(cherry picked from commit 60915e874d)
# Conflicts:
# erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py
# erpnext/healthcare/doctype/patient_appointment/patient_appointment.py
# erpnext/healthcare/doctype/therapy_plan/therapy_plan.py
# erpnext/non_profit/doctype/membership/membership.py
This commit is contained in:
@@ -78,6 +78,10 @@ class TestPeriodClosingVoucher(unittest.TestCase):
|
||||
expense_account="Cost of Goods Sold - TPC",
|
||||
rate=400,
|
||||
debit_to="Debtors - TPC",
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
currency="USD"
|
||||
>>>>>>> 60915e874d (test: Update test cases for currency change validation)
|
||||
)
|
||||
create_sales_invoice(
|
||||
company=company,
|
||||
@@ -86,6 +90,10 @@ class TestPeriodClosingVoucher(unittest.TestCase):
|
||||
expense_account="Cost of Goods Sold - TPC",
|
||||
rate=200,
|
||||
debit_to="Debtors - TPC",
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
currency="USD"
|
||||
>>>>>>> 60915e874d (test: Update test cases for currency change validation)
|
||||
)
|
||||
|
||||
pcv = self.make_period_closing_voucher(submit=False)
|
||||
|
||||
@@ -1456,6 +1456,9 @@ class AccountsController(TransactionBase):
|
||||
if self.doctype not in ('Sales Invoice', 'Purchase Invoice'):
|
||||
return
|
||||
|
||||
if self.is_opening == 'Yes':
|
||||
return
|
||||
|
||||
party_type, party = self.get_party()
|
||||
party_gle_currency = get_party_gle_currency(party_type, party, self.company)
|
||||
party_account = self.get('debit_to') if self.doctype == 'Sales Invoice' else self.get('credit_to')
|
||||
|
||||
@@ -22,6 +22,7 @@ from erpnext.healthcare.utils import (
|
||||
manage_fee_validity,
|
||||
)
|
||||
from erpnext.hr.doctype.employee.employee import is_holiday
|
||||
<<<<<<< HEAD
|
||||
|
||||
|
||||
class MaximumCapacityError(frappe.ValidationError):
|
||||
@@ -31,6 +32,11 @@ class MaximumCapacityError(frappe.ValidationError):
|
||||
class OverlapError(frappe.ValidationError):
|
||||
pass
|
||||
|
||||
=======
|
||||
from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account, get_income_account
|
||||
from erpnext.healthcare.utils import check_fee_validity, get_service_item_and_practitioner_charge, manage_fee_validity
|
||||
from erpnext import get_company_currency
|
||||
>>>>>>> 60915e874d (test: Update test cases for currency change validation)
|
||||
|
||||
class PatientAppointment(Document):
|
||||
def validate(self):
|
||||
@@ -251,7 +257,13 @@ def invoice_appointment(appointment_doc):
|
||||
def create_sales_invoice(appointment_doc):
|
||||
sales_invoice = frappe.new_doc("Sales Invoice")
|
||||
sales_invoice.patient = appointment_doc.patient
|
||||
<<<<<<< HEAD
|
||||
sales_invoice.customer = frappe.get_value("Patient", appointment_doc.patient, "customer")
|
||||
=======
|
||||
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)
|
||||
>>>>>>> 60915e874d (test: Update test cases for currency change validation)
|
||||
sales_invoice.appointment = appointment_doc.name
|
||||
sales_invoice.due_date = getdate()
|
||||
sales_invoice.company = appointment_doc.company
|
||||
|
||||
@@ -4,8 +4,13 @@
|
||||
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
<<<<<<< HEAD
|
||||
from frappe.utils import flt
|
||||
|
||||
=======
|
||||
from frappe.utils import flt, today
|
||||
from erpnext import get_company_currency
|
||||
>>>>>>> 60915e874d (test: Update test cases for currency change validation)
|
||||
|
||||
class TherapyPlan(Document):
|
||||
def validate(self):
|
||||
@@ -71,7 +76,13 @@ def make_sales_invoice(reference_name, patient, company, therapy_plan_template):
|
||||
si = frappe.new_doc("Sales Invoice")
|
||||
si.company = company
|
||||
si.patient = patient
|
||||
<<<<<<< HEAD
|
||||
si.customer = frappe.db.get_value("Patient", patient, "customer")
|
||||
=======
|
||||
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)
|
||||
>>>>>>> 60915e874d (test: Update test cases for currency change validation)
|
||||
|
||||
item = frappe.db.get_value("Therapy Plan Template", therapy_plan_template, "linked_item")
|
||||
price_list, price_list_currency = frappe.db.get_values(
|
||||
|
||||
@@ -13,8 +13,12 @@ from frappe.model.document import Document
|
||||
from frappe.utils import add_days, add_months, add_years, get_link_to_form, getdate, nowdate
|
||||
|
||||
import erpnext
|
||||
<<<<<<< HEAD
|
||||
from erpnext.non_profit.doctype.member.member import create_member
|
||||
|
||||
=======
|
||||
from erpnext import get_company_currency
|
||||
>>>>>>> 60915e874d (test: Update test cases for currency change validation)
|
||||
|
||||
class Membership(Document):
|
||||
def validate(self):
|
||||
@@ -198,6 +202,7 @@ class Membership(Document):
|
||||
|
||||
|
||||
def make_invoice(membership, member, plan, settings):
|
||||
<<<<<<< HEAD
|
||||
invoice = frappe.get_doc(
|
||||
{
|
||||
"doctype": "Sales Invoice",
|
||||
@@ -209,6 +214,23 @@ def make_invoice(membership, member, plan, settings):
|
||||
"items": [{"item_code": plan.linked_item, "rate": membership.amount, "qty": 1}],
|
||||
}
|
||||
)
|
||||
=======
|
||||
invoice = frappe.get_doc({
|
||||
"doctype": "Sales Invoice",
|
||||
"customer": member.customer,
|
||||
"debit_to": settings.membership_debit_account,
|
||||
"currency": membership.currency or get_company_currency(settings.company),
|
||||
"company": settings.company,
|
||||
"is_pos": 0,
|
||||
"items": [
|
||||
{
|
||||
"item_code": plan.linked_item,
|
||||
"rate": membership.amount,
|
||||
"qty": 1
|
||||
}
|
||||
]
|
||||
})
|
||||
>>>>>>> 60915e874d (test: Update test cases for currency change validation)
|
||||
invoice.set_missing_values()
|
||||
invoice.insert()
|
||||
invoice.submit()
|
||||
|
||||
@@ -94,7 +94,7 @@ def make_membership(member, payload={}):
|
||||
"member": member,
|
||||
"membership_status": "Current",
|
||||
"membership_type": "_rzpy_test_milythm",
|
||||
"currency": "INR",
|
||||
"currency": "USD",
|
||||
"paid": 1,
|
||||
"from_date": nowdate(),
|
||||
"amount": 100,
|
||||
|
||||
Reference in New Issue
Block a user