mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-09 08:11:19 +00:00
fix: validate party on non receivable / payable account
(cherry picked from commit c6a2d86ba6)
# Conflicts:
# erpnext/accounts/party.py
This commit is contained in:
@@ -13,7 +13,11 @@ import erpnext
|
||||
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
|
||||
get_checks_for_pl_and_bs_accounts,
|
||||
)
|
||||
from erpnext.accounts.party import validate_party_frozen_disabled, validate_party_gle_currency
|
||||
from erpnext.accounts.party import (
|
||||
validate_account_party_type,
|
||||
validate_party_frozen_disabled,
|
||||
validate_party_gle_currency,
|
||||
)
|
||||
from erpnext.accounts.utils import get_account_currency, get_fiscal_year
|
||||
from erpnext.exceptions import InvalidAccountCurrency
|
||||
|
||||
@@ -226,6 +230,7 @@ class GLEntry(Document):
|
||||
|
||||
def validate_party(self):
|
||||
validate_party_frozen_disabled(self.party_type, self.party)
|
||||
validate_account_party_type(self)
|
||||
|
||||
def validate_currency(self):
|
||||
company_currency = erpnext.get_company_currency(self.company)
|
||||
|
||||
@@ -740,6 +740,7 @@ def validate_party_frozen_disabled(party_type, party_name):
|
||||
frappe.msgprint(_("{0} {1} is not active").format(party_type, party_name), alert=True)
|
||||
|
||||
|
||||
<<<<<<< HEAD
|
||||
def get_timeline_data(doctype, name):
|
||||
"""returns timeline data for the past one year"""
|
||||
from frappe.desk.form.load import get_communication_data
|
||||
@@ -784,6 +785,17 @@ def get_timeline_data(doctype, name):
|
||||
out.update({timestamp: count})
|
||||
|
||||
return out
|
||||
=======
|
||||
def validate_account_party_type(self):
|
||||
if self.party_type and self.party:
|
||||
account_type = frappe.get_cached_value("Account", self.account, "account_type")
|
||||
if account_type and (account_type not in ["Receivable", "Payable"]):
|
||||
frappe.throw(
|
||||
_(
|
||||
"Party Type and Party can only be set for Receivable / Payable account<br><br>" "{0}"
|
||||
).format(self.account)
|
||||
)
|
||||
>>>>>>> c6a2d86ba6 (fix: validate party on non receivable / payable account)
|
||||
|
||||
|
||||
def get_dashboard_info(party_type, party, loyalty_program=None):
|
||||
|
||||
Reference in New Issue
Block a user