fix: Test case fixes in quotation for dynamic column
This commit is contained in:
@@ -218,8 +218,8 @@ def make_quotation(source_name, target_doc=None):
|
||||
quotation = frappe.get_doc(target)
|
||||
|
||||
company_currency = frappe.get_cached_value('Company', quotation.company, "default_currency")
|
||||
party_account_currency = get_party_account_currency("Customer", quotation.customer,
|
||||
quotation.company) if quotation.customer else company_currency
|
||||
party_account_currency = get_party_account_currency("Customer", quotation.customer_lead,
|
||||
quotation.company) if quotation.customer_lead else company_currency
|
||||
|
||||
quotation.currency = party_account_currency or company_currency
|
||||
|
||||
|
||||
@@ -104,9 +104,8 @@ class Customer(TransactionBase):
|
||||
if self.lead_name:
|
||||
frappe.db.set_value('Lead', self.lead_name, 'status', 'Converted', update_modified=False)
|
||||
|
||||
for doctype in ('Opportunity', 'Quotation'):
|
||||
for d in frappe.get_all(doctype, {'lead': self.lead_name}):
|
||||
frappe.db.set_value(doctype, d.name, 'customer', self.name, update_modified=False)
|
||||
for d in frappe.get_all('Opportunity', {'lead': self.lead_name}):
|
||||
frappe.db.set_value('Opportunity', d.name, 'customer', self.name, update_modified=False)
|
||||
|
||||
def create_lead_address_contact(self):
|
||||
if self.lead_name:
|
||||
|
||||
@@ -204,7 +204,7 @@ def _make_sales_invoice(source_name, target_doc=None, ignore_permissions=False):
|
||||
return doclist
|
||||
|
||||
def _make_customer(source_name, ignore_permissions=False):
|
||||
quotation = frappe.db.get_value("Quotation", source_name, ["lead", "order_type", "customer"])
|
||||
quotation = frappe.db.get_value("Quotation", source_name, ["order_type", "customer_lead"])
|
||||
if quotation and quotation[0] and not quotation[2]:
|
||||
lead_name = quotation[0]
|
||||
customer_name = frappe.db.get_value("Customer", {"lead_name": lead_name},
|
||||
|
||||
@@ -203,15 +203,15 @@ class TestQuotation(unittest.TestCase):
|
||||
|
||||
test_records = frappe.get_test_records('Quotation')
|
||||
|
||||
def get_quotation_dict(customer=None, item_code=None):
|
||||
if not customer:
|
||||
customer = '_Test Customer'
|
||||
def get_quotation_dict(customer_lead=None, item_code=None):
|
||||
if not customer_lead:
|
||||
customer_lead = '_Test Customer'
|
||||
if not item_code:
|
||||
item_code = '_Test Item'
|
||||
|
||||
return {
|
||||
'doctype': 'Quotation',
|
||||
'customer': customer,
|
||||
'customer_lead': customer_lead,
|
||||
'items': [
|
||||
{
|
||||
'item_code': item_code,
|
||||
@@ -229,7 +229,7 @@ def make_quotation(**args):
|
||||
qo.transaction_date = args.transaction_date
|
||||
|
||||
qo.company = args.company or "_Test Company"
|
||||
qo.customer = args.customer or "_Test Customer"
|
||||
qo.customer_lead = args.customer_lead or "_Test Customer"
|
||||
qo.currency = args.currency or "INR"
|
||||
if args.selling_price_list:
|
||||
qo.selling_price_list = args.selling_price_list
|
||||
|
||||
@@ -33,7 +33,7 @@ class TestShoppingCart(unittest.TestCase):
|
||||
self.assertEqual(quotation.quotation_to, "Customer")
|
||||
self.assertEqual(quotation.contact_person,
|
||||
frappe.db.get_value("Contact", dict(email_id="test_cart_user@example.com")))
|
||||
self.assertEqual(quotation.lead, None)
|
||||
self.assertEqual(quotation.customer_lead, None)
|
||||
self.assertEqual(quotation.contact_email, frappe.session.user)
|
||||
|
||||
return quotation
|
||||
@@ -44,8 +44,7 @@ class TestShoppingCart(unittest.TestCase):
|
||||
# test if quotation with customer is fetched
|
||||
quotation = _get_cart_quotation()
|
||||
self.assertEqual(quotation.quotation_to, "Customer")
|
||||
self.assertEqual(quotation.customer, "_Test Customer")
|
||||
self.assertEqual(quotation.lead, None)
|
||||
self.assertEqual(quotation.customer_lead, "_Test Customer")
|
||||
self.assertEqual(quotation.contact_email, frappe.session.user)
|
||||
|
||||
return quotation
|
||||
@@ -107,7 +106,7 @@ class TestShoppingCart(unittest.TestCase):
|
||||
|
||||
from erpnext.accounts.party import set_taxes
|
||||
|
||||
tax_rule_master = set_taxes(quotation.customer, "Customer", \
|
||||
tax_rule_master = set_taxes(quotation.customer_lead, "Customer", \
|
||||
quotation.transaction_date, quotation.company, None, None, \
|
||||
quotation.customer_address, quotation.shipping_address_name, 1)
|
||||
self.assertEqual(quotation.taxes_and_charges, tax_rule_master)
|
||||
@@ -122,7 +121,7 @@ class TestShoppingCart(unittest.TestCase):
|
||||
"doctype": "Quotation",
|
||||
"quotation_to": "Customer",
|
||||
"order_type": "Shopping Cart",
|
||||
"customer": get_party(frappe.session.user).name,
|
||||
"customer_lead": get_party(frappe.session.user).name,
|
||||
"docstatus": 0,
|
||||
"contact_email": frappe.session.user,
|
||||
"selling_price_list": "_Test Price List Rest of the World",
|
||||
|
||||
Reference in New Issue
Block a user