[fix] test cases fix for price list
This commit is contained in:
parent
c3ec72c991
commit
fb6d410e60
@ -135,11 +135,6 @@ class DocType(TransactionBase):
|
|||||||
for rec in sql("select * from `tabContact` where supplier=%s", (self.doc.name,), as_dict=1):
|
for rec in sql("select * from `tabContact` where supplier=%s", (self.doc.name,), as_dict=1):
|
||||||
sql("delete from `tabContact` where name=%s",(rec['name']))
|
sql("delete from `tabContact` where name=%s",(rec['name']))
|
||||||
|
|
||||||
def delete_supplier_communication(self):
|
|
||||||
webnotes.conn.sql("""\
|
|
||||||
delete from `tabCommunication`
|
|
||||||
where supplier = %s and customer is null""", self.doc.name)
|
|
||||||
|
|
||||||
def delete_supplier_account(self):
|
def delete_supplier_account(self):
|
||||||
"""delete supplier's ledger if exist and check balance before deletion"""
|
"""delete supplier's ledger if exist and check balance before deletion"""
|
||||||
acc = sql("select name from `tabAccount` where master_type = 'Supplier' \
|
acc = sql("select name from `tabAccount` where master_type = 'Supplier' \
|
||||||
@ -151,7 +146,6 @@ class DocType(TransactionBase):
|
|||||||
def on_trash(self):
|
def on_trash(self):
|
||||||
self.delete_supplier_address()
|
self.delete_supplier_address()
|
||||||
self.delete_supplier_contact()
|
self.delete_supplier_contact()
|
||||||
self.delete_supplier_communication()
|
|
||||||
self.delete_supplier_account()
|
self.delete_supplier_account()
|
||||||
|
|
||||||
def on_rename(self, new, old, merge=False):
|
def on_rename(self, new, old, merge=False):
|
||||||
|
@ -128,11 +128,6 @@ class DocType(TransactionBase):
|
|||||||
def delete_customer_contact(self):
|
def delete_customer_contact(self):
|
||||||
for rec in sql("select * from `tabContact` where customer=%s", (self.doc.name,), as_dict=1):
|
for rec in sql("select * from `tabContact` where customer=%s", (self.doc.name,), as_dict=1):
|
||||||
sql("delete from `tabContact` where name=%s",(rec['name']))
|
sql("delete from `tabContact` where name=%s",(rec['name']))
|
||||||
|
|
||||||
def delete_customer_communication(self):
|
|
||||||
webnotes.conn.sql("""\
|
|
||||||
delete from `tabCommunication`
|
|
||||||
where customer = %s and supplier is null""", self.doc.name)
|
|
||||||
|
|
||||||
def delete_customer_account(self):
|
def delete_customer_account(self):
|
||||||
"""delete customer's ledger if exist and check balance before deletion"""
|
"""delete customer's ledger if exist and check balance before deletion"""
|
||||||
@ -145,7 +140,6 @@ class DocType(TransactionBase):
|
|||||||
def on_trash(self):
|
def on_trash(self):
|
||||||
self.delete_customer_address()
|
self.delete_customer_address()
|
||||||
self.delete_customer_contact()
|
self.delete_customer_contact()
|
||||||
self.delete_customer_communication()
|
|
||||||
self.delete_customer_account()
|
self.delete_customer_account()
|
||||||
if self.doc.lead_name:
|
if self.doc.lead_name:
|
||||||
sql("update `tabLead` set status='Interested' where name=%s",self.doc.lead_name)
|
sql("update `tabLead` set status='Interested' where name=%s",self.doc.lead_name)
|
||||||
|
@ -57,6 +57,8 @@ class TestCustomer(unittest.TestCase):
|
|||||||
# check that old name doesn't exist
|
# check that old name doesn't exist
|
||||||
self.assertEqual(webnotes.conn.exists("Customer", "_Test Customer"), ())
|
self.assertEqual(webnotes.conn.exists("Customer", "_Test Customer"), ())
|
||||||
self.assertEqual(webnotes.conn.exists("Account", "_Test Customer - _TC"), ())
|
self.assertEqual(webnotes.conn.exists("Account", "_Test Customer - _TC"), ())
|
||||||
|
|
||||||
|
test_ignore = ["Price List"]
|
||||||
|
|
||||||
test_records = [
|
test_records = [
|
||||||
[{
|
[{
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||||
# License: GNU General Public License v3. See license.txt
|
# License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
test_ignore = ["Price List"]
|
||||||
|
|
||||||
|
|
||||||
test_records = [
|
test_records = [
|
||||||
[{
|
[{
|
||||||
"doctype": "Customer Group",
|
"doctype": "Customer Group",
|
||||||
|
@ -13,6 +13,8 @@ class TestItem(unittest.TestCase):
|
|||||||
price_list.doclist.append(webnotes.doc(item_price.fields.copy()))
|
price_list.doclist.append(webnotes.doc(item_price.fields.copy()))
|
||||||
self.assertRaises(PriceListDuplicateItem, price_list.insert)
|
self.assertRaises(PriceListDuplicateItem, price_list.insert)
|
||||||
|
|
||||||
|
# test_ignore = ["Item"]
|
||||||
|
|
||||||
test_records = [
|
test_records = [
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
@ -101,7 +101,6 @@ class DocType:
|
|||||||
'default_currency': args.get('currency'),
|
'default_currency': args.get('currency'),
|
||||||
'default_company':args.get('company_name'),
|
'default_company':args.get('company_name'),
|
||||||
'date_format': webnotes.conn.get_value("Country", args.get("country"), "date_format"),
|
'date_format': webnotes.conn.get_value("Country", args.get("country"), "date_format"),
|
||||||
'emp_created_by':'Naming Series',
|
|
||||||
"float_precision": 4
|
"float_precision": 4
|
||||||
})
|
})
|
||||||
global_defaults.save()
|
global_defaults.save()
|
||||||
@ -135,6 +134,10 @@ class DocType:
|
|||||||
notification_control.doc.purchase_order = 1
|
notification_control.doc.purchase_order = 1
|
||||||
notification_control.save()
|
notification_control.save()
|
||||||
|
|
||||||
|
hr_settings = webnotes.bean("HR Settings")
|
||||||
|
hr_settings.doc.emp_created_by = "Naming Series"
|
||||||
|
hr_settings.save()
|
||||||
|
|
||||||
# control panel
|
# control panel
|
||||||
cp = webnotes.doc("Control Panel", "Control Panel")
|
cp = webnotes.doc("Control Panel", "Control Panel")
|
||||||
for k in ['country', 'timezone', 'company_name']:
|
for k in ['country', 'timezone', 'company_name']:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user