fix: Party account validation in JV
(cherry picked from commit 417d6abcf4)
# Conflicts:
# erpnext/accounts/doctype/journal_entry/journal_entry.py
This commit is contained in:
@@ -26,6 +26,13 @@ from erpnext.accounts.utils import (
|
|||||||
)
|
)
|
||||||
from erpnext.controllers.accounts_controller import AccountsController
|
from erpnext.controllers.accounts_controller import AccountsController
|
||||||
from erpnext.hr.doctype.expense_claim.expense_claim import update_reimbursed_amount
|
from erpnext.hr.doctype.expense_claim.expense_claim import update_reimbursed_amount
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
from erpnext.accounts.doctype.invoice_discounting.invoice_discounting \
|
||||||
|
import get_party_account_based_on_invoice_discounting
|
||||||
|
from erpnext.accounts.deferred_revenue import get_deferred_booking_accounts
|
||||||
|
from erpnext.accounts.party import get_party_gle_currency
|
||||||
|
>>>>>>> 417d6abcf4 (fix: Party account validation in JV)
|
||||||
|
|
||||||
|
|
||||||
class StockAccountInvalidTransaction(frappe.ValidationError):
|
class StockAccountInvalidTransaction(frappe.ValidationError):
|
||||||
@@ -49,6 +56,7 @@ class JournalEntry(AccountsController):
|
|||||||
self.clearance_date = None
|
self.clearance_date = None
|
||||||
|
|
||||||
self.validate_party()
|
self.validate_party()
|
||||||
|
self.validate_party_account_currency()
|
||||||
self.validate_entries_for_advance()
|
self.validate_entries_for_advance()
|
||||||
self.validate_multi_currency()
|
self.validate_multi_currency()
|
||||||
self.set_amounts_in_company_currency()
|
self.set_amounts_in_company_currency()
|
||||||
@@ -327,11 +335,25 @@ class JournalEntry(AccountsController):
|
|||||||
account_type = frappe.db.get_value("Account", d.account, "account_type")
|
account_type = frappe.db.get_value("Account", d.account, "account_type")
|
||||||
if account_type in ["Receivable", "Payable"]:
|
if account_type in ["Receivable", "Payable"]:
|
||||||
if not (d.party_type and d.party):
|
if not (d.party_type and d.party):
|
||||||
|
<<<<<<< HEAD
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_("Row {0}: Party Type and Party is required for Receivable / Payable account {1}").format(
|
_("Row {0}: Party Type and Party is required for Receivable / Payable account {1}").format(
|
||||||
d.idx, d.account
|
d.idx, d.account
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
=======
|
||||||
|
frappe.throw(_("Row {0}: Party Type and Party is required for Receivable / Payable account {1}").format(d.idx, d.account))
|
||||||
|
|
||||||
|
def validate_party_account_currency(self):
|
||||||
|
for d in self.get("accounts"):
|
||||||
|
if d.party_type in ('Customer', 'Supplier'):
|
||||||
|
party_gle_currency = get_party_gle_currency(d.party_type, d.party, self.company)
|
||||||
|
party_account_currency = get_account_currency(d.account)
|
||||||
|
party_currency = frappe.db.get_value(d.party_type, d.party, 'default_currency')
|
||||||
|
|
||||||
|
if not party_gle_currency and (party_account_currency != party_currency):
|
||||||
|
frappe.throw(_("Party Account {0} currency and default party currency should be same").format(frappe.bold(d.account)))
|
||||||
|
>>>>>>> 417d6abcf4 (fix: Party account validation in JV)
|
||||||
|
|
||||||
def check_credit_limit(self):
|
def check_credit_limit(self):
|
||||||
customers = list(
|
customers = list(
|
||||||
|
|||||||
Reference in New Issue
Block a user