commit
17e7538937
@ -30,6 +30,7 @@ class Account(Document):
|
||||
self.validate_mandatory()
|
||||
self.validate_warehouse_account()
|
||||
self.validate_frozen_accounts_modifier()
|
||||
self.validate_balance_must_be_debit_or_credit()
|
||||
|
||||
def validate_master_name(self):
|
||||
if self.master_type in ('Customer', 'Supplier') or self.account_type == "Warehouse":
|
||||
@ -69,6 +70,16 @@ class Account(Document):
|
||||
frozen_accounts_modifier not in frappe.user.get_roles():
|
||||
throw(_("You are not authorized to set Frozen value"))
|
||||
|
||||
def validate_balance_must_be_debit_or_credit(self):
|
||||
from erpnext.accounts.utils import get_balance_on
|
||||
if not self.get("__islocal") and self.balance_must_be:
|
||||
account_balance = get_balance_on(self.name)
|
||||
|
||||
if account_balance > 0 and self.balance_must_be == "Credit":
|
||||
frappe.throw(_("Account balance already in Debit, you are not allowed to set 'Balance Must Be' as 'Credit'"))
|
||||
elif account_balance < 0 and self.balance_must_be == "Debit":
|
||||
frappe.throw(_("Account balance already in Credit, you are not allowed to set 'Balance Must Be' as 'Debit'"))
|
||||
|
||||
def convert_group_to_ledger(self):
|
||||
if self.check_if_child_exists():
|
||||
throw(_("Account with child nodes cannot be converted to ledger"))
|
||||
|
@ -410,7 +410,7 @@ def get_opening_accounts(company):
|
||||
"""get all balance sheet accounts for opening entry"""
|
||||
from erpnext.accounts.utils import get_balance_on
|
||||
accounts = frappe.db.sql_list("""select name from tabAccount
|
||||
where group_or_ledger='Ledger' and report_type='Profit and Loss' and company=%s""", company)
|
||||
where group_or_ledger='Ledger' and report_type='Balance Sheet' and company=%s""", company)
|
||||
|
||||
return [{"account": a, "balance": get_balance_on(a)} for a in accounts]
|
||||
|
||||
|
@ -256,9 +256,6 @@ erpnext.FinancialAnalytics = erpnext.AccountTreeGrid.extend({
|
||||
}
|
||||
});
|
||||
this.data.push(net_profit);
|
||||
// $.each(me.data, function(i, v) {
|
||||
// if(v.report_type=="Profit and Loss") console.log(v)
|
||||
// })
|
||||
}
|
||||
},
|
||||
add_balance: function(field, account, gl) {
|
||||
|
@ -29,6 +29,7 @@ frappe.pages['trial-balance'].onload = function(wrapper) {
|
||||
this.with_period_closing_entry = this.wrapper
|
||||
.find(".with_period_closing_entry input:checked").length;
|
||||
this._super();
|
||||
this.add_total_debit_credit();
|
||||
},
|
||||
|
||||
update_balances: function(account, posting_date, v) {
|
||||
@ -42,6 +43,32 @@ frappe.pages['trial-balance'].onload = function(wrapper) {
|
||||
this._super(account, posting_date, v);
|
||||
}
|
||||
},
|
||||
|
||||
add_total_debit_credit: function() {
|
||||
var me = this;
|
||||
|
||||
var total_row = {
|
||||
company: me.company,
|
||||
id: "Total Debit / Credit",
|
||||
name: "Total Debit / Credit",
|
||||
indent: 0,
|
||||
opening_dr: "NA",
|
||||
opening_cr: "NA",
|
||||
debit: 0,
|
||||
credit: 0,
|
||||
checked: false,
|
||||
};
|
||||
me.item_by_name[total_row.name] = total_row;
|
||||
|
||||
$.each(this.data, function(i, account) {
|
||||
if((account.group_or_ledger == "Ledger") || (account.rgt - account.lft == 1)) {
|
||||
total_row["debit"] += account.debit;
|
||||
total_row["credit"] += account.credit;
|
||||
}
|
||||
});
|
||||
|
||||
this.data.push(total_row);
|
||||
}
|
||||
})
|
||||
erpnext.trial_balance = new TrialBalance(wrapper, 'Trial Balance');
|
||||
|
||||
|
@ -129,12 +129,6 @@ def get_data():
|
||||
"name": "Material Requests for which Supplier Quotations are not created",
|
||||
"doctype": "Material Request"
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"is_query_report": True,
|
||||
"name": "Purchase In Transit",
|
||||
"doctype": "Purchase Order"
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"is_query_report": True,
|
||||
|
@ -211,12 +211,6 @@ def get_data():
|
||||
"name": "Serial No Warranty Expiry",
|
||||
"doctype": "Serial No"
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"is_query_report": True,
|
||||
"name": "Purchase In Transit",
|
||||
"doctype": "Purchase Order"
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"is_query_report": True,
|
||||
|
@ -267,7 +267,7 @@ class BuyingController(StockController):
|
||||
for d in self.get(raw_material_table):
|
||||
if [d.main_item_code, d.reference_name] not in parent_items:
|
||||
# mark for deletion from doclist
|
||||
delete_list.append([d.main_item_code, d.reference_name])
|
||||
delete_list.append(d)
|
||||
|
||||
# delete from doclist
|
||||
if delete_list:
|
||||
|
@ -44,3 +44,4 @@ execute:frappe.db.sql("delete from `tabWebsite Item Group` where ifnull(item_gro
|
||||
execute:frappe.delete_doc("Print Format", "SalesInvoice")
|
||||
execute:import frappe.defaults;frappe.defaults.clear_default("price_list_currency")
|
||||
erpnext.patches.v4_0.update_account_root_type
|
||||
execute:frappe.delete_doc("Report", "Purchase In Transit")
|
||||
|
@ -1,17 +0,0 @@
|
||||
{
|
||||
"apply_user_permissions": 1,
|
||||
"creation": "2013-05-06 12:09:05",
|
||||
"docstatus": 0,
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2014-06-03 07:18:17.234173",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Purchase In Transit",
|
||||
"owner": "Administrator",
|
||||
"query": "SELECT\n pi.name as \"Purchase Invoice:Link/Purchase Invoice:120\",\n\tpi.posting_date as \"Posting Date:Date:100\",\n\tpi.credit_to as \"Supplier Account:Link/Account:120\",\n\tpi_item.item_code as \"Item Code:Link/Item:120\",\n\tpi_item.description as \"Description:Data:140\",\n\tpi_item.qty as \"Qty:Float:120\",\n\tpi_item.base_amount as \"Amount:Currency:120\",\n\tpi_item.purchase_order as \"Purchase Order:Link/Purchase Order:120\",\n\tpi_item.purchase_receipt as \"Purchase Receipt:Link/Purchase Receipt:120\",\n\tpr.posting_date as \"PR Posting Date:Date:130\",\n\tpi.company as \"Company:Link/Company:120\"\nFROM\n\t`tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item, `tabPurchase Receipt` pr\nWHERE\n\tpi.name = pi_item.parent and pi_item.purchase_receipt = pr.name\n\tand pi.docstatus = 1 and pr.posting_date > pi.posting_date\nORDER BY\n\tpi.name desc",
|
||||
"ref_doctype": "Purchase Receipt",
|
||||
"report_name": "Purchase In Transit",
|
||||
"report_type": "Query Report"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user