mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-17 18:45:20 +00:00
fix: Accounting for internal transfer invoices within same company (#24021)
* fix: Accounting for internal transfer invoices within same company * fix: warehouse fetching * fix: Linting issues * fix: GL entry fixes and validation for intercompany account * fix: Account naming changes and other fixes * fix: Add test for internal transfer * fix: Test Case * fix: Add description for fields * fix: Commonfied code * fix: Map warehouse and serial no
This commit is contained in:
@@ -58,6 +58,7 @@ class Customer(TransactionBase):
|
||||
self.set_loyalty_program()
|
||||
self.check_customer_group_change()
|
||||
self.validate_default_bank_account()
|
||||
self.validate_internal_customer()
|
||||
|
||||
# set loyalty program tier
|
||||
if frappe.db.exists('Customer', self.name):
|
||||
@@ -82,6 +83,11 @@ class Customer(TransactionBase):
|
||||
if not is_company_account:
|
||||
frappe.throw(_("{0} is not a company bank account").format(frappe.bold(self.default_bank_account)))
|
||||
|
||||
def validate_internal_customer(self):
|
||||
if self.is_internal_customer and frappe.db.get_value('Customer', {"represents_company": self.represents_company}, "name"):
|
||||
frappe.throw(_("Internal Customer for company {0} already exists").format(
|
||||
frappe.bold(self.represents_company)))
|
||||
|
||||
def on_update(self):
|
||||
self.validate_name_with_customer_group()
|
||||
self.create_primary_contact()
|
||||
@@ -398,7 +404,7 @@ def check_credit_limit(customer, company, ignore_outstanding_sales_order=False,
|
||||
# form a list of emails and names to show to the user
|
||||
credit_controller_users_formatted = [get_formatted_email(user).replace("<", "(").replace(">", ")") for user in credit_controller_users]
|
||||
if not credit_controller_users_formatted:
|
||||
frappe.throw(_("Please contact your administrator to extend the credit limits for {0}.".format(customer)))
|
||||
frappe.throw(_("Please contact your administrator to extend the credit limits for {0}.").format(customer))
|
||||
|
||||
message = """Please contact any of the following users to extend the credit limits for {0}:
|
||||
<br><br><ul><li>{1}</li></ul>""".format(customer, '<li>'.join(credit_controller_users_formatted))
|
||||
|
||||
Reference in New Issue
Block a user