From 9d0dd5066a0730a9e1e802965a8720cfe13d5374 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 22 Jun 2015 07:32:46 +0530 Subject: [PATCH] Removed 'Root Type' validation for receivable/payable account in sales/purchase invoice --- erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py | 4 +--- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 4 +--- .../patches/v5_0/update_frozen_accounts_permission_role.py | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 8820c87b40..3f34020d12 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -88,9 +88,7 @@ class PurchaseInvoice(BuyingController): throw(_("Conversion rate cannot be 0 or 1")) def validate_credit_to_acc(self): - root_type, account_type = frappe.db.get_value("Account", self.credit_to, ["root_type", "account_type"]) - if root_type != "Liability": - frappe.throw(_("Credit To account must be a liability account")) + account_type = frappe.db.get_value("Account", self.credit_to, "account_type") if account_type != "Payable": frappe.throw(_("Credit To account must be a Payable account")) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index fe5954e0e0..abe58cea85 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -235,9 +235,7 @@ class SalesInvoice(SellingController): reconcile_against_document(lst) def validate_debit_to_acc(self): - root_type, account_type = frappe.db.get_value("Account", self.debit_to, ["root_type", "account_type"]) - if root_type != "Asset": - frappe.throw(_("Debit To account must be a liability account")) + account_type = frappe.db.get_value("Account", self.debit_to, "account_type") if account_type != "Receivable": frappe.throw(_("Debit To account must be a Receivable account")) diff --git a/erpnext/patches/v5_0/update_frozen_accounts_permission_role.py b/erpnext/patches/v5_0/update_frozen_accounts_permission_role.py index 2f85513558..14426f5e80 100644 --- a/erpnext/patches/v5_0/update_frozen_accounts_permission_role.py +++ b/erpnext/patches/v5_0/update_frozen_accounts_permission_role.py @@ -7,6 +7,6 @@ def execute(): account_settings = frappe.get_doc("Accounts Settings") if not account_settings.frozen_accounts_modifier and account_settings.bde_auth_role: - frappe.db.set_value("Account Settings", None, + frappe.db.set_value("Accounts Settings", None, "frozen_accounts_modifier", account_settings.bde_auth_role)