fixed conflict and aii check in global defaults
diff --git a/accounts/doctype/payment_to_invoice_matching_tool/test_payment_to_invoice_matching_tool.py b/accounts/doctype/payment_to_invoice_matching_tool/test_payment_to_invoice_matching_tool.py
index 92c9e78..870147a 100644
--- a/accounts/doctype/payment_to_invoice_matching_tool/test_payment_to_invoice_matching_tool.py
+++ b/accounts/doctype/payment_to_invoice_matching_tool/test_payment_to_invoice_matching_tool.py
@@ -18,169 +18,171 @@
import unittest
import webnotes
-from webnotes.model.doc import Document
-from webnotes.model.code import get_obj
-from webnotes.utils import cstr, flt
-sql = webnotes.conn.sql
+test_records = []
-class TestInternalReco(unittest.TestCase):
- def setUp(self):
- webnotes.conn.begin()
-
- comp1.save(1)
- cust1.save(1)
- bank1.save(1)
- rv1.save(1)
- rv_gle.save(1)
-
-
- for t in jv1: t.save(1)
- for t in jv1[1:]:
- sql("update `tabJournal Voucher Detail` set parent = '%s' where name = '%s'" % (jv1[0].name, t.name))
-
- ir[0].save()
- for t in ir[1:]:
- t.save(1)
- sql("update `tabPayment to Invoice Matching Tool Detail` set voucher_no = '%s', voucher_detail_no = '%s' where parent = 'Payment to Invoice Matching Tool'" % (jv1[0].name, jv1[1].name))
-
-
- sql("update `tabGL Entry` set voucher_no = %s, against_voucher = %s where voucher_no = 'rv1'", (rv1.name, rv1.name))
- sql("update `tabSingles` set value = %s where doctype = 'Payment to Invoice Matching Tool' and field = 'voucher_no'", rv1.name)
-
-
- self.ir = get_obj('Payment to Invoice Matching Tool', with_children=1)
- self.ir.reconcile()
-
- #===========================
- def test_jv(self):
- """
- Test whether JV has benn properly splitted and against doc has been updated
- """
- amt_against_doc = [[cstr(d[0]), flt(d[1]), flt(d[2])]for d in sql("select against_invoice, debit, credit from `tabJournal Voucher Detail` where parent = %s and account = 'cust1 - c1'", jv1[0].name)]
- self.assertTrue(amt_against_doc == [[rv1.name, 0, 100.0], ['', 0, 400.0]])
-
- #============================
- def test_gl_entry(self):
- """
- Check proper gl entry has been made
- """
- gle = [[cstr(d[0]), flt(d[1])] for d in sql("select against_voucher, sum(credit) - sum(debit) from `tabGL Entry` where voucher_no = %s and account = 'cust1 - c1' and ifnull(is_cancelled, 'No') = 'No' group by against_voucher", jv1[0].name)]
-
- self.assertTrue([rv1.name, 100.0] in gle)
- self.assertTrue(['', 400.0] in gle)
-
- #============================
- def test_outstanding(self):
- """
- Check whether Outstanding amount has been properly updated in RV
- """
- amt = sql("select outstanding_amount from `tabSales Invoice` where name = '%s'" % rv1.name)[0][0]
- self.assertTrue(amt == 0)
-
- #============================
- def tearDown(self):
- webnotes.conn.rollback()
-
-
-
-
-# test data
-#---------------
-rv1 = Document(fielddata={
- 'doctype':'Sales Invoice',
- 'docstatus':1,
- 'debit_to':'cust1 - c1',
- 'grand_total': 100,
- 'outstanding_amount': 100,
- 'name': 'rv1'
- })
-
-jv1 = [Document(fielddata={
- 'doctype':'Journal Voucher',
- 'docstatus':1,
- 'cheque_no': '163567',
- 'docstatus':1,
- 'company': 'comp1',
- 'posting_date' : '2011-05-02',
- 'remark': 'test data',
- 'fiscal_year': '2011-2012',
- 'total_debit': 500,
- 'total_credit': 500
- }),
- Document(fielddata = {
- 'parenttype':'Journal Voucher',
- 'parentfield':'entries',
- 'doctype':'Journal Voucher Detail',
- 'account' : 'cust1 - c1',
- 'credit':500,
- 'debit' : 0,
- 'docstatus':1
- }),
- Document(fielddata = {
- 'parenttype':'Journal Voucher',
- 'parentfield':'entries',
- 'doctype':'Journal Voucher Detail',
- 'account' : 'bank1 - c1',
- 'credit':0,
- 'debit' : 500,
- 'docstatus':1
- })]
-
-ir = [Document(fielddata = {
- 'doctype':'Payment to Invoice Matching Tool',
- 'name' : 'Payment to Invoice Matching Tool',
- 'account':'cust1 - c1',
- 'voucher_type' : 'Sales Invoice',
- 'voucher_no': 'rv1'
- }),
- Document(fielddata = {
- 'parenttype':'Payment to Invoice Matching Tool',
- 'parentfield':'ir_payment_details',
- 'doctype':'Payment to Invoice Matching Tool Detail',
- 'parent': 'Payment to Invoice Matching Tool',
- 'voucher_no': 'jv1',
- 'name' : '123112',
- 'voucher_detail_no' : 'jvd1',
- 'selected' : 1,
- 'amt_due' : 500,
- 'amt_to_be_reconciled':100
- })]
-
-cust1 = Document(fielddata={
- 'doctype':'Account',
- 'docstatus':0,
- 'account_name' : 'cust1',
- 'debit_or_credit': 'Debit',
- 'company' : 'comp1',
- 'lft': 1,
- 'rgt': 2
- })
-
-bank1 = Document(fielddata={
- 'doctype':'Account',
- 'docstatus':0,
- 'account_name' : 'bank1',
- 'debit_or_credit': 'Debit',
- 'company' : 'comp1',
- 'lft': 3,
- 'rgt': 4
- })
-
-comp1 = Document(fielddata={
- 'doctype':'Company',
- 'abbr': 'c1',
- 'company_name' : 'comp1',
- 'name': 'comp1'
- })
-
-rv_gle = Document(fielddata={
- 'doctype':'GL Entry',
- 'account': 'cust1 - c1',
- 'company' : 'comp1',
- 'voucher_no': 'rv1',
- 'against_voucher': 'rv1',
- 'against_voucher_type': 'Sales Invoice',
- 'voucher_type' : 'Sales Invoice',
- 'debit': 100,
- 'credit': 0
- })
+# from webnotes.model.doc import Document
+# from webnotes.model.code import get_obj
+# from webnotes.utils import cstr, flt
+# sql = webnotes.conn.sql
+#
+# class TestInternalReco(unittest.TestCase):
+# def setUp(self):
+# webnotes.conn.begin()
+#
+# comp1.save(1)
+# cust1.save(1)
+# bank1.save(1)
+# rv1.save(1)
+# rv_gle.save(1)
+#
+#
+# for t in jv1: t.save(1)
+# for t in jv1[1:]:
+# sql("update `tabJournal Voucher Detail` set parent = '%s' where name = '%s'" % (jv1[0].name, t.name))
+#
+# ir[0].save()
+# for t in ir[1:]:
+# t.save(1)
+# sql("update `tabPayment to Invoice Matching Tool Detail` set voucher_no = '%s', voucher_detail_no = '%s' where parent = 'Payment to Invoice Matching Tool'" % (jv1[0].name, jv1[1].name))
+#
+#
+# sql("update `tabGL Entry` set voucher_no = %s, against_voucher = %s where voucher_no = 'rv1'", (rv1.name, rv1.name))
+# sql("update `tabSingles` set value = %s where doctype = 'Payment to Invoice Matching Tool' and field = 'voucher_no'", rv1.name)
+#
+#
+# self.ir = get_obj('Payment to Invoice Matching Tool', with_children=1)
+# self.ir.reconcile()
+#
+# #===========================
+# def test_jv(self):
+# """
+# Test whether JV has benn properly splitted and against doc has been updated
+# """
+# amt_against_doc = [[cstr(d[0]), flt(d[1]), flt(d[2])]for d in sql("select against_invoice, debit, credit from `tabJournal Voucher Detail` where parent = %s and account = 'cust1 - c1'", jv1[0].name)]
+# self.assertTrue(amt_against_doc == [[rv1.name, 0, 100.0], ['', 0, 400.0]])
+#
+# #============================
+# def test_gl_entry(self):
+# """
+# Check proper gl entry has been made
+# """
+# gle = [[cstr(d[0]), flt(d[1])] for d in sql("select against_voucher, sum(credit) - sum(debit) from `tabGL Entry` where voucher_no = %s and account = 'cust1 - c1' and ifnull(is_cancelled, 'No') = 'No' group by against_voucher", jv1[0].name)]
+#
+# self.assertTrue([rv1.name, 100.0] in gle)
+# self.assertTrue(['', 400.0] in gle)
+#
+# #============================
+# def test_outstanding(self):
+# """
+# Check whether Outstanding amount has been properly updated in RV
+# """
+# amt = sql("select outstanding_amount from `tabSales Invoice` where name = '%s'" % rv1.name)[0][0]
+# self.assertTrue(amt == 0)
+#
+# #============================
+# def tearDown(self):
+# webnotes.conn.rollback()
+#
+#
+#
+#
+# # test data
+# #---------------
+# rv1 = Document(fielddata={
+# 'doctype':'Sales Invoice',
+# 'docstatus':1,
+# 'debit_to':'cust1 - c1',
+# 'grand_total': 100,
+# 'outstanding_amount': 100,
+# 'name': 'rv1'
+# })
+#
+# jv1 = [Document(fielddata={
+# 'doctype':'Journal Voucher',
+# 'docstatus':1,
+# 'cheque_no': '163567',
+# 'docstatus':1,
+# 'company': 'comp1',
+# 'posting_date' : '2011-05-02',
+# 'remark': 'test data',
+# 'fiscal_year': '2011-2012',
+# 'total_debit': 500,
+# 'total_credit': 500
+# }),
+# Document(fielddata = {
+# 'parenttype':'Journal Voucher',
+# 'parentfield':'entries',
+# 'doctype':'Journal Voucher Detail',
+# 'account' : 'cust1 - c1',
+# 'credit':500,
+# 'debit' : 0,
+# 'docstatus':1
+# }),
+# Document(fielddata = {
+# 'parenttype':'Journal Voucher',
+# 'parentfield':'entries',
+# 'doctype':'Journal Voucher Detail',
+# 'account' : 'bank1 - c1',
+# 'credit':0,
+# 'debit' : 500,
+# 'docstatus':1
+# })]
+#
+# ir = [Document(fielddata = {
+# 'doctype':'Payment to Invoice Matching Tool',
+# 'name' : 'Payment to Invoice Matching Tool',
+# 'account':'cust1 - c1',
+# 'voucher_type' : 'Sales Invoice',
+# 'voucher_no': 'rv1'
+# }),
+# Document(fielddata = {
+# 'parenttype':'Payment to Invoice Matching Tool',
+# 'parentfield':'ir_payment_details',
+# 'doctype':'Payment to Invoice Matching Tool Detail',
+# 'parent': 'Payment to Invoice Matching Tool',
+# 'voucher_no': 'jv1',
+# 'name' : '123112',
+# 'voucher_detail_no' : 'jvd1',
+# 'selected' : 1,
+# 'amt_due' : 500,
+# 'amt_to_be_reconciled':100
+# })]
+#
+# cust1 = Document(fielddata={
+# 'doctype':'Account',
+# 'docstatus':0,
+# 'account_name' : 'cust1',
+# 'debit_or_credit': 'Debit',
+# 'company' : 'comp1',
+# 'lft': 1,
+# 'rgt': 2
+# })
+#
+# bank1 = Document(fielddata={
+# 'doctype':'Account',
+# 'docstatus':0,
+# 'account_name' : 'bank1',
+# 'debit_or_credit': 'Debit',
+# 'company' : 'comp1',
+# 'lft': 3,
+# 'rgt': 4
+# })
+#
+# comp1 = Document(fielddata={
+# 'doctype':'Company',
+# 'abbr': 'c1',
+# 'company_name' : 'comp1',
+# 'name': 'comp1'
+# })
+#
+# rv_gle = Document(fielddata={
+# 'doctype':'GL Entry',
+# 'account': 'cust1 - c1',
+# 'company' : 'comp1',
+# 'voucher_no': 'rv1',
+# 'against_voucher': 'rv1',
+# 'against_voucher_type': 'Sales Invoice',
+# 'voucher_type' : 'Sales Invoice',
+# 'debit': 100,
+# 'credit': 0
+# })
diff --git a/accounts/doctype/pos_setting/test_pos_setting.py b/accounts/doctype/pos_setting/test_pos_setting.py
index 2c45c4d..2373f85 100644
--- a/accounts/doctype/pos_setting/test_pos_setting.py
+++ b/accounts/doctype/pos_setting/test_pos_setting.py
@@ -7,8 +7,10 @@
"price_list_name": "_Test Price List",
"company": "_Test Company",
"warehouse": "_Test Warehouse",
+ "territory": "_Test Territory",
"cash_bank_account": "_Test Account Bank Account - _TC",
"income_account": "Sales - _TC",
"cost_center": "_Test Cost Center - _TC",
+ "expense_account": "_Test Account Cost for Goods Sold - _TC",
}]
]
\ No newline at end of file
diff --git a/accounts/doctype/sales_invoice/test_sales_invoice.py b/accounts/doctype/sales_invoice/test_sales_invoice.py
index 7aa0c27..fd8dc64 100644
--- a/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -217,21 +217,11 @@
return dn
def _insert_pos_settings(self):
+ from accounts.doctype.pos_setting.test_pos_setting \
+ import test_records as pos_setting_test_records
webnotes.conn.sql("""delete from `tabPOS Setting`""")
- ps = webnotes.bean([
- {
- "cash_bank_account": "_Test Account Bank Account - _TC",
- "company": "_Test Company",
- "conversion_rate": 1.0,
- "cost_center": "_Test Cost Center - _TC",
- "currency": "INR",
- "doctype": "POS Setting",
- "income_account": "_Test Account Bank Account - _TC",
- "price_list_name": "_Test Price List",
- "territory": "_Test Territory",
- "warehouse": "_Test Warehouse"
- }
- ])
+
+ ps = webnotes.bean(copy=pos_setting_test_records[0])
ps.insert()
def test_sales_invoice_with_advance(self):
diff --git a/accounts/doctype/sales_invoice_item/sales_invoice_item.txt b/accounts/doctype/sales_invoice_item/sales_invoice_item.txt
index ca5fae4..dee0e85 100644
--- a/accounts/doctype/sales_invoice_item/sales_invoice_item.txt
+++ b/accounts/doctype/sales_invoice_item/sales_invoice_item.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-03-25 15:35:04",
+ "creation": "2013-03-26 11:03:08",
"docstatus": 0,
- "modified": "2013-03-25 15:35:23",
+ "modified": "2013-03-28 15:42:14",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -210,7 +210,7 @@
"doctype": "DocField",
"fieldname": "expense_account",
"fieldtype": "Link",
- "hidden": 1,
+ "hidden": 0,
"in_filter": 1,
"label": "Expense Account",
"options": "Account",
diff --git a/accounts/report/gross_profit/gross_profit.py b/accounts/report/gross_profit/gross_profit.py
index 5c06637..7f6354b 100644
--- a/accounts/report/gross_profit/gross_profit.py
+++ b/accounts/report/gross_profit/gross_profit.py
@@ -12,7 +12,7 @@
item_sales_bom = get_item_sales_bom()
- columns = ["Delivery Note/Sales Invoice::120", "Posting Date:Date", "Posting Time",
+ columns = ["Delivery Note/Sales Invoice::120", "Link::30", "Posting Date:Date", "Posting Time",
"Item Code:Link/Item", "Item Name", "Description", "Warehouse:Link/Warehouse",
"Qty:Float", "Selling Rate:Currency", "Selling Amount:Currency", "Buying Amount:Currency",
"Gross Profit:Currency", "Gross Profit %:Percent", "Project:Link/Project"]
@@ -32,8 +32,9 @@
else:
gross_profit = gross_profit_percent = 0.0
- name = """<a href="%s">%s</a>""" % ("/".join(["#Form", row.parenttype, row.name]), row.name)
- data.append([name, row.posting_date, row.posting_time, row.item_code, row.item_name,
+ icon = """<a href="%s"><i class="icon icon-share" style="cursor: pointer;"></i></a>""" \
+ % ("/".join(["#Form", row.parenttype, row.name]),)
+ data.append([row.name, icon, row.posting_date, row.posting_time, row.item_code, row.item_name,
row.description, row.warehouse, row.qty, row.basic_rate, row.amount, buying_amount,
gross_profit, gross_profit_percent, row.project])
@@ -57,7 +58,7 @@
item_sales_bom = {}
for d in webnotes.conn.sql("""select parenttype, parent, parent_item,
- item_code, warehouse, -1*qty as total_qty
+ item_code, warehouse, -1*qty as total_qty, parent_detail_docname
from `tabDelivery Note Packing Item` where docstatus=1""", as_dict=True):
item_sales_bom.setdefault(d.parenttype, webnotes._dict()).setdefault(d.parent,
webnotes._dict()).setdefault(d.parent_item, []).append(d)
diff --git a/accounts/utils.py b/accounts/utils.py
index 92173ab..d6b2043 100644
--- a/accounts/utils.py
+++ b/accounts/utils.py
@@ -294,18 +294,18 @@
jv.submit()
def get_stock_rbnb_value(company):
- total_received_amount = webnotes.conn.sql("""select sum(valuation_amount)
+ total_received_amount = webnotes.conn.sql("""select sum(valuation_rate*qty)
from `tabPurchase Receipt Item` pr_item where docstatus=1
and exists(select name from `tabItem` where name = pr_item.item_code
and is_stock_item='Yes')
- and exist(select name from `tabPurchase Receipt`
+ and exists(select name from `tabPurchase Receipt`
where name = pr_item.parent and company = %s)""", company)
- total_billed_amount = webnotes.conn.sql("""select sum(valuation_amount)
+ total_billed_amount = webnotes.conn.sql("""select sum(valuation_rate*qty)
from `tabPurchase Invoice Item` pi_item where docstatus=1
and exists(select name from `tabItem` where name = pi_item.item_code
and is_stock_item='Yes')
- and exist(select name from `tabPurchase Invoice`
+ and exists(select name from `tabPurchase Invoice`
where name = pi_item.parent and company = %s)""", company)
return flt(total_received_amount[0][0]) - flt(total_billed_amount[0][0])
diff --git a/hr/doctype/department/test_department.py b/hr/doctype/department/test_department.py
index 4012583..a5ac6c7 100644
--- a/hr/doctype/department/test_department.py
+++ b/hr/doctype/department/test_department.py
@@ -1,3 +1,5 @@
+test_ignore = ["Leave Block List"]
+
test_records = [
[{"doctype":"Department", "department_name":"_Test Department"}],
[{"doctype":"Department", "department_name":"_Test Department 1"}]
diff --git a/hr/doctype/leave_application/test_leave_application.py b/hr/doctype/leave_application/test_leave_application.py
index bc4a38c..672e668 100644
--- a/hr/doctype/leave_application/test_leave_application.py
+++ b/hr/doctype/leave_application/test_leave_application.py
@@ -29,7 +29,7 @@
application = self.get_application(test_records[1])
self.assertTrue(application.insert())
-
+
def test_overlap(self):
application = self.get_application(test_records[1])
self.assertRaises(OverlapError, application.insert)
@@ -57,6 +57,7 @@
application.doc.status = "Approved"
self.assertRaises(LeaveDayBlockedError, application.submit)
+test_dependencies = ["Leave Block List"]
test_records = [
[{
diff --git a/hr/doctype/salary_manager/test_salary_manager.py b/hr/doctype/salary_manager/test_salary_manager.py
index b689b51..eb990f8 100644
--- a/hr/doctype/salary_manager/test_salary_manager.py
+++ b/hr/doctype/salary_manager/test_salary_manager.py
@@ -18,199 +18,201 @@
import unittest
import webnotes
-from webnotes.model.doc import Document
-from webnotes.model.code import get_obj
-sql = webnotes.conn.sql
+test_records = []
-class TestSalaryManager(unittest.TestCase):
- def setUp(self):
- webnotes.conn.begin()
- for rec in [des1, dep1, branch1, grade1, comp1, emp1, emp2]:
- rec.save(1)
-
- ss1[0].employee = emp1.name
- for s in ss1: s.save(1)
- for s in ss1[1:]:
- sql("update `tabSalary Structure Earning` set parent = '%s' where name = '%s'" % (ss1[0].name, s.name))
- sql("update `tabSalary Structure Deduction` set parent = '%s' where name = '%s'" % (ss1[0].name, s.name))
-
-
- ss2[0].employee = emp2.name
- for s in ss2: s.save(1)
- for s in ss2[1:]:
- sql("update `tabSalary Structure Earning` set parent = '%s' where name = '%s'" % (ss2[0].name, s.name))
- sql("update `tabSalary Structure Deduction` set parent = '%s' where name = '%s'" % (ss2[0].name, s.name))
-
- sman.save()
- self.sm = get_obj('Salary Manager')
- leave.save(1)
- self.sm.create_sal_slip()
-
- def test_creation(self):
- ssid = sql("""
- select name, department
- from `tabSalary Slip`
- where month = '08' and fiscal_year='2011-2012'""")
-
- self.assertTrue(len(ssid)==1)
- self.assertTrue(ssid[0][1] == 'dep1')
-
-
- def test_lwp_calc(self):
- ss = sql("""
- select payment_days
- from `tabSalary Slip`
- where month = '08' and fiscal_year='2011-2012' and employee = '%s'
- """ % emp1.name)
-
- self.assertTrue(ss[0][0]==27)
-
- def test_net_pay(self):
- ss = webnotes.conn.sql("""
- select rounded_total
- from `tabSalary Slip`
- where month = '08'
- and fiscal_year='2011-2012' and employee = '%s'""" % emp1.name)
- self.assertTrue(ss[0][0]==67)
-
- def test_submit(self):
- self.sm.submit_salary_slip()
- ss = webnotes.conn.sql("""
- select docstatus
- from `tabSalary Slip`
- where month = '08'
- and fiscal_year='2011-2012' and employee = '%s'""" % emp1.name)
- self.assertTrue(ss[0][0]==1)
-
- def tearDown(self):
- webnotes.conn.rollback()
-
-#--------------------------------------------
-# test data
-#--------------------------------------------
-des1 = Document(fielddata={
- 'name':'des1',
- 'doctype':'Designation',
- 'designation_name':'des1'
-})
-
-dep1 = Document(fielddata={
- 'name':'dep1',
- 'doctype':'Department',
- 'department_name' : 'dep1'
-})
-
-branch1 = Document(fielddata={
- 'name':'branch1',
- 'doctype':'Branch',
- 'branch' : 'branch1'
-})
-
-comp1 = Document(fielddata={
- 'name':'comp1',
- 'doctype':'Company',
- 'abbr':'c1',
- 'company_name' : 'comp1'
-})
-
-grade1 = Document(fielddata={
- 'name':'grade1',
- 'doctype':'Grade',
- 'grade_name' : 'grade1'
-})
-
-emp1 = Document(fielddata={
- 'doctype':'Employee',
- 'employee_number':'emp1',
- 'department':'dep1',
- 'designation':'des1',
- 'branch' : 'branch1',
- 'company':'comp1',
- 'grade':'grade1',
- 'naming_series':'EMP/',
- 'status':'Active',
- 'docstatus':0,
- 'employee_name':'emp1'
-})
-
-emp2 = Document(fielddata={
- 'doctype':'Employee',
- 'employee_number':'emp2',
- 'department':'dep1',
- 'designation':'des2',
- 'branch' : 'branch1',
- 'company':'comp1',
- 'naming_series':'EMP/',
- 'grade':'grade1',
- 'status':'Active',
-
-})
-
-ss1 = [
- Document(fielddata={
- 'doctype':'Salary Structure',
- 'docstatus':0,
- 'employee':'emp1',
- 'is_active':'Yes',
- 'department': 'dep1',
- 'designation' : 'des1',
- 'employee_name': 'emp1'
- }),
- Document(fielddata={
- 'parenttype':'Salary Structure',
- 'parentfield':'earning_details',
- 'doctype':'Salary Structure Earning',
- 'e_type' : 'Basic',
- 'depend_on_lwp':1,
- 'modified_value':100
- }),
- Document(fielddata={
- 'parenttype':'Salary Structure',
- 'parentfield':'earning_details',
- 'doctype':'Salary Structure Deduction',
- 'd_type':'TDS',
- 'd_modified_amt':20
- })
-]
-
-ss2 = [
- Document(fielddata={
- 'doctype':'Salary Structure',
- 'is_active':'Yes',
- 'docstatus':0,
- }),
- Document(fielddata={
- 'parenttype':'Salary Structure',
- 'parentfield':'deduction_details',
- 'doctype':'Salary Structure Earning',
- 'e_type' : 'Basic',
- 'modified_value':100
- }),
- Document(fielddata={
- 'parenttype':'Salary Structure',
- 'parentfield':'deduction_details',
- 'doctype':'Salary Structure Deduction',
- 'd_type':'TDS',
- 'd_modified_amt':20
- })
-]
-
-sman = Document(fielddata={
- 'name':'Salary Manager',
- 'doctype':'Salary Manager',
- 'company': 'comp1',
- 'department':'dep1',
- 'designation':'des1',
- 'month': '08',
- 'fiscal_year':'2011-2012'
- })
-
-leave = Document(fielddata = {
- 'doctype':'Leave Application',
- 'employee':'emp1',
- 'from_date':'2011-08-12',
- 'to_date':'2011-08-15',
- 'total_leave_days':'4',
- 'leave_type':'Leave Without Pay',
- 'docstatus':1
- })
+# from webnotes.model.doc import Document
+# from webnotes.model.code import get_obj
+# sql = webnotes.conn.sql
+#
+# class TestSalaryManager(unittest.TestCase):
+# def setUp(self):
+# webnotes.conn.begin()
+# for rec in [des1, dep1, branch1, grade1, comp1, emp1, emp2]:
+# rec.save(1)
+#
+# ss1[0].employee = emp1.name
+# for s in ss1: s.save(1)
+# for s in ss1[1:]:
+# sql("update `tabSalary Structure Earning` set parent = '%s' where name = '%s'" % (ss1[0].name, s.name))
+# sql("update `tabSalary Structure Deduction` set parent = '%s' where name = '%s'" % (ss1[0].name, s.name))
+#
+#
+# ss2[0].employee = emp2.name
+# for s in ss2: s.save(1)
+# for s in ss2[1:]:
+# sql("update `tabSalary Structure Earning` set parent = '%s' where name = '%s'" % (ss2[0].name, s.name))
+# sql("update `tabSalary Structure Deduction` set parent = '%s' where name = '%s'" % (ss2[0].name, s.name))
+#
+# sman.save()
+# self.sm = get_obj('Salary Manager')
+# leave.save(1)
+# self.sm.create_sal_slip()
+#
+# def test_creation(self):
+# ssid = sql("""
+# select name, department
+# from `tabSalary Slip`
+# where month = '08' and fiscal_year='2011-2012'""")
+#
+# self.assertTrue(len(ssid)==1)
+# self.assertTrue(ssid[0][1] == 'dep1')
+#
+#
+# def test_lwp_calc(self):
+# ss = sql("""
+# select payment_days
+# from `tabSalary Slip`
+# where month = '08' and fiscal_year='2011-2012' and employee = '%s'
+# """ % emp1.name)
+#
+# self.assertTrue(ss[0][0]==27)
+#
+# def test_net_pay(self):
+# ss = webnotes.conn.sql("""
+# select rounded_total
+# from `tabSalary Slip`
+# where month = '08'
+# and fiscal_year='2011-2012' and employee = '%s'""" % emp1.name)
+# self.assertTrue(ss[0][0]==67)
+#
+# def test_submit(self):
+# self.sm.submit_salary_slip()
+# ss = webnotes.conn.sql("""
+# select docstatus
+# from `tabSalary Slip`
+# where month = '08'
+# and fiscal_year='2011-2012' and employee = '%s'""" % emp1.name)
+# self.assertTrue(ss[0][0]==1)
+#
+# def tearDown(self):
+# webnotes.conn.rollback()
+#
+# #--------------------------------------------
+# # test data
+# #--------------------------------------------
+# des1 = Document(fielddata={
+# 'name':'des1',
+# 'doctype':'Designation',
+# 'designation_name':'des1'
+# })
+#
+# dep1 = Document(fielddata={
+# 'name':'dep1',
+# 'doctype':'Department',
+# 'department_name' : 'dep1'
+# })
+#
+# branch1 = Document(fielddata={
+# 'name':'branch1',
+# 'doctype':'Branch',
+# 'branch' : 'branch1'
+# })
+#
+# comp1 = Document(fielddata={
+# 'name':'comp1',
+# 'doctype':'Company',
+# 'abbr':'c1',
+# 'company_name' : 'comp1'
+# })
+#
+# grade1 = Document(fielddata={
+# 'name':'grade1',
+# 'doctype':'Grade',
+# 'grade_name' : 'grade1'
+# })
+#
+# emp1 = Document(fielddata={
+# 'doctype':'Employee',
+# 'employee_number':'emp1',
+# 'department':'dep1',
+# 'designation':'des1',
+# 'branch' : 'branch1',
+# 'company':'comp1',
+# 'grade':'grade1',
+# 'naming_series':'EMP/',
+# 'status':'Active',
+# 'docstatus':0,
+# 'employee_name':'emp1'
+# })
+#
+# emp2 = Document(fielddata={
+# 'doctype':'Employee',
+# 'employee_number':'emp2',
+# 'department':'dep1',
+# 'designation':'des2',
+# 'branch' : 'branch1',
+# 'company':'comp1',
+# 'naming_series':'EMP/',
+# 'grade':'grade1',
+# 'status':'Active',
+#
+# })
+#
+# ss1 = [
+# Document(fielddata={
+# 'doctype':'Salary Structure',
+# 'docstatus':0,
+# 'employee':'emp1',
+# 'is_active':'Yes',
+# 'department': 'dep1',
+# 'designation' : 'des1',
+# 'employee_name': 'emp1'
+# }),
+# Document(fielddata={
+# 'parenttype':'Salary Structure',
+# 'parentfield':'earning_details',
+# 'doctype':'Salary Structure Earning',
+# 'e_type' : 'Basic',
+# 'depend_on_lwp':1,
+# 'modified_value':100
+# }),
+# Document(fielddata={
+# 'parenttype':'Salary Structure',
+# 'parentfield':'earning_details',
+# 'doctype':'Salary Structure Deduction',
+# 'd_type':'TDS',
+# 'd_modified_amt':20
+# })
+# ]
+#
+# ss2 = [
+# Document(fielddata={
+# 'doctype':'Salary Structure',
+# 'is_active':'Yes',
+# 'docstatus':0,
+# }),
+# Document(fielddata={
+# 'parenttype':'Salary Structure',
+# 'parentfield':'deduction_details',
+# 'doctype':'Salary Structure Earning',
+# 'e_type' : 'Basic',
+# 'modified_value':100
+# }),
+# Document(fielddata={
+# 'parenttype':'Salary Structure',
+# 'parentfield':'deduction_details',
+# 'doctype':'Salary Structure Deduction',
+# 'd_type':'TDS',
+# 'd_modified_amt':20
+# })
+# ]
+#
+# sman = Document(fielddata={
+# 'name':'Salary Manager',
+# 'doctype':'Salary Manager',
+# 'company': 'comp1',
+# 'department':'dep1',
+# 'designation':'des1',
+# 'month': '08',
+# 'fiscal_year':'2011-2012'
+# })
+#
+# leave = Document(fielddata = {
+# 'doctype':'Leave Application',
+# 'employee':'emp1',
+# 'from_date':'2011-08-12',
+# 'to_date':'2011-08-15',
+# 'total_leave_days':'4',
+# 'leave_type':'Leave Without Pay',
+# 'docstatus':1
+# })
diff --git a/patches/february_2013/p03_material_request.py b/patches/february_2013/p03_material_request.py
index 612c108..66b2bf6 100644
--- a/patches/february_2013/p03_material_request.py
+++ b/patches/february_2013/p03_material_request.py
@@ -3,8 +3,11 @@
def execute():
webnotes.reload_doc("core", "doctype", "doctype")
- webnotes.rename_doc("DocType", "Purchase Request Item", "Material Request Item", force=True)
- webnotes.rename_doc("DocType", "Purchase Request", "Material Request", force=True)
+ tables = webnotes.conn.sql_list("show tables")
+ if not "tabMaterial Request Item" in tables:
+ webnotes.rename_doc("DocType", "Purchase Request Item", "Material Request Item", force=True)
+ if not "tabMaterial Request" in tables:
+ webnotes.rename_doc("DocType", "Purchase Request", "Material Request", force=True)
webnotes.reload_doc("buying", "search_criteria", "pending_po_items_to_bill")
webnotes.reload_doc("buying", "search_criteria", "pending_po_items_to_receive")
@@ -19,4 +22,4 @@
os.system("rm -rf app/hr/doctype/holiday_block_list")
os.system("rm -rf app/hr/doctype/holiday_block_list_allow")
os.system("rm -rf app/hr/doctype/holiday_block_list_date")
-
\ No newline at end of file
+
diff --git a/patches/march_2013/p10_set_fiscal_year_for_stock.py b/patches/march_2013/p10_set_fiscal_year_for_stock.py
new file mode 100644
index 0000000..c9d5202
--- /dev/null
+++ b/patches/march_2013/p10_set_fiscal_year_for_stock.py
@@ -0,0 +1,18 @@
+import webnotes
+from accounts.utils import get_fiscal_year, FiscalYearError
+
+def execute():
+ webnotes.reload_doc("stock", "doctype", "stock_entry")
+ webnotes.reload_doc("stock", "doctype", "stock_reconciliation")
+
+ for doctype in ["Stock Entry", "Stock Reconciliation"]:
+ for name, posting_date in webnotes.conn.sql("""select name, posting_date from `tab%s`
+ where ifnull(fiscal_year,'')='' and docstatus=1""" % doctype):
+ try:
+ fiscal_year = get_fiscal_year(posting_date, 0)[0]
+ webnotes.conn.sql("""update `tab%s` set fiscal_year=%s where name=%s""" % \
+ (doctype, "%s", "%s"), (fiscal_year, name))
+ except FiscalYearError:
+ pass
+
+
\ No newline at end of file
diff --git a/patches/patch_list.py b/patches/patch_list.py
index 5eff170..0c9662e 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -216,8 +216,13 @@
"patches.march_2013.p06_remove_sales_purchase_return_tool",
"execute:webnotes.bean('Global Defaults').save()",
"patches.march_2013.p07_update_project_in_stock_ledger",
+ "execute:webnotes.reload_doc('stock', 'doctype', 'item') #2013-03-25",
+ "execute:webnotes.reload_doc('setup', 'doctype', 'item_group') #2013-03-25",
+ "execute:webnotes.reload_doc('website', 'doctype', 'blog_post') #2013-03-25",
+ "execute:webnotes.reload_doc('website', 'doctype', 'web_page') #2013-03-25",
"execute:webnotes.bean('Style Settings').save() #2013-03-25",
"execute:webnotes.conn.set_value('Email Settings', None, 'send_print_in_body_and_attachment', 1)",
"patches.march_2013.p09_unset_user_type_partner",
+ "patches.march_2013.p10_set_fiscal_year_for_stock",
"patches.march_2013.p10_update_against_expense_account",
]
\ No newline at end of file
diff --git a/projects/doctype/activity_type/activity_type.txt b/projects/doctype/activity_type/activity_type.txt
index 028db2b..9866500 100644
--- a/projects/doctype/activity_type/activity_type.txt
+++ b/projects/doctype/activity_type/activity_type.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-03-05 12:53:23",
+ "creation": "2013-03-05 10:14:59",
"docstatus": 0,
- "modified": "2013-03-05 12:54:22",
+ "modified": "2013-03-28 07:18:24",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -10,7 +10,7 @@
"autoname": "field:activity_type",
"doctype": "DocType",
"document_type": "Master",
- "in_dialog": 1,
+ "in_dialog": 0,
"module": "Projects",
"name": "__common__"
},
diff --git a/projects/doctype/time_log/test_time_log.py b/projects/doctype/time_log/test_time_log.py
index 1168c01..8f1848f 100644
--- a/projects/doctype/time_log/test_time_log.py
+++ b/projects/doctype/time_log/test_time_log.py
@@ -9,6 +9,7 @@
self.assertRaises(OverlapError, ts.insert)
test_records = [[{
+ "doctype": "Time Log",
"from_time": "2013-01-01 10:00:00",
"to_time": "2013-01-01 11:00:00",
"activity_type": "_Test Activity Type",
diff --git a/setup/doctype/brand/brand.txt b/setup/doctype/brand/brand.txt
index 2264678..cddd918 100644
--- a/setup/doctype/brand/brand.txt
+++ b/setup/doctype/brand/brand.txt
@@ -1,74 +1,74 @@
[
{
- "owner": "Administrator",
+ "creation": "2013-02-22 01:27:54",
"docstatus": 0,
- "creation": "2012-07-03 13:30:03",
+ "modified": "2013-03-28 07:18:30",
"modified_by": "Administrator",
- "modified": "2012-12-25 13:20:51"
+ "owner": "Administrator"
},
{
- "name": "__common__",
"autoname": "field:brand",
- "module": "Setup",
"doctype": "DocType",
- "in_dialog": 1,
- "document_type": "Master"
+ "document_type": "Master",
+ "in_dialog": 0,
+ "module": "Setup",
+ "name": "__common__"
},
{
- "read_only": 0,
+ "doctype": "DocField",
"name": "__common__",
"parent": "Brand",
- "doctype": "DocField",
+ "parentfield": "fields",
"parenttype": "DocType",
"permlevel": 0,
- "parentfield": "fields"
+ "read_only": 0
},
{
- "name": "__common__",
- "parent": "Brand",
- "read": 1,
"doctype": "DocPerm",
+ "name": "__common__",
+ "parent": "Brand",
+ "parentfield": "permissions",
"parenttype": "DocType",
- "report": 1,
"permlevel": 0,
- "parentfield": "permissions"
+ "read": 1,
+ "report": 1
},
{
- "name": "Brand",
- "doctype": "DocType"
+ "doctype": "DocType",
+ "name": "Brand"
},
{
- "oldfieldtype": "Data",
"doctype": "DocField",
- "label": "Brand Name",
- "oldfieldname": "brand",
"fieldname": "brand",
"fieldtype": "Data",
+ "label": "Brand Name",
+ "oldfieldname": "brand",
+ "oldfieldtype": "Data",
"reqd": 1
},
{
- "oldfieldtype": "Text",
"doctype": "DocField",
+ "fieldname": "description",
+ "fieldtype": "Text",
"label": "Description",
"oldfieldname": "description",
- "width": "300px",
- "fieldname": "description",
- "fieldtype": "Text"
+ "oldfieldtype": "Text",
+ "width": "300px"
},
{
+ "cancel": 1,
"create": 1,
"doctype": "DocPerm",
- "write": 1,
"role": "Material Master Manager",
- "cancel": 1
+ "write": 1
},
{
"amend": 0,
+ "cancel": 0,
"create": 0,
"doctype": "DocPerm",
- "submit": 0,
- "write": 0,
"role": "Material User",
- "cancel": 0
+ "submit": 0,
+ "write": 0
}
]
\ No newline at end of file
diff --git a/setup/doctype/global_defaults/global_defaults.py b/setup/doctype/global_defaults/global_defaults.py
index 4b6707f..3f8de1d 100644
--- a/setup/doctype/global_defaults/global_defaults.py
+++ b/setup/doctype/global_defaults/global_defaults.py
@@ -45,7 +45,7 @@
'session_expiry': 'session_expiry',
'disable_rounded_total': 'disable_rounded_total',
"update_stock": "update_stock",
- # "auto_inventory_accounting": "auto_inventory_accounting",
+ "auto_inventory_accounting": "auto_inventory_accounting",
}
class DocType:
diff --git a/setup/doctype/global_defaults/global_defaults.txt b/setup/doctype/global_defaults/global_defaults.txt
index ac1671e..7f81618 100644
--- a/setup/doctype/global_defaults/global_defaults.txt
+++ b/setup/doctype/global_defaults/global_defaults.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-02-21 12:28:24",
+ "creation": "2013-03-25 11:08:14",
"docstatus": 0,
- "modified": "2013-03-21 15:42:59",
+ "modified": "2013-03-28 15:41:03",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -27,6 +27,8 @@
"permlevel": 0
},
{
+ "amend": 0,
+ "cancel": 0,
"create": 1,
"doctype": "DocPerm",
"name": "__common__",
@@ -48,19 +50,22 @@
"doctype": "DocField",
"fieldname": "general",
"fieldtype": "Section Break",
- "label": "General"
+ "label": "General",
+ "read_only": 0
},
{
"description": "Session Expiry in Hours e.g. 06:00",
"doctype": "DocField",
"fieldname": "session_expiry",
"fieldtype": "Data",
- "label": "Session Expiry"
+ "label": "Session Expiry",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "column_break_3",
- "fieldtype": "Column Break"
+ "fieldtype": "Column Break",
+ "read_only": 0
},
{
"description": "For Server Side Print Formats",
@@ -68,13 +73,15 @@
"fieldname": "print_style",
"fieldtype": "Select",
"label": "Print Format Style",
- "options": "Standard\nClassic\nModern\nSpartan"
+ "options": "Standard\nClassic\nModern\nSpartan",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "company",
"fieldtype": "Section Break",
- "label": "Company"
+ "label": "Company",
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -82,6 +89,7 @@
"fieldtype": "Link",
"label": "Default Company",
"options": "Company",
+ "read_only": 0,
"reqd": 0
},
{
@@ -90,6 +98,7 @@
"fieldtype": "Link",
"label": "Current Fiscal Year",
"options": "Fiscal Year",
+ "read_only": 0,
"reqd": 1
},
{
@@ -97,12 +106,14 @@
"fieldname": "date_format",
"fieldtype": "Select",
"label": "Date Format",
- "options": "yyyy-mm-dd\ndd-mm-yyyy\ndd/mm/yyyy\nmm/dd/yyyy\nmm-dd-yyyy"
+ "options": "yyyy-mm-dd\ndd-mm-yyyy\ndd/mm/yyyy\nmm/dd/yyyy\nmm-dd-yyyy",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "column_break1",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -111,7 +122,8 @@
"fieldname": "hide_currency_symbol",
"fieldtype": "Select",
"label": "Hide Currency Symbol",
- "options": "\nNo\nYes"
+ "options": "\nNo\nYes",
+ "read_only": 0
},
{
"default": "INR",
@@ -120,6 +132,7 @@
"fieldtype": "Link",
"label": "Default Currency",
"options": "Currency",
+ "read_only": 0,
"reqd": 1
},
{
@@ -128,7 +141,8 @@
"fieldname": "number_format",
"fieldtype": "Select",
"label": "Number Format",
- "options": "\n#,###.##\n#.###,##\n# ###.##\n#,###.###\n#,##,###.##\n#.###\n#,###"
+ "options": "\n#,###.##\n#.###,##\n# ###.##\n#,###.###\n#,##,###.##\n#.###\n#,###",
+ "read_only": 0
},
{
"description": "Precision for Float fields (quantities, discounts, percentages etc) only for display. Floats will still be calculated up to 6 decimals.",
@@ -136,18 +150,21 @@
"fieldname": "float_precision",
"fieldtype": "Select",
"label": "Float Precision",
- "options": "\n2\n3\n4\n5\n6"
+ "options": "\n2\n3\n4\n5\n6",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "stock",
"fieldtype": "Section Break",
- "label": "Stock"
+ "label": "Stock",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "column_break2",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -155,54 +172,62 @@
"fieldname": "default_item_group",
"fieldtype": "Link",
"label": "Default Item Group",
- "options": "Item Group"
+ "options": "Item Group",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "ighelp",
"fieldtype": "HTML",
"label": "IGHelp",
- "options": "<a href=\"#!Sales Browser/Item Group\">To manage Item Groups, click here</a>"
+ "options": "<a href=\"#!Sales Browser/Item Group\">To manage Item Groups, click here</a>",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "default_stock_uom",
"fieldtype": "Link",
"label": "Default Stock UOM",
- "options": "UOM"
+ "options": "UOM",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "default_valuation_method",
"fieldtype": "Select",
"label": "Default Valuation Method",
- "options": "FIFO\nMoving Average"
+ "options": "FIFO\nMoving Average",
+ "read_only": 0
},
{
"description": "Applicable only if valuation method is moving average",
"doctype": "DocField",
"fieldname": "allow_negative_stock",
"fieldtype": "Check",
- "label": "Allow Negative Stock"
+ "label": "Allow Negative Stock",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "default_warehouse_type",
"fieldtype": "Link",
"label": "Default Warehouse Type",
- "options": "Warehouse Type"
+ "options": "Warehouse Type",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "auto_indent",
"fieldtype": "Check",
- "label": "Raise Material Request when stock reaches re-order level"
+ "label": "Raise Material Request when stock reaches re-order level",
+ "read_only": 0
},
{
"default": "1",
"doctype": "DocField",
"fieldname": "column_break3",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -210,14 +235,16 @@
"doctype": "DocField",
"fieldname": "tolerance",
"fieldtype": "Float",
- "label": "Allowance Percent"
+ "label": "Allowance Percent",
+ "read_only": 0
},
{
"description": "Stock level frozen up to this date, nobody can do / modify entry except authorized person",
"doctype": "DocField",
"fieldname": "stock_frozen_upto",
"fieldtype": "Date",
- "label": "Stock Frozen Upto"
+ "label": "Stock Frozen Upto",
+ "read_only": 0
},
{
"description": "Users with this role are allowed to do / modify stock entry before frozen date",
@@ -225,20 +252,32 @@
"fieldname": "stock_auth_role",
"fieldtype": "Link",
"label": "Authorized Role (Frozen Entry)",
- "options": "Role"
+ "options": "Role",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "accounts",
"fieldtype": "Section Break",
- "label": "Accounts"
+ "label": "Accounts",
+ "read_only": 0
+ },
+ {
+ "description": "If enabled, the system will post accounting entries for inventory automatically",
+ "doctype": "DocField",
+ "fieldname": "auto_inventory_accounting",
+ "fieldtype": "Check",
+ "label": "Auto Inventory Accounting",
+ "no_copy": 0,
+ "print_hide": 1
},
{
"description": "Accounting entry frozen up to this date, nobody can do / modify entry except authorized person",
"doctype": "DocField",
"fieldname": "acc_frozen_upto",
"fieldtype": "Date",
- "label": "Accounts Frozen Upto"
+ "label": "Accounts Frozen Upto",
+ "read_only": 0
},
{
"description": "Users with this role are allowed to do / modify accounting entry before frozen date",
@@ -246,39 +285,45 @@
"fieldname": "bde_auth_role",
"fieldtype": "Link",
"label": "Authourized Role (Frozen Entry)",
- "options": "Role"
+ "options": "Role",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "credit_controller",
"fieldtype": "Link",
"label": "Credit Controller",
- "options": "Role"
+ "options": "Role",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "column_break4",
- "fieldtype": "Column Break"
+ "fieldtype": "Column Break",
+ "read_only": 0
},
{
"description": "If checked, then in POS Sales Invoice, Update Stock gets checked by default",
"doctype": "DocField",
"fieldname": "update_stock",
"fieldtype": "Check",
- "label": "Update Stock when using POS Sales Invoice"
+ "label": "Update Stock when using POS Sales Invoice",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "account_info",
"fieldtype": "HTML",
"label": "Account Info",
- "options": "<div class=\"help-box\">For more accounting defaults, Open <a href=\"#!List/Company\">Company</a></div>"
+ "options": "<div class=\"help-box\">For more accounting defaults, Open <a href=\"#!List/Company\">Company</a></div>",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "selling",
"fieldtype": "Section Break",
- "label": "Selling"
+ "label": "Selling",
+ "read_only": 0
},
{
"default": "Customer Name",
@@ -286,40 +331,46 @@
"fieldname": "cust_master_name",
"fieldtype": "Select",
"label": "Customer Master created by ",
- "options": "Customer Name\nNaming Series"
+ "options": "Customer Name\nNaming Series",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "default_customer_group",
"fieldtype": "Link",
"label": "Default Customer Group",
- "options": "Customer Group"
+ "options": "Customer Group",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "cghelp",
"fieldtype": "HTML",
"label": "CGHelp",
- "options": "<a href=\"#!Sales Browser/Customer Group\">To manage Customer Groups, click here</a>"
+ "options": "<a href=\"#!Sales Browser/Customer Group\">To manage Customer Groups, click here</a>",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "default_territory",
"fieldtype": "Link",
"label": "Default Territory",
- "options": "Territory"
+ "options": "Territory",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "territoryhelp",
"fieldtype": "HTML",
"label": "TerritoryHelp",
- "options": "<a href=\"#!Sales Browser/Territory\">To manage Territory, click here</a>"
+ "options": "<a href=\"#!Sales Browser/Territory\">To manage Territory, click here</a>",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "column_break5",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -327,14 +378,16 @@
"fieldname": "default_price_list",
"fieldtype": "Link",
"label": "Default Price List",
- "options": "Price List"
+ "options": "Price List",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "default_price_list_currency",
"fieldtype": "Link",
"label": "Default Price List Currency",
- "options": "Currency"
+ "options": "Currency",
+ "read_only": 0
},
{
"default": "No",
@@ -342,7 +395,8 @@
"fieldname": "so_required",
"fieldtype": "Select",
"label": "Sales Order Required",
- "options": "No\nYes"
+ "options": "No\nYes",
+ "read_only": 0
},
{
"default": "No",
@@ -350,27 +404,31 @@
"fieldname": "dn_required",
"fieldtype": "Select",
"label": "Delivery Note Required",
- "options": "No\nYes"
+ "options": "No\nYes",
+ "read_only": 0
},
{
"description": "If disable, 'Rounded Total' field will not be visible in any transaction",
"doctype": "DocField",
"fieldname": "disable_rounded_total",
"fieldtype": "Check",
- "label": "Disable Rounded Total"
+ "label": "Disable Rounded Total",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "buying",
"fieldtype": "Section Break",
- "label": "Buying"
+ "label": "Buying",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "default_supplier_type",
"fieldtype": "Link",
"label": "Default Supplier Type",
- "options": "Supplier Type"
+ "options": "Supplier Type",
+ "read_only": 0
},
{
"default": "Supplier Name",
@@ -378,12 +436,14 @@
"fieldname": "supp_master_name",
"fieldtype": "Select",
"label": "Supplier Master created by ",
- "options": "Supplier Name\nNaming Series"
+ "options": "Supplier Name\nNaming Series",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "column_break6",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -392,7 +452,8 @@
"fieldname": "po_required",
"fieldtype": "Select",
"label": "Purchase Order Required",
- "options": "No\nYes"
+ "options": "No\nYes",
+ "read_only": 0
},
{
"default": "No",
@@ -400,20 +461,23 @@
"fieldname": "pr_required",
"fieldtype": "Select",
"label": "Purchase Receipt Required",
- "options": "No\nYes"
+ "options": "No\nYes",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "maintain_same_rate",
"fieldtype": "Check",
- "label": "Maintain same rate throughout purchase cycle"
+ "label": "Maintain same rate throughout purchase cycle",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "hr",
"fieldtype": "Section Break",
"label": "HR",
- "options": "<div style=\"padding-top: 8px;\" class=\"columnHeading\">HR</div>"
+ "options": "<div style=\"padding-top: 8px;\" class=\"columnHeading\">HR</div>",
+ "read_only": 0
},
{
"description": "Employee record is created using selected field. ",
@@ -421,24 +485,22 @@
"fieldname": "emp_created_by",
"fieldtype": "Select",
"label": "Employee Records to be created by ",
- "options": "Naming Series\nEmployee Number"
+ "options": "Naming Series\nEmployee Number",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "system",
"fieldtype": "Section Break",
- "label": "System"
+ "label": "System",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "sms_sender_name",
"fieldtype": "Data",
- "label": "SMS Sender Name"
- },
- {
- "amend": 0,
- "cancel": 0,
- "doctype": "DocPerm"
+ "label": "SMS Sender Name",
+ "read_only": 0
},
{
"doctype": "DocPerm"
diff --git a/stock/doctype/delivery_note_item/delivery_note_item.txt b/stock/doctype/delivery_note_item/delivery_note_item.txt
index 1961e6c..fb3dd41 100644
--- a/stock/doctype/delivery_note_item/delivery_note_item.txt
+++ b/stock/doctype/delivery_note_item/delivery_note_item.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-03-25 11:55:16",
+ "creation": "2013-03-26 11:03:09",
"docstatus": 0,
- "modified": "2013-03-25 15:43:04",
+ "modified": "2013-03-28 15:42:41",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -248,7 +248,7 @@
"doctype": "DocField",
"fieldname": "expense_account",
"fieldtype": "Link",
- "hidden": 1,
+ "hidden": 0,
"label": "Expense Account",
"no_copy": 1,
"options": "Account",
@@ -260,11 +260,12 @@
"doctype": "DocField",
"fieldname": "cost_center",
"fieldtype": "Link",
- "hidden": 1,
+ "hidden": 0,
"label": "Cost Center",
"no_copy": 1,
"options": "Cost Center",
"print_hide": 1,
+ "read_only": 0,
"width": "120px"
},
{
diff --git a/stock/doctype/material_request/test_material_request.py b/stock/doctype/material_request/test_material_request.py
index 44f82d2..080989f 100644
--- a/stock/doctype/material_request/test_material_request.py
+++ b/stock/doctype/material_request/test_material_request.py
@@ -24,7 +24,8 @@
"doctype": "Stock Entry",
"posting_date": "2013-03-01",
"posting_time": "00:00:00",
- "purpose": "Material Receipt"
+ "purpose": "Material Receipt",
+ "fiscal_year": "_Test Fiscal Year 2013",
},
{
"conversion_factor": 1.0,
@@ -125,7 +126,8 @@
["Material Request Item", "Stock Entry Detail"]], mr.doc.name)
se_doclist[0].fields.update({
"posting_date": "2013-03-01",
- "posting_time": "01:00"
+ "posting_time": "01:00",
+ "fiscal_year": "_Test Fiscal Year 2013",
})
se_doclist[1].fields.update({
"qty": 27.0,
@@ -186,7 +188,8 @@
["Material Request Item", "Stock Entry Detail"]], mr.doc.name)
se_doclist[0].fields.update({
"posting_date": "2013-03-01",
- "posting_time": "00:00"
+ "posting_time": "00:00",
+ "fiscal_year": "_Test Fiscal Year 2013",
})
se_doclist[1].fields.update({
"qty": 60.0,
@@ -239,7 +242,8 @@
["Material Request Item", "Stock Entry Detail"]], mr.doc.name)
se_doclist[0].fields.update({
"posting_date": "2013-03-01",
- "posting_time": "00:00"
+ "posting_time": "00:00",
+ "fiscal_year": "_Test Fiscal Year 2013",
})
se_doclist[1].fields.update({
"qty": 60.0,
diff --git a/stock/utils.py b/stock/utils.py
index 1406af6..d75c1d4 100644
--- a/stock/utils.py
+++ b/stock/utils.py
@@ -170,9 +170,10 @@
# sales bom item
buying_amount = 0.0
for bom_item in item_sales_bom[item_code]:
- buying_amount += _get_buying_amount(voucher_type, voucher_no, "[** No Item Row **]",
- bom_item.item_code, bom_item.warehouse or warehouse,
- bom_item.total_qty or (bom_item.qty * qty), stock_ledger_entries)
+ if bom_item.get("parent_detail_docname")==voucher_detail_no:
+ buying_amount += _get_buying_amount(voucher_type, voucher_no, "[** No Item Row **]",
+ bom_item.item_code, bom_item.warehouse or warehouse,
+ bom_item.total_qty or (bom_item.qty * qty), stock_ledger_entries)
return buying_amount
else:
# doesn't have sales bom
@@ -181,13 +182,16 @@
def _get_buying_amount(voucher_type, voucher_no, item_row, item_code, warehouse, qty,
stock_ledger_entries):
- for i, sle in enumerate(stock_ledger_entries):
+ relevant_stock_ledger_entries = [sle for sle in stock_ledger_entries
+ if sle.item_code == item_code and sle.warehouse == warehouse]
+
+ for i, sle in enumerate(relevant_stock_ledger_entries):
if sle.voucher_type == voucher_type and sle.voucher_no == voucher_no and \
- (sle.voucher_detail_no == item_row or (sle.voucher_type != "Stock Reconciliation"
- and sle.item_code == item_code and sle.warehouse == warehouse and flt(sle.qty) == qty)):
- previous_stock_value = len(stock_ledger_entries) > i+1 and \
- flt(stock_ledger_entries[i+1].stock_value) or 0.0
-
+ ((sle.voucher_detail_no == item_row) or (sle.voucher_type != "Stock Reconciliation"
+ and flt(sle.qty) == qty)):
+ previous_stock_value = len(relevant_stock_ledger_entries) > i+1 and \
+ flt(relevant_stock_ledger_entries[i+1].stock_value) or 0.0
+
buying_amount = previous_stock_value - flt(sle.stock_value)
return buying_amount
diff --git a/support/doctype/newsletter/test_newsletter.py b/support/doctype/newsletter/test_newsletter.py
index 4650c0a..0813cfe 100644
--- a/support/doctype/newsletter/test_newsletter.py
+++ b/support/doctype/newsletter/test_newsletter.py
@@ -38,18 +38,21 @@
test_records =[
[{
+ "doctype": "Newsletter",
"subject": "_Test Newsletter to Lead",
"send_to_type": "Lead",
"lead_source": "All",
"message": "This is a test newsletter"
}],
[{
+ "doctype": "Newsletter",
"subject": "_Test Newsletter to Contact",
"send_to_type": "Contact",
"contact_type": "Customer",
"message": "This is a test newsletter"
}],
[{
+ "doctype": "Newsletter",
"subject": "_Test Newsletter to Custom",
"send_to_type": "Custom",
"email_list": "test_custom@example.com, test_custom1@example.com, test_custom2@example.com",