Merge branch 'edge' of github.com:webnotes/erpnext into edge
This commit is contained in:
commit
ce6d54869d
@ -116,19 +116,18 @@ cur_frm.cscript.convert_to_group = function(doc, cdt, cdn) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Master name get query
|
cur_frm.fields_dict['master_name'].get_query = function(doc) {
|
||||||
// -----------------------------------------
|
if (doc.master_type) {
|
||||||
cur_frm.fields_dict['master_name'].get_query=function(doc){
|
return {
|
||||||
if (doc.master_type){
|
query: "accounts.doctype.account.account.get_master_name",
|
||||||
return 'SELECT `tab'+doc.master_type+'`.name FROM `tab'+doc.master_type+'` WHERE `tab'+doc.master_type+'`.name LIKE "%s" and `tab'+doc.master_type+'`.docstatus != 2 ORDER BY `tab'+doc.master_type+'`.name LIMIT 50';
|
args: { "master_type": doc.master_type }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// parent account get query
|
cur_frm.fields_dict['parent_account'].get_query = function(doc) {
|
||||||
// -----------------------------------------
|
return {
|
||||||
cur_frm.fields_dict['parent_account'].get_query = function(doc){
|
query: "accounts.doctype.account.account.get_parent_account",
|
||||||
return 'SELECT DISTINCT `tabAccount`.name FROM `tabAccount` WHERE \
|
args: { "company": doc.company}
|
||||||
`tabAccount`.group_or_ledger="Group" AND `tabAccount`.docstatus != 2 AND \
|
}
|
||||||
`tabAccount`.company="'+ doc.company+'" AND `tabAccount`.company is not NULL AND \
|
|
||||||
`tabAccount`.name LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50';
|
|
||||||
}
|
}
|
||||||
|
@ -18,15 +18,11 @@ from __future__ import unicode_literals
|
|||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
from webnotes.utils import flt, fmt_money
|
from webnotes.utils import flt, fmt_money
|
||||||
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
|
||||||
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
|
||||||
@ -201,3 +197,40 @@ class DocType:
|
|||||||
(account_name, old))
|
(account_name, old))
|
||||||
|
|
||||||
return " - ".join(parts)
|
return " - ".join(parts)
|
||||||
|
|
||||||
|
def get_master_name(doctype, txt, searchfield, start, page_len, args):
|
||||||
|
return webnotes.conn.sql("""select name from `tab%s` where name like '%%%s%%'""" %
|
||||||
|
(args["master_type"], txt), as_list=1)
|
||||||
|
|
||||||
|
def get_parent_account(doctype, txt, searchfield, start, page_len, args):
|
||||||
|
return webnotes.conn.sql("""select name from tabAccount
|
||||||
|
where group_or_ledger = 'Group' and docstatus != 2 and company = '%s'
|
||||||
|
and name like '%%%s%%'""" % (args["company"], txt))
|
||||||
|
|
||||||
|
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"
|
||||||
|
}],
|
||||||
|
]
|
@ -32,5 +32,10 @@ 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"
|
||||||
|
}]
|
||||||
|
]
|
@ -152,6 +152,8 @@ class DocType(AccountsController):
|
|||||||
|
|
||||||
if r:
|
if r:
|
||||||
self.doc.remark = ("\n").join(r)
|
self.doc.remark = ("\n").join(r)
|
||||||
|
else:
|
||||||
|
webnotes.msgprint("Remarks is mandatory", raise_exception=1)
|
||||||
|
|
||||||
def set_aging_date(self):
|
def set_aging_date(self):
|
||||||
if self.doc.is_opening != 'Yes':
|
if self.doc.is_opening != 'Yes':
|
||||||
|
@ -34,15 +34,15 @@ def load_data():
|
|||||||
"group_or_ledger": "Ledger"})
|
"group_or_ledger": "Ledger"})
|
||||||
|
|
||||||
webnotes.insert({"doctype": "Account", "account_name": "Excise Duty",
|
webnotes.insert({"doctype": "Account", "account_name": "Excise Duty",
|
||||||
"parent_account": "Tax Assets - %s" % abbr, "company": company,
|
"parent_account": "_Test Tax Assets - %s" % abbr, "company": company,
|
||||||
"group_or_ledger": "Ledger"})
|
"group_or_ledger": "Ledger"})
|
||||||
|
|
||||||
webnotes.insert({"doctype": "Account", "account_name": "Education Cess",
|
webnotes.insert({"doctype": "Account", "account_name": "Education Cess",
|
||||||
"parent_account": "Tax Assets - %s" % abbr, "company": company,
|
"parent_account": "_Test Tax Assets - %s" % abbr, "company": company,
|
||||||
"group_or_ledger": "Ledger"})
|
"group_or_ledger": "Ledger"})
|
||||||
|
|
||||||
webnotes.insert({"doctype": "Account", "account_name": "S&H Education Cess",
|
webnotes.insert({"doctype": "Account", "account_name": "S&H Education Cess",
|
||||||
"parent_account": "Tax Assets - %s" % abbr, "company": company,
|
"parent_account": "_Test Tax Assets - %s" % abbr, "company": company,
|
||||||
"group_or_ledger": "Ledger"})
|
"group_or_ledger": "Ledger"})
|
||||||
|
|
||||||
webnotes.insert({"doctype": "Account", "account_name": "CST",
|
webnotes.insert({"doctype": "Account", "account_name": "CST",
|
||||||
@ -94,61 +94,68 @@ purchase_invoice_doclist = [
|
|||||||
{
|
{
|
||||||
"doctype": "Purchase Taxes and Charges", "charge_type": "Actual",
|
"doctype": "Purchase Taxes and Charges", "charge_type": "Actual",
|
||||||
"account_head": "Shipping Charges - %s" % abbr, "rate": 100, "tax_amount": 100,
|
"account_head": "Shipping Charges - %s" % abbr, "rate": 100, "tax_amount": 100,
|
||||||
"category": "Valuation and Total", "parentfield": "other_charges",
|
"category": "Valuation and Total", "parentfield": "purchase_tax_details",
|
||||||
"cost_center": "Default Cost Center - %s" % abbr
|
"cost_center": "Default Cost Center - %s" % abbr, "add_deduct_tax": "Add"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "Purchase Taxes and Charges", "charge_type": "On Net Total",
|
"doctype": "Purchase Taxes and Charges", "charge_type": "On Net Total",
|
||||||
"account_head": "Customs Duty - %s" % abbr, "rate": 10, "tax_amount": 125.00,
|
"account_head": "Customs Duty - %s" % abbr, "rate": 10, "tax_amount": 125.00,
|
||||||
"category": "Valuation", "parentfield": "other_charges",
|
"category": "Valuation", "parentfield": "purchase_tax_details",
|
||||||
"cost_center": "Default Cost Center - %s" % abbr
|
"cost_center": "Default Cost Center - %s" % abbr, "add_deduct_tax": "Add"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "Purchase Taxes and Charges", "charge_type": "On Net Total",
|
"doctype": "Purchase Taxes and Charges", "charge_type": "On Net Total",
|
||||||
"account_head": "Excise Duty - %s" % abbr, "rate": 12, "tax_amount": 140.00,
|
"account_head": "Excise Duty - %s" % abbr, "rate": 12, "tax_amount": 140.00,
|
||||||
"category": "Total", "parentfield": "other_charges"
|
"category": "Total", "parentfield": "purchase_tax_details", "add_deduct_tax": "Add"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "Purchase Taxes and Charges", "charge_type": "On Previous Row Amount",
|
"doctype": "Purchase Taxes and Charges", "charge_type": "On Previous Row Amount",
|
||||||
"account_head": "Education Cess - %s" % abbr, "rate": 2, "row_id": 3, "tax_amount": 2.80,
|
"account_head": "Education Cess - %s" % abbr, "rate": 2, "row_id": 3, "tax_amount": 2.80,
|
||||||
"category": "Total", "parentfield": "other_charges"
|
"category": "Total", "parentfield": "purchase_tax_details", "add_deduct_tax": "Add"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "Purchase Taxes and Charges", "charge_type": "On Previous Row Amount",
|
"doctype": "Purchase Taxes and Charges", "charge_type": "On Previous Row Amount",
|
||||||
"account_head": "S&H Education Cess - %s" % abbr, "rate": 1, "row_id": 3,
|
"account_head": "S&H Education Cess - %s" % abbr, "rate": 1, "row_id": 3,
|
||||||
"tax_amount": 1.4, "category": "Total", "parentfield": "other_charges"
|
"tax_amount": 1.4, "category": "Total", "parentfield": "purchase_tax_details",
|
||||||
|
"add_deduct_tax": "Add"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "Purchase Taxes and Charges", "charge_type": "On Previous Row Total",
|
"doctype": "Purchase Taxes and Charges", "charge_type": "On Previous Row Total",
|
||||||
"account_head": "CST - %s" % abbr, "rate": 2, "row_id": 5, "tax_amount": 29.88,
|
"account_head": "CST - %s" % abbr, "rate": 2, "row_id": 5, "tax_amount": 29.88,
|
||||||
"category": "Total", "parentfield": "other_charges",
|
"category": "Total", "parentfield": "purchase_tax_details",
|
||||||
"cost_center": "Default Cost Center - %s" % abbr
|
"cost_center": "Default Cost Center - %s" % abbr, "add_deduct_tax": "Add"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "Purchase Taxes and Charges", "charge_type": "On Net Total",
|
"doctype": "Purchase Taxes and Charges", "charge_type": "On Net Total",
|
||||||
"account_head": "VAT - Test - %s" % abbr, "rate": 12.5, "tax_amount": 156.25,
|
"account_head": "VAT - Test - %s" % abbr, "rate": 12.5, "tax_amount": 156.25,
|
||||||
"category": "Total", "parentfield": "other_charges"
|
"category": "Total", "parentfield": "purchase_tax_details", "add_deduct_tax": "Add"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "Purchase Taxes and Charges", "charge_type": "On Previous Row Total",
|
"doctype": "Purchase Taxes and Charges", "charge_type": "On Previous Row Total",
|
||||||
"account_head": "Discount - %s" % abbr, "rate": -10, "row_id": 7, "tax_amount": -168.03,
|
"account_head": "Discount - %s" % abbr, "rate": 10, "row_id": 7, "tax_amount": 168.03,
|
||||||
"category": "Total", "parentfield": "other_charges",
|
"category": "Total", "parentfield": "purchase_tax_details",
|
||||||
"cost_center": "Default Cost Center - %s" % abbr
|
"cost_center": "Default Cost Center - %s" % abbr, "add_deduct_tax": "Deduct"
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
class TestPurchaseReceipt(unittest.TestCase):
|
class TestPurchaseInvoice(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
webnotes.conn.begin()
|
webnotes.conn.begin()
|
||||||
load_data()
|
load_data()
|
||||||
# webnotes.conn.set_value("Global Defaults", None, "automatic_inventory_accounting", 1)
|
# webnotes.conn.set_value("Global Defaults", None, "automatic_inventory_accounting", 1)
|
||||||
|
self.load_test_data()
|
||||||
|
|
||||||
def test_gl_entries(self):
|
def load_test_data(self):
|
||||||
from webnotes.model.doclist import DocList
|
from webnotes.test_runner import make_test_records
|
||||||
controller = webnotes.insert(DocList(purchase_invoice_doclist))
|
make_test_records("Cost Center", verbose=0)
|
||||||
controller.submit()
|
make_test_records("Item", verbose=0)
|
||||||
controller.load_from_db()
|
make_test_records("Purchase Invoice", verbose=0)
|
||||||
dl = controller.doclist
|
|
||||||
|
def atest_gl_entries(self):
|
||||||
|
wrapper = webnotes.model_wrapper(purchase_invoice_doclist).insert()
|
||||||
|
wrapper.submit()
|
||||||
|
wrapper.load_from_db()
|
||||||
|
dl = wrapper.doclist
|
||||||
|
|
||||||
expected_gl_entries = {
|
expected_gl_entries = {
|
||||||
"East Wind Inc. - %s" % abbr : [0, 1512.30],
|
"East Wind Inc. - %s" % abbr : [0, 1512.30],
|
||||||
@ -166,5 +173,177 @@ class TestPurchaseReceipt(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):
|
||||||
|
test_doclist = [
|
||||||
|
# parent
|
||||||
|
{
|
||||||
|
"doctype": "Purchase Invoice",
|
||||||
|
"naming_series": "BILL",
|
||||||
|
"supplier_name": "_Test Supplier",
|
||||||
|
"credit_to": "_Test Supplier - _TC",
|
||||||
|
"bill_no": "NA",
|
||||||
|
"posting_date": "2013-02-03",
|
||||||
|
"fiscal_year": "_Test Fiscal Year",
|
||||||
|
"company": "_Test Company",
|
||||||
|
"currency": "INR",
|
||||||
|
"conversion_rate": 1,
|
||||||
|
"grand_total_import": 0 # for feed
|
||||||
|
},
|
||||||
|
# items
|
||||||
|
{
|
||||||
|
"doctype": "Purchase Invoice Item",
|
||||||
|
"parentfield": "entries",
|
||||||
|
"item_code": "_Test Item Home Desktop 100",
|
||||||
|
"item_name": "_Test Item Home Desktop 100",
|
||||||
|
"qty": 10,
|
||||||
|
"import_rate": 50,
|
||||||
|
"import_amount": 500,
|
||||||
|
"rate": 50,
|
||||||
|
"amount": 50,
|
||||||
|
"uom": "_Test UOM",
|
||||||
|
"item_tax_rate": json.dumps({"_Test Account Excise Duty - _TC": 10}),
|
||||||
|
"expense_head": "_Test Account Cost for Goods Sold - _TC",
|
||||||
|
"cost_center": "_Test Cost Center - _TC"
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "Purchase Invoice Item",
|
||||||
|
"parentfield": "entries",
|
||||||
|
"item_code": "_Test Item Home Desktop 200",
|
||||||
|
"item_name": "_Test Item Home Desktop 200",
|
||||||
|
"qty": 5,
|
||||||
|
"import_rate": 150,
|
||||||
|
"import_amount": 750,
|
||||||
|
"rate": 150,
|
||||||
|
"amount": 750,
|
||||||
|
"uom": "_Test UOM",
|
||||||
|
"expense_head": "_Test Account Cost for Goods Sold - _TC",
|
||||||
|
"cost_center": "_Test Cost Center - _TC"
|
||||||
|
},
|
||||||
|
# taxes
|
||||||
|
{
|
||||||
|
"doctype": "Purchase Taxes and Charges",
|
||||||
|
"parentfield": "purchase_tax_details",
|
||||||
|
"charge_type": "Actual",
|
||||||
|
"account_head": "_Test Account Shipping Charges - _TC",
|
||||||
|
"cost_center": "_Test Cost Center - _TC",
|
||||||
|
"description": "Shipping Charges",
|
||||||
|
"category": "Valuation and Total",
|
||||||
|
"add_deduct_tax": "Add",
|
||||||
|
"rate": 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "Purchase Taxes and Charges",
|
||||||
|
"parentfield": "purchase_tax_details",
|
||||||
|
"charge_type": "On Net Total",
|
||||||
|
"account_head": "_Test Account Customs Duty - _TC",
|
||||||
|
"cost_center": "_Test Cost Center - _TC",
|
||||||
|
"description": "Customs Duty",
|
||||||
|
"category": "Valuation",
|
||||||
|
"add_deduct_tax": "Add",
|
||||||
|
"rate": 10
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "Purchase Taxes and Charges",
|
||||||
|
"parentfield": "purchase_tax_details",
|
||||||
|
"charge_type": "On Net Total",
|
||||||
|
"account_head": "_Test Account Excise Duty - _TC",
|
||||||
|
"cost_center": "_Test Cost Center - _TC",
|
||||||
|
"description": "Excise Duty",
|
||||||
|
"category": "Total",
|
||||||
|
"add_deduct_tax": "Add",
|
||||||
|
"rate": 12
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "Purchase Taxes and Charges",
|
||||||
|
"parentfield": "purchase_tax_details",
|
||||||
|
"charge_type": "On Previous Row Amount",
|
||||||
|
"account_head": "_Test Account Education Cess - _TC",
|
||||||
|
"cost_center": "_Test Cost Center - _TC",
|
||||||
|
"description": "Education Cess",
|
||||||
|
"category": "Total",
|
||||||
|
"add_deduct_tax": "Add",
|
||||||
|
"rate": 2,
|
||||||
|
"row_id": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "Purchase Taxes and Charges",
|
||||||
|
"parentfield": "purchase_tax_details",
|
||||||
|
"charge_type": "On Previous Row Amount",
|
||||||
|
"account_head": "_Test Account S&H Education Cess - _TC",
|
||||||
|
"cost_center": "_Test Cost Center - _TC",
|
||||||
|
"description": "S&H Education Cess",
|
||||||
|
"category": "Total",
|
||||||
|
"add_deduct_tax": "Add",
|
||||||
|
"rate": 1,
|
||||||
|
"row_id": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "Purchase Taxes and Charges",
|
||||||
|
"parentfield": "purchase_tax_details",
|
||||||
|
"charge_type": "On Previous Row Total",
|
||||||
|
"account_head": "_Test Account CST - _TC",
|
||||||
|
"cost_center": "_Test Cost Center - _TC",
|
||||||
|
"description": "CST",
|
||||||
|
"category": "Total",
|
||||||
|
"add_deduct_tax": "Add",
|
||||||
|
"rate": 2,
|
||||||
|
"row_id": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "Purchase Taxes and Charges",
|
||||||
|
"parentfield": "purchase_tax_details",
|
||||||
|
"charge_type": "On Net Total",
|
||||||
|
"account_head": "_Test Account VAT - _TC",
|
||||||
|
"cost_center": "_Test Cost Center - _TC",
|
||||||
|
"description": "VAT",
|
||||||
|
"category": "Total",
|
||||||
|
"add_deduct_tax": "Add",
|
||||||
|
"rate": 12.5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "Purchase Taxes and Charges",
|
||||||
|
"parentfield": "purchase_tax_details",
|
||||||
|
"charge_type": "On Previous Row Total",
|
||||||
|
"account_head": "_Test Account Discount - _TC",
|
||||||
|
"cost_center": "_Test Cost Center - _TC",
|
||||||
|
"description": "Discount",
|
||||||
|
"category": "Total",
|
||||||
|
"add_deduct_tax": "Deduct",
|
||||||
|
"rate": 10,
|
||||||
|
"row_id": 7
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
wrapper = webnotes.model_wrapper(test_doclist).insert()
|
||||||
|
wrapper.load_from_db()
|
||||||
|
|
||||||
|
# tax amounts
|
||||||
|
expected_values = [
|
||||||
|
["_Test Account Shipping Charges - _TC", 100, 1350],
|
||||||
|
["_Test Account Customs Duty - _TC", 125, 1350],
|
||||||
|
["_Test Account Excise Duty - _TC", 140, 1490],
|
||||||
|
["_Test Account Education Cess - _TC", 2.8, 1492.8],
|
||||||
|
["_Test Account S&H Education Cess - _TC", 1.4, 1494.2],
|
||||||
|
["_Test Account CST - _TC", 29.88, 1524.08],
|
||||||
|
["_Test Account VAT - _TC", 156.25, 1680.33],
|
||||||
|
["_Test Account Discount - _TC", 168.03, 1512.30],
|
||||||
|
]
|
||||||
|
|
||||||
|
for i, tax in enumerate(wrapper.doclist.get({"parentfield": "purchase_tax_details"})):
|
||||||
|
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])
|
||||||
|
|
||||||
|
expected_values = [
|
||||||
|
["_Test Item Home Desktop 100", 90],
|
||||||
|
["_Test Item Home Desktop 200", 135]
|
||||||
|
]
|
||||||
|
for i, item in enumerate(wrapper.doclist.get({"parentfield": "entries"})):
|
||||||
|
self.assertEqual(item.item_code, expected_values[i][0])
|
||||||
|
self.assertEqual(item.item_tax_amount, expected_values[i][1])
|
||||||
|
|
||||||
|
# self.assertEqual(dl[0].net_total, 1250)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
webnotes.conn.rollback()
|
webnotes.conn.rollback()
|
@ -32,16 +32,16 @@ def load_data():
|
|||||||
|
|
||||||
# create customer group
|
# create customer group
|
||||||
webnotes.insert({"doctype": "Customer Group",
|
webnotes.insert({"doctype": "Customer Group",
|
||||||
"customer_group_name": "Default Customer Group",
|
"customer_group_name": "_Test Customer Group",
|
||||||
"parent_customer_group": "All Customer Groups", "is_group": "No"})
|
"parent_customer_group": "All Customer Groups", "is_group": "No"})
|
||||||
|
|
||||||
# create customer
|
# create customer
|
||||||
webnotes.insert({"doctype": "Customer", "customer_name": "West Wind Inc.",
|
webnotes.insert({"doctype": "Customer", "customer_name": "West Wind Inc.",
|
||||||
"customer_type": "Company", "territory": "Default",
|
"customer_type": "Company", "territory": "Default",
|
||||||
"customer_group": "Default Customer Group", "company": company,
|
"customer_group": "_Test Customer Group", "company": company,
|
||||||
"credit_days": 50, "credit_limit": 0})
|
"credit_days": 50, "credit_limit": 0})
|
||||||
|
|
||||||
webnotes.insert({"doctype": "Account", "account_name": "Sales",
|
webnotes.insert({"doctype": "Account", "account_name": "_Test Account Sales",
|
||||||
"parent_account": "Income - %s" % abbr, "company": company,
|
"parent_account": "Income - %s" % abbr, "company": company,
|
||||||
"group_or_ledger": "Ledger"})
|
"group_or_ledger": "Ledger"})
|
||||||
|
|
||||||
@ -93,15 +93,15 @@ sales_invoice_doclist = [
|
|||||||
"doctype": "Sales Invoice Item", "warehouse": "Default Warehouse",
|
"doctype": "Sales Invoice Item", "warehouse": "Default Warehouse",
|
||||||
"item_code": "Home Desktop 100", "qty": 10, "basic_rate": 50, "amount": 500,
|
"item_code": "Home Desktop 100", "qty": 10, "basic_rate": 50, "amount": 500,
|
||||||
"parentfield": "entries", "so_detail": None, "dn_detail": None,
|
"parentfield": "entries", "so_detail": None, "dn_detail": None,
|
||||||
"uom": "Nos", "item_tax_rate": json.dumps({"Excise Duty - %s" % abbr: 10}),
|
"stock_uom": "Nos", "item_tax_rate": json.dumps({"Excise Duty - %s" % abbr: 10}),
|
||||||
"income_account": "Sales - %s" % abbr,
|
"income_account": "_Test Account Sales - %s" % abbr,
|
||||||
"cost_center": "Default Cost Center - %s" % abbr
|
"cost_center": "Default Cost Center - %s" % abbr
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "Sales Invoice Item", "warehouse": "Default Warehouse",
|
"doctype": "Sales Invoice Item", "warehouse": "Default Warehouse",
|
||||||
"item_code": "Home Desktop 200", "qty": 5, "basic_rate": 150, "amount": 750,
|
"item_code": "Home Desktop 200", "qty": 5, "basic_rate": 150, "amount": 750,
|
||||||
"so_detail": None, "dn_detail": None,
|
"so_detail": None, "dn_detail": None,
|
||||||
"parentfield": "entries", "uom": "Nos", "income_account": "Sales - %s" % abbr,
|
"parentfield": "entries", "stock_uom": "Nos", "income_account": "_Test Account Sales - %s" % abbr,
|
||||||
"cost_center": "Default Cost Center - %s" % abbr
|
"cost_center": "Default Cost Center - %s" % abbr
|
||||||
},
|
},
|
||||||
# taxes
|
# taxes
|
||||||
@ -211,7 +211,7 @@ class TestSalesInvoice(unittest.TestCase):
|
|||||||
|
|
||||||
expected_gl_entries = {
|
expected_gl_entries = {
|
||||||
"West Wind Inc. - %s" % abbr : [1627.05, 0.0],
|
"West Wind Inc. - %s" % abbr : [1627.05, 0.0],
|
||||||
"Sales - %s" % abbr: [0.0, 1250.00],
|
"_Test Account Sales - %s" % abbr: [0.0, 1250.00],
|
||||||
"Shipping Charges - %s" % abbr: [0.0, 100],
|
"Shipping Charges - %s" % abbr: [0.0, 100],
|
||||||
"Customs Duty - %s" % abbr: [0, 125.0],
|
"Customs Duty - %s" % abbr: [0, 125.0],
|
||||||
"Excise Duty - %s" % abbr: [0, 140],
|
"Excise Duty - %s" % abbr: [0, 140],
|
||||||
|
@ -168,7 +168,7 @@ def import_vouchers(common_values, data, start_idx, import_type):
|
|||||||
webnotes.conn.commit()
|
webnotes.conn.commit()
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
webnotes.conn.rollback()
|
webnotes.conn.rollback()
|
||||||
err_msg = webnotes.message_log and webnotes.message_log[0] or unicode(e)
|
err_msg = webnotes.message_log and "<br>".join(webnotes.message_log) or unicode(e)
|
||||||
messages.append("""<p style='color: red'>[row #%s] %s failed: %s</p>"""
|
messages.append("""<p style='color: red'>[row #%s] %s failed: %s</p>"""
|
||||||
% ((start_idx + 1) + i, jv.name or "", err_msg or "No message"))
|
% ((start_idx + 1) + i, jv.name or "", err_msg or "No message"))
|
||||||
messages.append("<p style='color: red'>All transactions rolled back</p>")
|
messages.append("<p style='color: red'>All transactions rolled back</p>")
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"creation": "2013-01-28 10:05:59",
|
"creation": "2013-01-30 12:49:48",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-01-29 16:28:05",
|
"modified": "2013-02-07 10:49:35",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -344,7 +344,7 @@
|
|||||||
"oldfieldtype": "Currency",
|
"oldfieldtype": "Currency",
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"print_width": "100px",
|
"print_width": "100px",
|
||||||
"read_only": 1,
|
"read_only": 0,
|
||||||
"width": "100px"
|
"width": "100px"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -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"
|
||||||
|
}]
|
||||||
|
]
|
@ -17,7 +17,6 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
from webnotes.utils import flt
|
from webnotes.utils import flt
|
||||||
from webnotes.model.doc import addchild
|
|
||||||
from utilities.transaction_base import TransactionBase
|
from utilities.transaction_base import TransactionBase
|
||||||
|
|
||||||
class AccountsController(TransactionBase):
|
class AccountsController(TransactionBase):
|
||||||
@ -47,15 +46,13 @@ class AccountsController(TransactionBase):
|
|||||||
|
|
||||||
return stock_in_hand
|
return stock_in_hand
|
||||||
|
|
||||||
def clear_unallocated_advances(self, parenttype, parentfield):
|
def clear_unallocated_advances(self, childtype, parentfield):
|
||||||
for d in self.doclist:
|
self.doclist.remove_items({"parentfield": parentfield, "allocated_amount": ["in", [0, None, ""]]})
|
||||||
if d.parentfield == parentfield and flt(d.allocated_amount) == 0:
|
|
||||||
self.doclist.remove(d)
|
|
||||||
|
|
||||||
webnotes.conn.sql("""delete from `tab%s` where parent = %s
|
webnotes.conn.sql("""delete from `tab%s` where parentfield=%s and parent = %s
|
||||||
and ifnull(allocated_amount, 0) = 0""" % (parenttype, '%s'), self.doc.name)
|
and ifnull(allocated_amount, 0) = 0""" % (childtype, '%s', '%s'), (parentfield, self.doc.name))
|
||||||
|
|
||||||
def get_advances(self, account_head, parenttype, parentfield, dr_or_cr):
|
def get_advances(self, account_head, child_doctype, parentfield, dr_or_cr):
|
||||||
res = webnotes.conn.sql("""select t1.name as jv_no, t1.remark,
|
res = webnotes.conn.sql("""select t1.name as jv_no, t1.remark,
|
||||||
t2.%s as amount, t2.name as jv_detail_no
|
t2.%s as amount, t2.name as jv_detail_no
|
||||||
from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2
|
from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2
|
||||||
@ -68,9 +65,12 @@ class AccountsController(TransactionBase):
|
|||||||
|
|
||||||
self.doclist = self.doc.clear_table(self.doclist, parentfield)
|
self.doclist = self.doc.clear_table(self.doclist, parentfield)
|
||||||
for d in res:
|
for d in res:
|
||||||
add = addchild(self.doc, parentfield, parenttype, self.doclist)
|
self.doclist.append({
|
||||||
add.journal_voucher = d.jv_no
|
"doctype": child_doctype,
|
||||||
add.jv_detail_no = d.jv_detail_no
|
"parentfield": parentfield,
|
||||||
add.remarks = d.remark
|
"journal_voucher": d.jv_no,
|
||||||
add.advance_amount = flt(d.amount)
|
"jv_detail_no": d.jv_detail_no,
|
||||||
add.allocate_amount = 0
|
"remarks": d.remark,
|
||||||
|
"advance_amount": flt(d.amount),
|
||||||
|
"allocate_amount": 0
|
||||||
|
})
|
@ -84,3 +84,14 @@ class BuyingController(AccountsController):
|
|||||||
if self.meta.get_field("in_words_import"):
|
if self.meta.get_field("in_words_import"):
|
||||||
self.doc.in_words_import = money_in_words(self.doc.grand_total_import,
|
self.doc.in_words_import = money_in_words(self.doc.grand_total_import,
|
||||||
self.doc.currency)
|
self.doc.currency)
|
||||||
|
|
||||||
|
def calculate_taxes_and_totals(self):
|
||||||
|
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()
|
||||||
|
|
@ -77,9 +77,8 @@ class DocType:
|
|||||||
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)
|
||||||
|
|
||||||
if webnotes.conn.get_default("employee", webnotes.session.user) != self.doc.employee:
|
if webnotes.conn.get_value("Employee", self.doc.employee, "user_id") != \
|
||||||
|
webnotes.session.user and total == 0:
|
||||||
if 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)
|
||||||
|
|
||||||
self.doc.total_score = total
|
self.doc.total_score = total
|
||||||
|
@ -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",
|
||||||
|
@ -23,7 +23,8 @@ class DocType:
|
|||||||
test_records = [[{
|
test_records = [[{
|
||||||
"doctype":"Holiday Block List",
|
"doctype":"Holiday Block List",
|
||||||
"holiday_block_list_name": "_Test Holiday Block List",
|
"holiday_block_list_name": "_Test Holiday Block List",
|
||||||
"year": "_Test Fiscal Year"
|
"year": "_Test Fiscal Year",
|
||||||
|
"company": "_Test Company"
|
||||||
}, {
|
}, {
|
||||||
"doctype": "Holiday Block List Date",
|
"doctype": "Holiday Block List Date",
|
||||||
"parent": "_Test Holiday Block List",
|
"parent": "_Test Holiday Block List",
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-02-04 15:31:29",
|
"creation": "2013-02-04 15:31:29",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-02-06 14:39:09",
|
"modified": "2013-02-07 08:47:25",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -53,6 +53,21 @@
|
|||||||
"options": "Fiscal Year",
|
"options": "Fiscal Year",
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "company",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Company",
|
||||||
|
"options": "Company",
|
||||||
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "If not checked, the list will have to be added to each Department where it has to be applied.",
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "applies_to_all_departments",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Applies to all Departments"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Stop users from making Leave Applications on following days.",
|
"description": "Stop users from making Leave Applications on following days.",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
|
@ -46,15 +46,32 @@ class DocType:
|
|||||||
raise_exception=True)
|
raise_exception=True)
|
||||||
|
|
||||||
def validate_block_days(self):
|
def validate_block_days(self):
|
||||||
from_date = getdate(self.doc.from_date)
|
for block_list in self.get_applicable_block_lists():
|
||||||
to_date = getdate(self.doc.to_date)
|
self.check_block_dates(block_list)
|
||||||
|
|
||||||
|
def get_applicable_block_lists(self):
|
||||||
|
block_lists = []
|
||||||
|
def add_block_list(block_list):
|
||||||
|
if block_list:
|
||||||
|
if not self.is_user_in_allow_list(block_list):
|
||||||
|
block_lists.append(block_list)
|
||||||
|
|
||||||
|
# per department
|
||||||
department = webnotes.conn.get_value("Employee", self.doc.employee, "department")
|
department = webnotes.conn.get_value("Employee", self.doc.employee, "department")
|
||||||
if department:
|
if department:
|
||||||
block_list = webnotes.conn.get_value("Department", department, "holiday_block_list")
|
block_list = webnotes.conn.get_value("Department", department, "holiday_block_list")
|
||||||
if block_list:
|
add_block_list(block_list)
|
||||||
if self.is_user_in_allow_list(block_list):
|
|
||||||
return
|
# global
|
||||||
|
for block_list in webnotes.conn.sql_list("""select name from `tabHoliday Block List`
|
||||||
|
where ifnull(applies_to_all_departments,0)=1 and company=%s""", self.doc.company):
|
||||||
|
add_block_list(block_list)
|
||||||
|
|
||||||
|
return block_lists
|
||||||
|
|
||||||
|
def check_block_dates(self, block_list):
|
||||||
|
from_date = getdate(self.doc.from_date)
|
||||||
|
to_date = getdate(self.doc.to_date)
|
||||||
for d in webnotes.conn.sql("""select block_date, reason from
|
for d in webnotes.conn.sql("""select block_date, reason from
|
||||||
`tabHoliday Block List Date` where parent=%s""", block_list, as_dict=1):
|
`tabHoliday Block List Date` where parent=%s""", block_list, as_dict=1):
|
||||||
block_date = getdate(d.block_date)
|
block_date = getdate(d.block_date)
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"creation": "2013-01-10 16:34:14",
|
"creation": "2013-02-02 14:40:08",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-02-01 10:34:14",
|
"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,18 +175,27 @@
|
|||||||
"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
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "company",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Company",
|
||||||
|
"options": "Company",
|
||||||
|
"permlevel": 0,
|
||||||
|
"reqd": 1
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "letter_head",
|
"fieldname": "letter_head",
|
||||||
"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
|
||||||
},
|
},
|
||||||
|
@ -1,23 +1,39 @@
|
|||||||
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):
|
||||||
|
def get_application(self):
|
||||||
|
application = webnotes.model_wrapper(test_records[1])
|
||||||
|
application.doc.from_date = "2013-01-01"
|
||||||
|
application.doc.to_date = "2013-01-05"
|
||||||
|
return application
|
||||||
|
|
||||||
def test_block_list(self):
|
def test_block_list(self):
|
||||||
import webnotes
|
import webnotes
|
||||||
webnotes.conn.set_value("Employee", "_T-Employee-0001", "department",
|
webnotes.conn.set_value("Employee", "_T-Employee-0001", "department",
|
||||||
"_Test Department with Block List")
|
"_Test Department with Block List")
|
||||||
|
|
||||||
application = webnotes.model_wrapper(test_records[1])
|
application = self.get_application()
|
||||||
application.doc.from_date = "2013-01-01"
|
|
||||||
application.doc.to_date = "2013-01-05"
|
|
||||||
self.assertRaises(LeaveDayBlockedError, application.insert)
|
self.assertRaises(LeaveDayBlockedError, application.insert)
|
||||||
|
|
||||||
webnotes.session.user = "test1@erpnext.com"
|
webnotes.session.user = "test1@erpnext.com"
|
||||||
webnotes.get_obj("Profile", "test1@erpnext.com").add_role("HR User")
|
webnotes.get_obj("Profile", "test1@erpnext.com").add_role("HR User")
|
||||||
self.assertTrue(application.insert())
|
self.assertTrue(application.insert())
|
||||||
|
|
||||||
|
def test_global_block_list(self):
|
||||||
|
application = self.get_application()
|
||||||
|
webnotes.conn.set_value("Holiday Block List", "_Test Holiday Block List",
|
||||||
|
"applies_to_all_departments", 1)
|
||||||
|
webnotes.conn.set_value("Employee", "_T-Employee-0001", "department",
|
||||||
|
"_Test Department")
|
||||||
|
webnotes.session.user = "test@erpnext.com"
|
||||||
|
|
||||||
|
self.assertRaises(LeaveDayBlockedError, application.insert)
|
||||||
|
|
||||||
test_records = [
|
test_records = [
|
||||||
[{
|
[{
|
||||||
@ -35,11 +51,11 @@ test_records = [
|
|||||||
"to_date": "2013-05-05",
|
"to_date": "2013-05-05",
|
||||||
"posting_date": "2013-01-02",
|
"posting_date": "2013-01-02",
|
||||||
"fiscal_year": "_Test Fiscal Year",
|
"fiscal_year": "_Test Fiscal Year",
|
||||||
"employee": "_T-Employee-0001"
|
"employee": "_T-Employee-0001",
|
||||||
|
"company": "_Test Company"
|
||||||
}]]
|
}]]
|
||||||
|
|
||||||
if __name__=="__main__":
|
if __name__=="__main__":
|
||||||
sys.path.extend(["app", "lib"])
|
|
||||||
import webnotes
|
import webnotes
|
||||||
webnotes.connect()
|
webnotes.connect()
|
||||||
|
|
||||||
|
12
patches/february_2013/update_company_in_leave_application.py
Normal file
12
patches/february_2013/update_company_in_leave_application.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
def execute():
|
||||||
|
import webnotes
|
||||||
|
webnotes.reload_doc("hr", "doctype", "leave_application")
|
||||||
|
|
||||||
|
webnotes.conn.sql("""update `tabLeave Application`, `tabEmployee` set
|
||||||
|
`tabLeave Application`.company = `tabEmployee`.company where
|
||||||
|
`tabLeave Application`.employee = `tabEmployee`.name""")
|
||||||
|
|
||||||
|
company = webnotes.conn.get_default("company")
|
||||||
|
if company:
|
||||||
|
webnotes.conn.sql("""update `tabLeave Application`
|
||||||
|
set company = %s where ifnull(company,'')=''""", company)
|
@ -166,4 +166,5 @@ patch_list = [
|
|||||||
"patches.february_2013.remove_sales_order_pending_items",
|
"patches.february_2013.remove_sales_order_pending_items",
|
||||||
"patches.february_2013.account_negative_balance",
|
"patches.february_2013.account_negative_balance",
|
||||||
"patches.february_2013.remove_account_utils_folder",
|
"patches.february_2013.remove_account_utils_folder",
|
||||||
|
"patches.february_2013.update_company_in_leave_application"
|
||||||
]
|
]
|
@ -249,3 +249,14 @@ 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_name": "_Test Customer",
|
||||||
|
"customer_type": "Individual",
|
||||||
|
"customer_group": "_Test Customer Group",
|
||||||
|
"territory": "_Test Territory",
|
||||||
|
"company": "_Test Company"
|
||||||
|
}]
|
||||||
|
]
|
@ -20,3 +20,10 @@ 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"
|
}],
|
||||||
}]
|
|
||||||
]
|
]
|
@ -20,3 +20,10 @@ 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
|
||||||
@ -64,3 +61,12 @@ class DocType(DocTypeNestedSet):
|
|||||||
|
|
||||||
# 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"
|
||||||
|
}]
|
||||||
|
]
|
@ -68,3 +68,18 @@ 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"
|
||||||
|
}],
|
||||||
|
]
|
@ -20,3 +20,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": "Supplier Type",
|
||||||
|
"supplier_type": "_Test Supplier Type",
|
||||||
|
}]
|
||||||
|
]
|
@ -33,3 +33,12 @@ class DocType(DocTypeNestedSet):
|
|||||||
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",
|
||||||
|
}]
|
||||||
|
]
|
@ -20,3 +20,10 @@ 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"
|
||||||
|
}]
|
||||||
|
]
|
@ -20,3 +20,10 @@ 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": {
|
||||||
|
@ -122,19 +122,18 @@ class DocType:
|
|||||||
cust_code.append(d.ref_code)
|
cust_code.append(d.ref_code)
|
||||||
self.doc.customer_code=','.join(cust_code)
|
self.doc.customer_code=','.join(cust_code)
|
||||||
|
|
||||||
# Check whether Tax Rate is not entered twice for same Tax Type
|
|
||||||
def check_item_tax(self):
|
def check_item_tax(self):
|
||||||
|
"""Check whether Tax Rate is not entered twice for same Tax Type"""
|
||||||
check_list=[]
|
check_list=[]
|
||||||
for d in getlist(self.doclist,'item_tax'):
|
for d in getlist(self.doclist,'item_tax'):
|
||||||
account_type = sql("select account_type from tabAccount where name = %s",d.tax_type)
|
if d.tax_type:
|
||||||
account_type = account_type and account_type[0][0] or ''
|
account_type = webnotes.conn.get_value("Account", d.tax_type, "account_type")
|
||||||
|
|
||||||
if account_type not in ['Tax', 'Chargeable']:
|
if account_type not in ['Tax', 'Chargeable']:
|
||||||
msgprint("'%s' is not Tax / Chargeable Account"%(d.tax_type))
|
msgprint("'%s' is not Tax / Chargeable Account" % d.tax_type, raise_exception=1)
|
||||||
raise Exception, "Tax Account validation"
|
|
||||||
else:
|
else:
|
||||||
if d.tax_type in check_list:
|
if d.tax_type in check_list:
|
||||||
msgprint("Rate is entered twice for Tax : '%s'." % (d.tax_type))
|
msgprint("Rate is entered twice for: '%s'" % d.tax_type, raise_exception=1)
|
||||||
raise Exception
|
|
||||||
else:
|
else:
|
||||||
check_list.append(d.tax_type)
|
check_list.append(d.tax_type)
|
||||||
|
|
||||||
@ -222,3 +221,49 @@ 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",
|
||||||
|
"stock_uom": "_Test UOM"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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",
|
||||||
|
"stock_uom": "_Test UOM"
|
||||||
|
}],
|
||||||
|
]
|
@ -56,7 +56,7 @@ def load_data():
|
|||||||
webnotes.insert({"doctype": "Cost Center", "group_or_ledger": "Ledger",
|
webnotes.insert({"doctype": "Cost Center", "group_or_ledger": "Ledger",
|
||||||
"cost_center_name": "Default Cost Center",
|
"cost_center_name": "Default Cost Center",
|
||||||
"parent_cost_center": "Root - %s" % abbr,
|
"parent_cost_center": "Root - %s" % abbr,
|
||||||
"company_name": company, "company_abbr": abbr})
|
"company_name": company})
|
||||||
|
|
||||||
# create account heads for taxes
|
# create account heads for taxes
|
||||||
|
|
||||||
@ -67,11 +67,11 @@ def load_data():
|
|||||||
webnotes.insert({"doctype": "Account", "account_name": "Customs Duty",
|
webnotes.insert({"doctype": "Account", "account_name": "Customs Duty",
|
||||||
"parent_account": "Stock Expenses - %s" % abbr, "company": company,
|
"parent_account": "Stock Expenses - %s" % abbr, "company": company,
|
||||||
"group_or_ledger": "Ledger"})
|
"group_or_ledger": "Ledger"})
|
||||||
webnotes.insert({"doctype": "Account", "account_name": "Tax Assets",
|
webnotes.insert({"doctype": "Account", "account_name": "_Test Tax Assets",
|
||||||
"parent_account": "Current Assets - %s" % abbr, "company": company,
|
"parent_account": "Current Assets - %s" % abbr, "company": company,
|
||||||
"group_or_ledger": "Group"})
|
"group_or_ledger": "Group"})
|
||||||
webnotes.insert({"doctype": "Account", "account_name": "VAT - Test",
|
webnotes.insert({"doctype": "Account", "account_name": "VAT - Test",
|
||||||
"parent_account": "Tax Assets - %s" % abbr, "company": company,
|
"parent_account": "_Test Tax Assets - %s" % abbr, "company": company,
|
||||||
"group_or_ledger": "Ledger"})
|
"group_or_ledger": "Ledger"})
|
||||||
|
|
||||||
# create BOM
|
# create BOM
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"creation": "2013-01-28 10:06:02",
|
"creation": "2013-01-30 12:49:56",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-01-29 16:28:06",
|
"modified": "2013-02-07 10:50:00",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
|
@ -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"
|
||||||
|
}]
|
||||||
|
]
|
@ -148,7 +148,7 @@ def get_valid_serial_nos(sr_nos, qty=0, item_code=''):
|
|||||||
|
|
||||||
return valid_serial_nos
|
return valid_serial_nos
|
||||||
|
|
||||||
def get_warehouse_list(doctype, txt, searchfield, start, page_len):
|
def get_warehouse_list(doctype, txt, searchfield, start, page_len, args):
|
||||||
"""used in search queries"""
|
"""used in search queries"""
|
||||||
wlist = []
|
wlist = []
|
||||||
for w in webnotes.conn.sql_list("""select name from tabWarehouse
|
for w in webnotes.conn.sql_list("""select name from tabWarehouse
|
||||||
|
Loading…
Reference in New Issue
Block a user