From f094662f5e07a860fe0130462cfadb77d80256a0 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Mon, 8 Apr 2019 12:28:50 +0530 Subject: [PATCH] fix:Test record fixes --- .../move_customer_lead_to_dynamic_column.py | 2 +- .../doctype/quotation/test_records.json | 48 +++++++++---------- erpnext/shopping_cart/cart.py | 10 ++-- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py b/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py index 23e91c7ebc7..345b4ac714a 100644 --- a/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py +++ b/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py @@ -5,6 +5,6 @@ from __future__ import unicode_literals import frappe def execute(): - + frappe.reload_doctype("Quotation") frappe.db.sql(""" UPDATE `tabQuotation` set customer_lead = lead WHERE quotation_to = 'Lead' """) frappe.db.sql(""" UPDATE `tabQuotation` set customer_lead = customer WHERE quotation_to = 'Customer' """) \ No newline at end of file diff --git a/erpnext/selling/doctype/quotation/test_records.json b/erpnext/selling/doctype/quotation/test_records.json index 7a9d3eb1e25..03acea35cfa 100644 --- a/erpnext/selling/doctype/quotation/test_records.json +++ b/erpnext/selling/doctype/quotation/test_records.json @@ -1,36 +1,36 @@ [ { - "company": "_Test Company", - "conversion_rate": 1.0, - "currency": "INR", - "customer": "_Test Customer", - "customer_group": "_Test Customer Group", - "customer_name": "_Test Customer", - "doctype": "Quotation", - "base_grand_total": 1000.0, - "grand_total": 1000.0, - "order_type": "Sales", - "plc_conversion_rate": 1.0, - "price_list_currency": "INR", + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "customer_lead": "_Test Customer", + "customer_group": "_Test Customer Group", + "customer_name": "_Test Customer", + "doctype": "Quotation", + "base_grand_total": 1000.0, + "grand_total": 1000.0, + "order_type": "Sales", + "plc_conversion_rate": 1.0, + "price_list_currency": "INR", "items": [ { - "base_amount": 1000.0, - "base_rate": 100.0, - "description": "CPU", - "doctype": "Quotation Item", - "item_code": "_Test Item Home Desktop 100", - "item_name": "CPU", - "parentfield": "items", - "qty": 10.0, + "base_amount": 1000.0, + "base_rate": 100.0, + "description": "CPU", + "doctype": "Quotation Item", + "item_code": "_Test Item Home Desktop 100", + "item_name": "CPU", + "parentfield": "items", + "qty": 10.0, "rate": 100.0, "uom": "_Test UOM 1", "stock_uom": "_Test UOM 1", "conversion_factor": 1.0 } - ], - "quotation_to": "Customer", - "selling_price_list": "_Test Price List", - "territory": "_Test Territory", + ], + "quotation_to": "Customer", + "selling_price_list": "_Test Price List", + "territory": "_Test Territory", "transaction_date": "2013-02-21", "valid_till": "2013-03-21" } diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py index 691b960d05a..a3ad5a04ea5 100644 --- a/erpnext/shopping_cart/cart.py +++ b/erpnext/shopping_cart/cart.py @@ -207,7 +207,7 @@ def _get_cart_quotation(party=None): "status": "Draft", "docstatus": 0, "__islocal": 1, - (party.doctype.lower()): party.name + "customer_lead": party.name }) qdoc.contact_person = frappe.db.get_value("Contact", {"email_id": frappe.session.user}) @@ -287,9 +287,9 @@ def _set_price_list(quotation, cart_settings): # check if customer price list exists selling_price_list = None - if quotation.customer: + if quotation.customer_lead: from erpnext.accounts.party import get_default_price_list - selling_price_list = get_default_price_list(frappe.get_doc("Customer", quotation.customer)) + selling_price_list = get_default_price_list(frappe.get_doc("Customer", quotation.customer_lead)) # else check for territory based price list if not selling_price_list: @@ -301,9 +301,9 @@ def set_taxes(quotation, cart_settings): """set taxes based on billing territory""" from erpnext.accounts.party import set_taxes - customer_group = frappe.db.get_value("Customer", quotation.customer, "customer_group") + customer_group = frappe.db.get_value("Customer", quotation.customer_lead, "customer_group") - quotation.taxes_and_charges = set_taxes(quotation.customer, "Customer", \ + quotation.taxes_and_charges = set_taxes(quotation.customer_lead, "Customer", \ quotation.transaction_date, quotation.company, customer_group, None, \ quotation.customer_address, quotation.shipping_address_name, 1) #