fixed conflict
This commit is contained in:
commit
0739e7f573
@ -23,8 +23,6 @@ from webnotes import msgprint
|
|||||||
sql = webnotes.conn.sql
|
sql = webnotes.conn.sql
|
||||||
get_value = webnotes.conn.get_value
|
get_value = webnotes.conn.get_value
|
||||||
|
|
||||||
test_records = []
|
|
||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
def __init__(self,d,dl):
|
def __init__(self,d,dl):
|
||||||
self.doc, self.doclist = d,dl
|
self.doc, self.doclist = d,dl
|
||||||
@ -210,3 +208,31 @@ def get_parent_account(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
and %s like %s order by name limit %s, %s""" %
|
and %s like %s order by name limit %s, %s""" %
|
||||||
("%s", searchfield, "%s", "%s", "%s"),
|
("%s", searchfield, "%s", "%s", "%s"),
|
||||||
(filters["company"], "%%%s%%" % txt, start, page_len), as_list=1)
|
(filters["company"], "%%%s%%" % txt, start, page_len), as_list=1)
|
||||||
|
|
||||||
|
def make_test_records(verbose):
|
||||||
|
from webnotes.test_runner import load_module_and_make_records, make_test_objects
|
||||||
|
|
||||||
|
load_module_and_make_records("Company", verbose)
|
||||||
|
|
||||||
|
accounts = [
|
||||||
|
# [account_name, parent_account, group_or_ledger]
|
||||||
|
["_Test Account Stock Expenses", "Direct Expenses - _TC", "Group"],
|
||||||
|
["_Test Account Shipping Charges", "_Test Account Stock Expenses - _TC", "Ledger"],
|
||||||
|
["_Test Account Customs Duty", "_Test Account Stock Expenses - _TC", "Ledger"],
|
||||||
|
["_Test Account Tax Assets", "Current Assets - _TC", "Group"],
|
||||||
|
["_Test Account VAT", "_Test Account Tax Assets - _TC", "Ledger"],
|
||||||
|
["_Test Account Cost for Goods Sold", "Expenses - _TC", "Ledger"],
|
||||||
|
["_Test Account Excise Duty", "_Test Account Tax Assets - _TC", "Ledger"],
|
||||||
|
["_Test Account Education Cess", "_Test Account Tax Assets - _TC", "Ledger"],
|
||||||
|
["_Test Account S&H Education Cess", "_Test Account Tax Assets - _TC", "Ledger"],
|
||||||
|
["_Test Account CST", "Direct Expenses - _TC", "Ledger"],
|
||||||
|
["_Test Account Discount", "Direct Expenses - _TC", "Ledger"]
|
||||||
|
]
|
||||||
|
|
||||||
|
return make_test_objects([[{
|
||||||
|
"doctype": "Account",
|
||||||
|
"account_name": account_name,
|
||||||
|
"parent_account": parent_account,
|
||||||
|
"company": "_Test Company",
|
||||||
|
"group_or_ledger": group_or_ledger
|
||||||
|
}] for account_name, parent_account, group_or_ledger in accounts])
|
@ -98,3 +98,13 @@ class DocType(DocTypeNestedSet):
|
|||||||
(cost_center_name, old))
|
(cost_center_name, old))
|
||||||
|
|
||||||
return " - ".join(parts)
|
return " - ".join(parts)
|
||||||
|
|
||||||
|
test_records = [
|
||||||
|
[{
|
||||||
|
"doctype": "Cost Center",
|
||||||
|
"cost_center_name": "_Test Cost Center",
|
||||||
|
"parent_cost_center": "Root - _TC",
|
||||||
|
"company_name": "_Test Company",
|
||||||
|
"group_or_ledger": "Ledger"
|
||||||
|
}],
|
||||||
|
]
|
@ -31,6 +31,11 @@ class DocType:
|
|||||||
|
|
||||||
msgprint(self.doc.name + _(""" is now the default Fiscal Year. \
|
msgprint(self.doc.name + _(""" is now the default Fiscal Year. \
|
||||||
Please refresh your browser for the change to take effect."""))
|
Please refresh your browser for the change to take effect."""))
|
||||||
|
|
||||||
test_records = [[{"doctype":"Fiscal Year", "year":"_Test Fiscal Year",
|
test_records = [
|
||||||
"year_start_date":"2013-01-01"}]]
|
[{
|
||||||
|
"doctype": "Fiscal Year",
|
||||||
|
"year": "_Test Fiscal Year",
|
||||||
|
"year_start_date": "2013-01-01"
|
||||||
|
}]
|
||||||
|
]
|
@ -526,4 +526,4 @@ class DocType(BuyingController):
|
|||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ import unittest
|
|||||||
import webnotes
|
import webnotes
|
||||||
import webnotes.model
|
import webnotes.model
|
||||||
from webnotes.utils import nowdate
|
from webnotes.utils import nowdate
|
||||||
from webnotes.test_runner import make_test_records
|
|
||||||
|
|
||||||
from stock.doctype.purchase_receipt import test_purchase_receipt
|
from stock.doctype.purchase_receipt import test_purchase_receipt
|
||||||
|
|
||||||
@ -147,9 +146,9 @@ class TestPurchaseInvoice(unittest.TestCase):
|
|||||||
self.load_test_data()
|
self.load_test_data()
|
||||||
|
|
||||||
def load_test_data(self):
|
def load_test_data(self):
|
||||||
make_test_records("Company")
|
from webnotes.test_runner import make_test_records
|
||||||
|
make_test_records("Purchase Invoice", verbose=0)
|
||||||
|
|
||||||
|
|
||||||
def test_gl_entries(self):
|
def test_gl_entries(self):
|
||||||
wrapper = webnotes.model_wrapper(purchase_invoice_doclist).insert()
|
wrapper = webnotes.model_wrapper(purchase_invoice_doclist).insert()
|
||||||
wrapper.submit()
|
wrapper.submit()
|
||||||
@ -172,7 +171,7 @@ class TestPurchaseInvoice(unittest.TestCase):
|
|||||||
for d in gl_entries:
|
for d in gl_entries:
|
||||||
self.assertEqual([d.debit, d.credit], expected_gl_entries.get(d.account))
|
self.assertEqual([d.debit, d.credit], expected_gl_entries.get(d.account))
|
||||||
|
|
||||||
def test_purchase_invoice_calculation(self):
|
def atest_purchase_invoice_calculation(self):
|
||||||
test_doclist = [] + purchase_invoice_doclist
|
test_doclist = [] + purchase_invoice_doclist
|
||||||
for doc in test_doclist:
|
for doc in test_doclist:
|
||||||
if doc["doctype"] == "Purchase Taxes and Charges":
|
if doc["doctype"] == "Purchase Taxes and Charges":
|
||||||
@ -205,42 +204,8 @@ class TestPurchaseInvoice(unittest.TestCase):
|
|||||||
for i, item in enumerate(wrapper.doclist.get({"parentfield": "entries"})):
|
for i, item in enumerate(wrapper.doclist.get({"parentfield": "entries"})):
|
||||||
self.assertEqual(item.item_code, expected_values[i][0])
|
self.assertEqual(item.item_code, expected_values[i][0])
|
||||||
self.assertEqual(item.item_tax_amount, expected_values[i][1])
|
self.assertEqual(item.item_tax_amount, expected_values[i][1])
|
||||||
|
|
||||||
|
# self.assertEqual(dl[0].net_total, 1250)
|
||||||
# def test_purchase_invoice_calculation(self):
|
|
||||||
# from webnotes.model.doclist import DocList
|
|
||||||
# wrapper = webnotes.insert(DocList(purchase_invoice_doclist))
|
|
||||||
# wrapper.load_from_db()
|
|
||||||
# dl = wrapper.doclist
|
|
||||||
#
|
|
||||||
# # test net total
|
|
||||||
# self.assertEqual(dl[0].net_total, 1250)
|
|
||||||
#
|
|
||||||
# # test tax amounts and totals
|
|
||||||
# expected_values = [
|
|
||||||
# ["Shipping Charges - %s" % abbr, 100, 1350],
|
|
||||||
# ["Customs Duty - %s" % abbr, 125, 1350],
|
|
||||||
# ["Excise Duty - %s" % abbr, 140, 1490],
|
|
||||||
# ["Education Cess - %s" % abbr, 2.8, 1492.8],
|
|
||||||
# ["S&H Education Cess - %s" % abbr, 1.4, 1494.2],
|
|
||||||
# ["CST - %s" % abbr, 29.88, 1524.08],
|
|
||||||
# ["VAT - Test - %s" % abbr, 156.25, 1680.33],
|
|
||||||
# ["Discount - %s" % abbr, -168.03, 1512.30],
|
|
||||||
# ]
|
|
||||||
# for i, tax in enumerate(dl.get({"parentfield": "taxes_and_charges"})):
|
|
||||||
# # print tax.account_head, tax.tax_amount, tax.total
|
|
||||||
# self.assertEqual(tax.account_head, expected_values[i][0])
|
|
||||||
# self.assertEqual(tax.tax_amount, expected_values[i][1])
|
|
||||||
# self.assertEqual(tax.total, expected_values[i][2])
|
|
||||||
#
|
|
||||||
# # test item tax amount
|
|
||||||
# expected_values = [
|
|
||||||
# ["Home Desktop 100", 90],
|
|
||||||
# ["Home Desktop 200", 135]
|
|
||||||
# ]
|
|
||||||
# for i, item in enumerate(dl.get({"parentfield": "purchase_invoice_items"})):
|
|
||||||
# self.assertEqual(item.item_code, expected_values[i][0])
|
|
||||||
# self.assertEqual(item.valuation_tax_amount, expected_values[i][1])
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
webnotes.conn.rollback()
|
webnotes.conn.rollback()
|
@ -182,3 +182,12 @@ class DocType(TransactionBase):
|
|||||||
#update master_name in doctype account
|
#update master_name in doctype account
|
||||||
webnotes.conn.sql("""update `tabAccount` set master_name = %s,
|
webnotes.conn.sql("""update `tabAccount` set master_name = %s,
|
||||||
master_type = 'Supplier' where master_name = %s""" , (new,old))
|
master_type = 'Supplier' where master_name = %s""" , (new,old))
|
||||||
|
|
||||||
|
test_records = [
|
||||||
|
[{
|
||||||
|
"doctype": "Supplier",
|
||||||
|
"supplier_name": "_Test Supplier",
|
||||||
|
"supplier_type": "_Test Supplier Type",
|
||||||
|
"company": "_Test Company"
|
||||||
|
}]
|
||||||
|
]
|
@ -86,4 +86,12 @@ class BuyingController(AccountsController):
|
|||||||
self.doc.currency)
|
self.doc.currency)
|
||||||
|
|
||||||
def calculate_taxes_and_totals(self):
|
def calculate_taxes_and_totals(self):
|
||||||
pass
|
self.doc.conversion_rate = flt(self.doc.conversion_rate)
|
||||||
|
|
||||||
|
# self.calculate_item_values()
|
||||||
|
# self.initialize_taxes()
|
||||||
|
# self.calculate_net_total()
|
||||||
|
# self.calculate_taxes()
|
||||||
|
# self.calculate_totals()
|
||||||
|
# self.set_total_in_words()
|
||||||
|
|
@ -76,8 +76,7 @@ class DocType:
|
|||||||
if int(total_w) != 100:
|
if int(total_w) != 100:
|
||||||
msgprint("Total weightage assigned should be 100%. It is :" + str(total_w) + "%",
|
msgprint("Total weightage assigned should be 100%. It is :" + str(total_w) + "%",
|
||||||
raise_exception=1)
|
raise_exception=1)
|
||||||
|
|
||||||
webnotes.errprint([webnotes.conn.get_value("Employee", self.doc.employee, "user_id")])
|
|
||||||
if webnotes.conn.get_value("Employee", self.doc.employee, "user_id") != \
|
if webnotes.conn.get_value("Employee", self.doc.employee, "user_id") != \
|
||||||
webnotes.session.user and total == 0:
|
webnotes.session.user and total == 0:
|
||||||
msgprint("Total can't be zero. You must atleast give some points!", raise_exception=1)
|
msgprint("Total can't be zero. You must atleast give some points!", raise_exception=1)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-01-23 19:57:17",
|
"creation": "2013-01-23 19:57:17",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-01-29 17:47:25",
|
"modified": "2013-02-08 13:07:25",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -543,14 +543,6 @@
|
|||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"label": "Valid Upto"
|
"label": "Valid Upto"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"doctype": "DocField",
|
|
||||||
"fieldname": "salary_structure",
|
|
||||||
"fieldtype": "Button",
|
|
||||||
"hidden": 1,
|
|
||||||
"label": "Salary Structure",
|
|
||||||
"oldfieldtype": "Button"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "place_of_issue",
|
"fieldname": "place_of_issue",
|
||||||
@ -775,4 +767,4 @@
|
|||||||
"role": "HR Manager",
|
"role": "HR Manager",
|
||||||
"write": 1
|
"write": 1
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-02-02 14:40:08",
|
"creation": "2013-02-02 14:40:08",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-02-07 08:54:22",
|
"modified": "2013-02-08 11:27:22",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -165,7 +165,7 @@
|
|||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"label": "Posting Date",
|
"label": "Posting Date",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"permlevel": 2,
|
"permlevel": 0,
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -175,7 +175,7 @@
|
|||||||
"in_filter": 1,
|
"in_filter": 1,
|
||||||
"label": "Fiscal Year",
|
"label": "Fiscal Year",
|
||||||
"options": "link:Fiscal Year",
|
"options": "link:Fiscal Year",
|
||||||
"permlevel": 2,
|
"permlevel": 0,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
"search_index": 0
|
"search_index": 0
|
||||||
@ -195,7 +195,7 @@
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Letter Head",
|
"label": "Letter Head",
|
||||||
"options": "Letter Head",
|
"options": "Letter Head",
|
||||||
"permlevel": 2,
|
"permlevel": 0,
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"read_only": 0
|
"read_only": 0
|
||||||
},
|
},
|
||||||
@ -250,4 +250,4 @@
|
|||||||
"role": "Leave Approver",
|
"role": "Leave Approver",
|
||||||
"submit": 0
|
"submit": 0
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
if __name__=="__main__":
|
||||||
|
sys.path.extend([".", "app", "lib"])
|
||||||
|
|
||||||
from hr.doctype.leave_application.leave_application import LeaveDayBlockedError
|
from hr.doctype.leave_application.leave_application import LeaveDayBlockedError
|
||||||
|
|
||||||
class TestLeaveApplication(unittest.TestCase):
|
class TestLeaveApplication(unittest.TestCase):
|
||||||
@ -53,7 +56,6 @@ test_records = [
|
|||||||
}]]
|
}]]
|
||||||
|
|
||||||
if __name__=="__main__":
|
if __name__=="__main__":
|
||||||
sys.path.extend(["app", "lib"])
|
|
||||||
import webnotes
|
import webnotes
|
||||||
webnotes.connect()
|
webnotes.connect()
|
||||||
|
|
||||||
|
@ -249,3 +249,13 @@ class DocType(TransactionBase):
|
|||||||
#update master_name in doctype account
|
#update master_name in doctype account
|
||||||
webnotes.conn.sql("""update `tabAccount` set master_name = %s,
|
webnotes.conn.sql("""update `tabAccount` set master_name = %s,
|
||||||
master_type = 'Customer' where master_name = %s""", (new,old))
|
master_type = 'Customer' where master_name = %s""", (new,old))
|
||||||
|
|
||||||
|
test_records = [
|
||||||
|
[{
|
||||||
|
"doctype": "Customer",
|
||||||
|
"customer_type": "Individual",
|
||||||
|
"customer_group": "_Test Customer Group",
|
||||||
|
"territory": "_Test Territory",
|
||||||
|
"company": "_Test Company"
|
||||||
|
}]
|
||||||
|
]
|
@ -19,4 +19,11 @@ import webnotes
|
|||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
def __init__(self, d, dl):
|
def __init__(self, d, dl):
|
||||||
self.doc, self.doclist = d, dl
|
self.doc, self.doclist = d, dl
|
||||||
|
|
||||||
|
test_records = [
|
||||||
|
[{
|
||||||
|
"doctype": "Brand",
|
||||||
|
"brand": "_Test Brand"
|
||||||
|
}]
|
||||||
|
]
|
@ -258,9 +258,9 @@ class DocType:
|
|||||||
|
|
||||||
test_records = [
|
test_records = [
|
||||||
[{
|
[{
|
||||||
|
"doctype": "Company",
|
||||||
"company_name": "_Test Company",
|
"company_name": "_Test Company",
|
||||||
"abbr": "TC",
|
"abbr": "_TC",
|
||||||
"default_currency": "INR",
|
"default_currency": "INR",
|
||||||
"doctype": "Company"
|
}],
|
||||||
}]
|
|
||||||
]
|
]
|
@ -19,4 +19,11 @@ import webnotes
|
|||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
def __init__(self, d, dl):
|
def __init__(self, d, dl):
|
||||||
self.doc, self.doclist = d, dl
|
self.doc, self.doclist = d, dl
|
||||||
|
|
||||||
|
test_records = [
|
||||||
|
[{
|
||||||
|
"doctype": "Country",
|
||||||
|
"country_name": "_Test Country"
|
||||||
|
}]
|
||||||
|
]
|
@ -20,5 +20,3 @@ import webnotes
|
|||||||
class DocType:
|
class DocType:
|
||||||
def __init__(self, d, dl):
|
def __init__(self, d, dl):
|
||||||
self.doc, self.doclist = d, dl
|
self.doc, self.doclist = d, dl
|
||||||
|
|
||||||
test_records = []
|
|
@ -16,9 +16,6 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
from webnotes.model import db_exists
|
|
||||||
from webnotes.model.wrapper import copy_doclist
|
|
||||||
from webnotes import msgprint
|
from webnotes import msgprint
|
||||||
|
|
||||||
sql = webnotes.conn.sql
|
sql = webnotes.conn.sql
|
||||||
@ -63,4 +60,13 @@ class DocType(DocTypeNestedSet):
|
|||||||
You can not trash/cancel/delete this customer group.", raise_exception=1)
|
You can not trash/cancel/delete this customer group.", raise_exception=1)
|
||||||
|
|
||||||
# rebuild tree
|
# rebuild tree
|
||||||
super(DocType, self).on_trash()
|
super(DocType, self).on_trash()
|
||||||
|
|
||||||
|
test_records = [
|
||||||
|
[{
|
||||||
|
"doctype": "Customer Group",
|
||||||
|
"customer_group_name": "_Test Customer Group",
|
||||||
|
"parent_customer_group": "All Customer Groups",
|
||||||
|
"is_group": "No"
|
||||||
|
}]
|
||||||
|
]
|
@ -67,4 +67,19 @@ class DocType(DocTypeNestedSet):
|
|||||||
|
|
||||||
if self.doc.slideshow:
|
if self.doc.slideshow:
|
||||||
from website.helpers.slideshow import get_slideshow
|
from website.helpers.slideshow import get_slideshow
|
||||||
get_slideshow(self)
|
get_slideshow(self)
|
||||||
|
|
||||||
|
test_records = [
|
||||||
|
[{
|
||||||
|
"doctype": "Item Group",
|
||||||
|
"item_group_name": "_Test Item Group",
|
||||||
|
"parent_item_group": "All Item Groups",
|
||||||
|
"is_group": "No"
|
||||||
|
}],
|
||||||
|
[{
|
||||||
|
"doctype": "Item Group",
|
||||||
|
"item_group_name": "_Test Item Group Desktops",
|
||||||
|
"parent_item_group": "All Item Groups",
|
||||||
|
"is_group": "No"
|
||||||
|
}],
|
||||||
|
]
|
@ -32,4 +32,13 @@ class DocType(DocTypeNestedSet):
|
|||||||
for d in getlist(self.doclist, 'target_details'):
|
for d in getlist(self.doclist, 'target_details'):
|
||||||
if not flt(d.target_qty) and not flt(d.target_amount):
|
if not flt(d.target_qty) and not flt(d.target_amount):
|
||||||
msgprint("Either target qty or target amount is mandatory.")
|
msgprint("Either target qty or target amount is mandatory.")
|
||||||
raise Exception
|
raise Exception
|
||||||
|
|
||||||
|
test_records = [
|
||||||
|
[{
|
||||||
|
"doctype": "Territory",
|
||||||
|
"territory_name": "_Test Territory",
|
||||||
|
"parent_territory": "All Territories",
|
||||||
|
"is_group": "No",
|
||||||
|
}]
|
||||||
|
]
|
@ -19,4 +19,11 @@ import webnotes
|
|||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
def __init__(self, d, dl):
|
def __init__(self, d, dl):
|
||||||
self.doc, self.doclist = d, dl
|
self.doc, self.doclist = d, dl
|
||||||
|
|
||||||
|
test_records = [
|
||||||
|
[{
|
||||||
|
"doctype": "UOM",
|
||||||
|
"uom_name": "_Test UOM"
|
||||||
|
}]
|
||||||
|
]
|
@ -19,4 +19,11 @@ import webnotes
|
|||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
def __init__(self, d, dl):
|
def __init__(self, d, dl):
|
||||||
self.doc, self.doclist = d, dl
|
self.doc, self.doclist = d, dl
|
||||||
|
|
||||||
|
test_records = [
|
||||||
|
[{
|
||||||
|
"doctype": "Warehouse Type",
|
||||||
|
"warehouse_type": "_Test Warehouse Type"
|
||||||
|
}]
|
||||||
|
]
|
@ -47,7 +47,7 @@ data_map = {
|
|||||||
"order_by": "lft"
|
"order_by": "lft"
|
||||||
},
|
},
|
||||||
"GL Entry": {
|
"GL Entry": {
|
||||||
"columns": ["account", "posting_date", "cost_center", "debit", "credit", "is_opening",
|
"columns": ["name", "account", "posting_date", "cost_center", "debit", "credit", "is_opening",
|
||||||
"company", "voucher_type", "voucher_no", "remarks"],
|
"company", "voucher_type", "voucher_no", "remarks"],
|
||||||
"conditions": ["ifnull(is_cancelled, 'No')='No'"],
|
"conditions": ["ifnull(is_cancelled, 'No')='No'"],
|
||||||
"order_by": "posting_date, account",
|
"order_by": "posting_date, account",
|
||||||
@ -86,7 +86,7 @@ data_map = {
|
|||||||
"order_by": "name"
|
"order_by": "name"
|
||||||
},
|
},
|
||||||
"Stock Ledger Entry": {
|
"Stock Ledger Entry": {
|
||||||
"columns": ["posting_date", "posting_time", "item_code", "warehouse", "actual_qty as qty",
|
"columns": ["name", "posting_date", "posting_time", "item_code", "warehouse", "actual_qty as qty",
|
||||||
"voucher_type", "voucher_no", "ifnull(incoming_rate,0) as incoming_rate"],
|
"voucher_type", "voucher_no", "ifnull(incoming_rate,0) as incoming_rate"],
|
||||||
"conditions": ["ifnull(is_cancelled, 'No')='No'"],
|
"conditions": ["ifnull(is_cancelled, 'No')='No'"],
|
||||||
"order_by": "posting_date, posting_time, name",
|
"order_by": "posting_date, posting_time, name",
|
||||||
@ -102,7 +102,7 @@ data_map = {
|
|||||||
"order_by": "posting_date, posting_time, name",
|
"order_by": "posting_date, posting_time, name",
|
||||||
},
|
},
|
||||||
"Production Order": {
|
"Production Order": {
|
||||||
"columns": ["production_item as item_code",
|
"columns": ["name", "production_item as item_code",
|
||||||
"(ifnull(qty, 0) - ifnull(produced_qty, 0)) as qty",
|
"(ifnull(qty, 0) - ifnull(produced_qty, 0)) as qty",
|
||||||
"fg_warehouse as warehouse"],
|
"fg_warehouse as warehouse"],
|
||||||
"conditions": ["docstatus=1", "status != 'Stopped'", "ifnull(fg_warehouse, '')!=''",
|
"conditions": ["docstatus=1", "status != 'Stopped'", "ifnull(fg_warehouse, '')!=''",
|
||||||
@ -113,7 +113,7 @@ data_map = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
"Purchase Request Item": {
|
"Purchase Request Item": {
|
||||||
"columns": ["item_code", "warehouse",
|
"columns": ["name", "item_code", "warehouse",
|
||||||
"(ifnull(qty, 0) - ifnull(ordered_qty, 0)) as qty"],
|
"(ifnull(qty, 0) - ifnull(ordered_qty, 0)) as qty"],
|
||||||
"from": "`tabPurchase Request Item` item, `tabPurchase Request` main",
|
"from": "`tabPurchase Request Item` item, `tabPurchase Request` main",
|
||||||
"conditions": ["item.parent = main.name", "main.docstatus=1", "main.status != 'Stopped'",
|
"conditions": ["item.parent = main.name", "main.docstatus=1", "main.status != 'Stopped'",
|
||||||
@ -124,7 +124,7 @@ data_map = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
"Purchase Order Item": {
|
"Purchase Order Item": {
|
||||||
"columns": ["item_code", "warehouse",
|
"columns": ["name", "item_code", "warehouse",
|
||||||
"(ifnull(qty, 0) - ifnull(received_qty, 0)) as qty"],
|
"(ifnull(qty, 0) - ifnull(received_qty, 0)) as qty"],
|
||||||
"from": "`tabPurchase Order Item` item, `tabPurchase Order` main",
|
"from": "`tabPurchase Order Item` item, `tabPurchase Order` main",
|
||||||
"conditions": ["item.parent = main.name", "main.docstatus=1", "main.status != 'Stopped'",
|
"conditions": ["item.parent = main.name", "main.docstatus=1", "main.status != 'Stopped'",
|
||||||
@ -136,7 +136,7 @@ data_map = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
"Sales Order Item": {
|
"Sales Order Item": {
|
||||||
"columns": ["item_code", "(ifnull(qty, 0) - ifnull(delivered_qty, 0)) as qty",
|
"columns": ["name", "item_code", "(ifnull(qty, 0) - ifnull(delivered_qty, 0)) as qty",
|
||||||
"reserved_warehouse as warehouse"],
|
"reserved_warehouse as warehouse"],
|
||||||
"from": "`tabSales Order Item` item, `tabSales Order` main",
|
"from": "`tabSales Order Item` item, `tabSales Order` main",
|
||||||
"conditions": ["item.parent = main.name", "main.docstatus=1", "main.status != 'Stopped'",
|
"conditions": ["item.parent = main.name", "main.docstatus=1", "main.status != 'Stopped'",
|
||||||
@ -178,7 +178,7 @@ data_map = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Sales Invoice Item": {
|
"Sales Invoice Item": {
|
||||||
"columns": ["parent", "item_code", "qty", "amount"],
|
"columns": ["name", "parent", "item_code", "qty", "amount"],
|
||||||
"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
|
"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
|
||||||
"order_by": "parent",
|
"order_by": "parent",
|
||||||
"links": {
|
"links": {
|
||||||
@ -196,7 +196,7 @@ data_map = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Sales Order Item[Sales Analytics]": {
|
"Sales Order Item[Sales Analytics]": {
|
||||||
"columns": ["parent", "item_code", "qty", "amount"],
|
"columns": ["name", "parent", "item_code", "qty", "amount"],
|
||||||
"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
|
"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
|
||||||
"order_by": "parent",
|
"order_by": "parent",
|
||||||
"links": {
|
"links": {
|
||||||
@ -214,7 +214,7 @@ data_map = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Delivery Note Item[Sales Analytics]": {
|
"Delivery Note Item[Sales Analytics]": {
|
||||||
"columns": ["parent", "item_code", "qty", "amount"],
|
"columns": ["name", "parent", "item_code", "qty", "amount"],
|
||||||
"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
|
"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
|
||||||
"order_by": "parent",
|
"order_by": "parent",
|
||||||
"links": {
|
"links": {
|
||||||
@ -246,7 +246,7 @@ data_map = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Purchase Invoice Item": {
|
"Purchase Invoice Item": {
|
||||||
"columns": ["parent", "item_code", "qty", "amount"],
|
"columns": ["name", "parent", "item_code", "qty", "amount"],
|
||||||
"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
|
"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
|
||||||
"order_by": "parent",
|
"order_by": "parent",
|
||||||
"links": {
|
"links": {
|
||||||
@ -264,7 +264,7 @@ data_map = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Purchase Order Item[Purchase Analytics]": {
|
"Purchase Order Item[Purchase Analytics]": {
|
||||||
"columns": ["parent", "item_code", "qty", "amount"],
|
"columns": ["name", "parent", "item_code", "qty", "amount"],
|
||||||
"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
|
"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
|
||||||
"order_by": "parent",
|
"order_by": "parent",
|
||||||
"links": {
|
"links": {
|
||||||
@ -282,7 +282,7 @@ data_map = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Purchase Receipt Item[Purchase Analytics]": {
|
"Purchase Receipt Item[Purchase Analytics]": {
|
||||||
"columns": ["parent", "item_code", "qty", "amount"],
|
"columns": ["name", "parent", "item_code", "qty", "amount"],
|
||||||
"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
|
"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
|
||||||
"order_by": "parent",
|
"order_by": "parent",
|
||||||
"links": {
|
"links": {
|
||||||
|
@ -220,4 +220,48 @@ class DocType:
|
|||||||
|
|
||||||
if self.doc.slideshow:
|
if self.doc.slideshow:
|
||||||
from website.helpers.slideshow import get_slideshow
|
from website.helpers.slideshow import get_slideshow
|
||||||
get_slideshow(self)
|
get_slideshow(self)
|
||||||
|
|
||||||
|
test_records = [
|
||||||
|
[{
|
||||||
|
"doctype": "Item",
|
||||||
|
"item_code": "_Test Item Home Desktop 100",
|
||||||
|
"item_name": "_Test Item Home Desktop 100",
|
||||||
|
"description": "_Test Item Home Desktop 100",
|
||||||
|
"item_group": "_Test Item Group Desktops",
|
||||||
|
"is_stock_item": "Yes",
|
||||||
|
"is_asset_item": "No",
|
||||||
|
"has_batch_no": "No",
|
||||||
|
"has_serial_no": "No",
|
||||||
|
"is_purchase_item": "Yes",
|
||||||
|
"is_sales_item": "Yes",
|
||||||
|
"is_service_item": "No",
|
||||||
|
"is_sample_item": "No",
|
||||||
|
"inspection_required": "No",
|
||||||
|
"is_pro_applicable": "No",
|
||||||
|
"is_sub_contracted_item": "No",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "Item Tax",
|
||||||
|
"tax_type": "_Test Account Excise Duty - _TC",
|
||||||
|
"tax_rate": 10
|
||||||
|
}],
|
||||||
|
[{
|
||||||
|
"doctype": "Item",
|
||||||
|
"item_code": "_Test Item Home Desktop 200",
|
||||||
|
"item_name": "_Test Item Home Desktop 200",
|
||||||
|
"description": "_Test Item Home Desktop 200",
|
||||||
|
"item_group": "_Test Item Group Desktops",
|
||||||
|
"is_stock_item": "Yes",
|
||||||
|
"is_asset_item": "No",
|
||||||
|
"has_batch_no": "No",
|
||||||
|
"has_serial_no": "No",
|
||||||
|
"is_purchase_item": "Yes",
|
||||||
|
"is_sales_item": "Yes",
|
||||||
|
"is_service_item": "No",
|
||||||
|
"is_sample_item": "No",
|
||||||
|
"inspection_required": "No",
|
||||||
|
"is_pro_applicable": "No",
|
||||||
|
"is_sub_contracted_item": "No",
|
||||||
|
}],
|
||||||
|
]
|
@ -18,7 +18,6 @@ from __future__ import unicode_literals
|
|||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
from webnotes.utils import cstr, flt, validate_email_add
|
from webnotes.utils import cstr, flt, validate_email_add
|
||||||
from webnotes.model.doc import Document
|
|
||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
from webnotes import msgprint
|
from webnotes import msgprint
|
||||||
|
|
||||||
@ -204,7 +203,15 @@ class DocType:
|
|||||||
# delete cancelled sle
|
# delete cancelled sle
|
||||||
if sql("""select name from `tabStock Ledger Entry`
|
if sql("""select name from `tabStock Ledger Entry`
|
||||||
where warehouse = %s and ifnull('is_cancelled', '') = 'No'""", self.doc.name):
|
where warehouse = %s and ifnull('is_cancelled', '') = 'No'""", self.doc.name):
|
||||||
mdgprint("""Warehosue can not be deleted as stock ledger entry
|
msgprint("""Warehosue can not be deleted as stock ledger entry
|
||||||
exists for this warehosue.""", raise_exception=1)
|
exists for this warehouse.""", raise_exception=1)
|
||||||
else:
|
else:
|
||||||
sql("delete from `tabStock Ledger Entry` where warehouse = %s", self.doc.name)
|
sql("delete from `tabStock Ledger Entry` where warehouse = %s", self.doc.name)
|
||||||
|
|
||||||
|
test_records = [
|
||||||
|
[{
|
||||||
|
"doctype": "Warehouse",
|
||||||
|
"warehouse_name": "_Test Warehouse",
|
||||||
|
"warehouse_type": "_Test Warehouse Type"
|
||||||
|
}]
|
||||||
|
]
|
Loading…
x
Reference in New Issue
Block a user