chore: Make auto matching party configurable
- Checkbox in Accounts settings "Enable Automatic Party Matching" - Check before invoking automatching methods - misc: Remove TODO comments
This commit is contained in:
parent
33604550ce
commit
aea4315435
@ -59,7 +59,9 @@
|
|||||||
"frozen_accounts_modifier",
|
"frozen_accounts_modifier",
|
||||||
"report_settings_sb",
|
"report_settings_sb",
|
||||||
"tab_break_dpet",
|
"tab_break_dpet",
|
||||||
"show_balance_in_coa"
|
"show_balance_in_coa",
|
||||||
|
"banking_tab",
|
||||||
|
"enable_party_matching"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
@ -368,6 +370,18 @@
|
|||||||
"fieldname": "book_tax_discount_loss",
|
"fieldname": "book_tax_discount_loss",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Book Tax Loss on Early Payment Discount"
|
"label": "Book Tax Loss on Early Payment Discount"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "banking_tab",
|
||||||
|
"fieldtype": "Tab Break",
|
||||||
|
"label": "Banking"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"description": "Auto match and set the Party in Bank Transactions",
|
||||||
|
"fieldname": "enable_party_matching",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Enable Automatic Party Matching"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "icon-cog",
|
"icon": "icon-cog",
|
||||||
@ -375,7 +389,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2023-03-28 09:50:20.375233",
|
"modified": "2023-04-04 16:20:41.330039",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Accounts Settings",
|
"name": "Accounts Settings",
|
||||||
|
|||||||
@ -8,12 +8,6 @@ from erpnext.controllers.status_updater import StatusUpdater
|
|||||||
|
|
||||||
|
|
||||||
class BankTransaction(StatusUpdater):
|
class BankTransaction(StatusUpdater):
|
||||||
# TODO
|
|
||||||
# On submit/update after submit
|
|
||||||
# - Create/Update a Bank Party Map record
|
|
||||||
# - User can edit after submit.
|
|
||||||
# - If changes in party/party name after submit, edit bank party map (which should edit all transactions with same account no/iban/bank party name)
|
|
||||||
|
|
||||||
def after_insert(self):
|
def after_insert(self):
|
||||||
self.unallocated_amount = abs(flt(self.withdrawal) - flt(self.deposit))
|
self.unallocated_amount = abs(flt(self.withdrawal) - flt(self.deposit))
|
||||||
|
|
||||||
@ -21,7 +15,8 @@ class BankTransaction(StatusUpdater):
|
|||||||
self.clear_linked_payment_entries()
|
self.clear_linked_payment_entries()
|
||||||
self.set_status()
|
self.set_status()
|
||||||
|
|
||||||
self.auto_set_party()
|
if frappe.db.get_single_value("Accounts Settings", "enable_party_matching"):
|
||||||
|
self.auto_set_party()
|
||||||
|
|
||||||
_saving_flag = False
|
_saving_flag = False
|
||||||
|
|
||||||
@ -34,7 +29,8 @@ class BankTransaction(StatusUpdater):
|
|||||||
self.update_allocations()
|
self.update_allocations()
|
||||||
self._saving_flag = False
|
self._saving_flag = False
|
||||||
|
|
||||||
self.update_automatch_bank_party_mapper()
|
if frappe.db.get_single_value("Accounts Settings", "enable_party_matching"):
|
||||||
|
self.update_automatch_bank_party_mapper()
|
||||||
|
|
||||||
def on_cancel(self):
|
def on_cancel(self):
|
||||||
self.clear_linked_payment_entries(for_cancel=True)
|
self.clear_linked_payment_entries(for_cancel=True)
|
||||||
@ -157,7 +153,6 @@ class BankTransaction(StatusUpdater):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def auto_set_party(self):
|
def auto_set_party(self):
|
||||||
# TODO: check if enabled
|
|
||||||
from erpnext.accounts.doctype.bank_transaction.auto_match_party import AutoMatchParty
|
from erpnext.accounts.doctype.bank_transaction.auto_match_party import AutoMatchParty
|
||||||
|
|
||||||
if self.party_type and self.party:
|
if self.party_type and self.party:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user