Merge pull request #6019 from nabinhait/pcv_test_case
Fixed test cases for period closing voucher
This commit is contained in:
commit
2777f23ace
@ -1,21 +1,37 @@
|
|||||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
frappe.ui.form.on('Period Closing Voucher', {
|
||||||
|
onload: function(frm) {
|
||||||
|
if (!frm.doc.transaction_date) frm.doc.transaction_date = dateutil.obj_to_str(new Date());
|
||||||
|
},
|
||||||
|
|
||||||
//========================== On Load =================================================
|
setup: function(frm) {
|
||||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
frm.set_query("closing_account_head", function() {
|
||||||
if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date());
|
return {
|
||||||
}
|
filters: [
|
||||||
|
['Account', 'company', '=', frm.doc.company],
|
||||||
|
['Account', 'is_group', '=', '0'],
|
||||||
|
['Account', 'freeze_account', '=', 'No'],
|
||||||
|
['Account', 'root_type', 'in', 'Liability, Equity']
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
refresh: function(frm) {
|
||||||
// ***************** Get Account Head *****************
|
if(frm.doc.docstatus==1) {
|
||||||
cur_frm.fields_dict['closing_account_head'].get_query = function(doc, cdt, cdn) {
|
frm.add_custom_button(__('Ledger'), function() {
|
||||||
return {
|
frappe.route_options = {
|
||||||
filters: [
|
"voucher_no": frm.doc.name,
|
||||||
['Account', 'company', '=', doc.company],
|
"from_date": frm.doc.posting_date,
|
||||||
['Account', 'is_group', '=', '0'],
|
"to_date": frm.doc.posting_date,
|
||||||
['Account', 'freeze_account', '=', 'No'],
|
"company": frm.doc.company,
|
||||||
['Account', 'root_type', 'in', 'Liability, Equity']
|
group_by_voucher: 0
|
||||||
]
|
};
|
||||||
|
frappe.set_route("query-report", "General Ledger");
|
||||||
|
}, "icon-table");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
})
|
||||||
|
@ -55,9 +55,8 @@ class TestPeriodClosingVoucher(unittest.TestCase):
|
|||||||
if random_expense_account:
|
if random_expense_account:
|
||||||
# Check posted value for teh above random_expense_account
|
# Check posted value for teh above random_expense_account
|
||||||
gle_for_random_expense_account = frappe.db.sql("""
|
gle_for_random_expense_account = frappe.db.sql("""
|
||||||
select debit - credit as amount,
|
select sum(debit - credit) as amount,
|
||||||
debit_in_account_currency - credit_in_account_currency
|
sum(debit_in_account_currency - credit_in_account_currency) as amount_in_account_currency
|
||||||
as amount_in_account_currency
|
|
||||||
from `tabGL Entry`
|
from `tabGL Entry`
|
||||||
where voucher_type='Period Closing Voucher' and voucher_no=%s and account =%s""",
|
where voucher_type='Period Closing Voucher' and voucher_no=%s and account =%s""",
|
||||||
(pcv.name, random_expense_account[0].account), as_dict=True)
|
(pcv.name, random_expense_account[0].account), as_dict=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user