[minor] [fix] get_query for cost center
diff --git a/accounts/doctype/cost_center/cost_center.js b/accounts/doctype/cost_center/cost_center.js
index d273e53..ed60cc0 100644
--- a/accounts/doctype/cost_center/cost_center.js
+++ b/accounts/doctype/cost_center/cost_center.js
@@ -38,7 +38,7 @@
var mydoc = locals[this.doctype][this.docname];
return{
filters:[
- ['Account', 'company', '=', doc.company_name],
+ ['Account', 'company', '=', doc.company],
['Account', 'is_pl_account', '=', 'Yes'],
['Account', 'debit_or_credit', '=', 'Debit'],
['Account', 'group_or_ledger', '!=', 'Group'],
@@ -51,8 +51,8 @@
return{
filters:[
['Cost Center', 'group_or_ledger', '=', 'Group'],
- ['Cost Center', 'company', '=', doc.company_name],
- ['Cost Center', 'company_name', 'is not', 'NULL']
+ ['Cost Center', 'company', '=', doc.company],
+ ['Cost Center', 'company', 'is not', 'NULL']
]
}
}
diff --git a/accounts/doctype/journal_voucher/journal_voucher.js b/accounts/doctype/journal_voucher/journal_voucher.js
index ea077981..6503064 100644
--- a/accounts/doctype/journal_voucher/journal_voucher.js
+++ b/accounts/doctype/journal_voucher/journal_voucher.js
@@ -197,7 +197,7 @@
cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) {
return {
filters: {
- 'company_name': doc.company,
+ 'company': doc.company,
'group_or_ledger': 'Ledger'
}
}
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 870147a..4a90928 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,171 +18,4 @@
import unittest
import webnotes
-test_records = []
-
-# 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
-# })
+test_records = []
\ No newline at end of file
diff --git a/accounts/doctype/pos_setting/pos_setting.js b/accounts/doctype/pos_setting/pos_setting.js
index 991c8da..2f8beab 100755
--- a/accounts/doctype/pos_setting/pos_setting.js
+++ b/accounts/doctype/pos_setting/pos_setting.js
@@ -54,7 +54,7 @@
cur_frm.fields_dict['cost_center'].get_query = function(doc,cdt,cdn) {
return{
filters:{
- 'company_name': doc.company,
+ 'company': doc.company,
'group_or_ledger': "Ledger"
}
}
diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.js b/accounts/doctype/purchase_invoice/purchase_invoice.js
index efe0c2a..4afb838 100644
--- a/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -216,7 +216,7 @@
cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) {
return {
filters: {
- 'company_name': doc.company,
+ 'company': doc.company,
'group_or_ledger': 'Ledger'
}
diff --git a/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js b/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js
index c9f78fb..5717bbf 100644
--- a/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js
+++ b/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js
@@ -143,7 +143,7 @@
cur_frm.fields_dict['purchase_tax_details'].grid.get_field("cost_center").get_query = function(doc) {
return {
filters: {
- 'company_name': doc.company,
+ 'company': doc.company,
'group_or_ledger': "Ledger"
}
}
diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js
index 70bf03b..c802622 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/accounts/doctype/sales_invoice/sales_invoice.js
@@ -287,7 +287,7 @@
return{
filters:{
'group_or_ledger': 'Ledger',
- 'company_name': doc.company
+ 'company': doc.company
}
}
}
diff --git a/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js b/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js
index 9ec574e..6d7f2db 100644
--- a/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js
+++ b/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js
@@ -148,7 +148,7 @@
cur_frm.fields_dict['other_charges'].grid.get_field("cost_center").get_query = function(doc) {
return{
- 'company_name': doc.company,
+ 'company': doc.company,
'group_or_ledger': "Ledger"
}
}
diff --git a/stock/doctype/delivery_note/delivery_note.js b/stock/doctype/delivery_note/delivery_note.js
index 790d409..62d6529 100644
--- a/stock/doctype/delivery_note/delivery_note.js
+++ b/stock/doctype/delivery_note/delivery_note.js
@@ -252,7 +252,7 @@
return {
filters: {
- 'company_name': doc.company,
+ 'company': doc.company,
'group_or_ledger': "Ledger"
}
}