fix: filter transaction mappings by currency + hide notes from list view
- Add currency field to purpose_rules tuple in _build_import_lookups - Filter rules by txn currency in _match_purpose_rules (empty = match all) - Remove in_list_view from notes field so currency column is visible in grid Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3fbb02a7fc
commit
57c8cb0925
|
|
@ -1458,6 +1458,7 @@ def _build_import_lookups(settings):
|
||||||
getattr(row, "document_type", None) or "Payment Entry",
|
getattr(row, "document_type", None) or "Payment Entry",
|
||||||
getattr(row, "cost_center", None) or "",
|
getattr(row, "cost_center", None) or "",
|
||||||
bool(getattr(row, "multi_currency", 0)),
|
bool(getattr(row, "multi_currency", 0)),
|
||||||
|
(getattr(row, "currency", None) or "").strip().upper(),
|
||||||
))
|
))
|
||||||
|
|
||||||
# Each key maps to a dict with optional "Customer" and "Supplier" entries.
|
# Each key maps to a dict with optional "Customer" and "Supplier" entries.
|
||||||
|
|
@ -1512,8 +1513,9 @@ def _import_one_transaction(txn_data, settings, purpose_rules, purpose_threshold
|
||||||
purpose_only_rules = []
|
purpose_only_rules = []
|
||||||
counterparty_only_rules = []
|
counterparty_only_rules = []
|
||||||
fallback_rules = []
|
fallback_rules = []
|
||||||
|
txn_currency = (txn_data.get("currency") or "").strip().upper()
|
||||||
for rule in purpose_rules:
|
for rule in purpose_rules:
|
||||||
keyword, pf, pt, rule_pt, cp_name, cp_voen, cp_type, doc_type, rule_cc, rule_mc = rule
|
keyword, pf, pt, rule_pt, cp_name, cp_voen, cp_type, doc_type, rule_cc, rule_mc, rule_currency = rule
|
||||||
has_keyword = bool(keyword)
|
has_keyword = bool(keyword)
|
||||||
has_cp = bool(cp_name or cp_voen)
|
has_cp = bool(cp_name or cp_voen)
|
||||||
if has_keyword and has_cp:
|
if has_keyword and has_cp:
|
||||||
|
|
@ -1535,9 +1537,11 @@ def _import_one_transaction(txn_data, settings, purpose_rules, purpose_threshold
|
||||||
def _match_purpose_rules(rules, check_counterparty):
|
def _match_purpose_rules(rules, check_counterparty):
|
||||||
best_score = 0
|
best_score = 0
|
||||||
best_pf = best_pt = best_doc_type = best_cc = best_mc = None
|
best_pf = best_pt = best_doc_type = best_cc = best_mc = None
|
||||||
for keyword, pf, pt, rule_pt, cp_name, cp_voen, cp_type, doc_type, rule_cc, rule_mc in rules:
|
for keyword, pf, pt, rule_pt, cp_name, cp_voen, cp_type, doc_type, rule_cc, rule_mc, rule_currency in rules:
|
||||||
if rule_pt and rule_pt != payment_type:
|
if rule_pt and rule_pt != payment_type:
|
||||||
continue
|
continue
|
||||||
|
if rule_currency and rule_currency != txn_currency:
|
||||||
|
continue
|
||||||
if check_counterparty and not _counterparty_matches(cp_name, cp_voen):
|
if check_counterparty and not _counterparty_matches(cp_name, cp_voen):
|
||||||
continue
|
continue
|
||||||
if keyword:
|
if keyword:
|
||||||
|
|
|
||||||
|
|
@ -96,13 +96,12 @@
|
||||||
{
|
{
|
||||||
"fieldname": "notes",
|
"fieldname": "notes",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"in_list_view": 1,
|
|
||||||
"label": "Notes"
|
"label": "Notes"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2026-03-13 21:17:53.087843",
|
"modified": "2026-03-16 00:00:00.000000",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Kapital Bank",
|
"module": "Kapital Bank",
|
||||||
"name": "Kapital Bank Transaction Mapping",
|
"name": "Kapital Bank Transaction Mapping",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue