fix: Use existing bank fields to match by bank account no/IBAN

- Remove newly added fields in Party doctypes to store bank details
- Use Bank Account's fields to match against account no/iban
- For employee, if Bank Account does not exist, find in Employee doctype against account no/iban
This commit is contained in:
marination 2023-05-09 20:36:07 +05:30
parent 88647c63ba
commit dbf7a479b6
3 changed files with 14 additions and 56 deletions

View File

@ -99,15 +99,24 @@ class AutoMatchbyAccountIBAN:
for party in parties:
or_filters = {}
if self.bank_party_account_number:
acc_no_field = "bank_ac_no" if party == "Employee" else "bank_account_no"
or_filters[acc_no_field] = self.bank_party_account_number
or_filters["bank_account_no"] = self.bank_party_account_number
if self.bank_party_iban:
or_filters["iban"] = self.bank_party_iban
party_result = frappe.db.get_all(
party, or_filters=or_filters, pluck="name", limit_page_length=1
"Bank Account", or_filters=or_filters, pluck="name", limit_page_length=1
)
if party == "Employee" and not party_result:
# Search in Bank Accounts first for Employee, and then Employee record
if "bank_account_no" in or_filters:
or_filters["bank_ac_no"] = or_filters.pop("bank_account_no")
party_result = frappe.db.get_all(
party, or_filters=or_filters, pluck="name", limit_page_length=1
)
if party_result:
result = (
party,

View File

@ -52,11 +52,6 @@
"supplier_primary_address",
"primary_address",
"accounting_tab",
"bank_details_section",
"bank_account_no",
"column_break_n8mz",
"iban",
"section_break_ow3k",
"payment_terms",
"accounts",
"settings_tab",
@ -450,29 +445,6 @@
{
"fieldname": "column_break_59",
"fieldtype": "Column Break"
},
{
"fieldname": "bank_details_section",
"fieldtype": "Section Break",
"label": "Bank Details"
},
{
"fieldname": "bank_account_no",
"fieldtype": "Data",
"label": "Bank Account No"
},
{
"fieldname": "column_break_n8mz",
"fieldtype": "Column Break"
},
{
"fieldname": "iban",
"fieldtype": "Data",
"label": "IBAN"
},
{
"fieldname": "section_break_ow3k",
"fieldtype": "Section Break"
}
],
"icon": "fa fa-user",
@ -485,7 +457,7 @@
"link_fieldname": "party"
}
],
"modified": "2023-03-30 15:50:40.241257",
"modified": "2023-05-09 15:34:13.408932",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier",

View File

@ -61,10 +61,6 @@
"tax_category",
"tax_withholding_category",
"accounting_tab",
"bank_details_section",
"bank_account_no",
"column_break_xtwg",
"iban",
"credit_limit_section",
"payment_terms",
"credit_limits",
@ -559,25 +555,6 @@
{
"fieldname": "column_break_54",
"fieldtype": "Column Break"
},
{
"fieldname": "bank_details_section",
"fieldtype": "Section Break",
"label": "Bank Details"
},
{
"fieldname": "bank_account_no",
"fieldtype": "Data",
"label": "Bank Account No"
},
{
"fieldname": "column_break_xtwg",
"fieldtype": "Column Break"
},
{
"fieldname": "iban",
"fieldtype": "Data",
"label": "IBAN"
}
],
"icon": "fa fa-user",
@ -591,7 +568,7 @@
"link_fieldname": "party"
}
],
"modified": "2023-03-30 15:45:44.387975",
"modified": "2023-05-09 15:38:40.255193",
"modified_by": "Administrator",
"module": "Selling",
"name": "Customer",