Skip to content

Commit bd7491d

Browse files
authored
Merge pull request #1 from OpenDigitalCC/main
fix: populate OFX NAME field from Lloyds transaction descriptions
2 parents 90fe9fc + 71532fa commit bd7491d

5 files changed

Lines changed: 385 additions & 92 deletions

File tree

README.rst

Lines changed: 117 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,118 @@
1-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2-
Plugin for reading statements of Lloyds UK bank
3-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1+
ofxstatement-lloyds
2+
===================
43

5-
This is a plugin for ofxstatement to convert CSV statements issued by Lloyds UK bank.
4+
Plugin for `ofxstatement <https://github.com/kedder/ofxstatement>`_ to convert
5+
CSV statements exported from Lloyds Bank (UK) into OFX format for import into
6+
accounting software such as Odoo, GnuCash, and others.
7+
8+
Features
9+
--------
10+
11+
Payee extraction
12+
Parses Lloyds transaction descriptions to produce a clean payee name in the
13+
OFX ``<NAME>`` field. Downstream importers use this as the primary
14+
transaction label for display and auto-reconciliation.
15+
16+
Transaction type preservation
17+
Prefixes the OFX ``<MEMO>`` field with the original Lloyds transaction type
18+
code (DD, FPI, FPO, DEB, BGC etc.), preserving detail that is lost in the
19+
standard OFX TRNTYPE mapping.
20+
21+
Structured memo
22+
Splits the description into payee and remainder, so importers that display
23+
``NAME : MEMO`` show useful detail rather than duplication.
24+
25+
Balance tracking
26+
Calculates opening and closing balances from the reverse-chronological CSV,
27+
included in the OFX output for statement validation.
28+
29+
Supported transaction patterns
30+
------------------------------
31+
32+
Card purchases
33+
``MERCHANT CD nnnn [ddMMMYY]`` extracts the merchant name.
34+
35+
FX purchases
36+
``MERCHANT [ref] [CURRENCY] amount VISAXR rate CD nnnn`` extracts the
37+
merchant, with FX details in the memo.
38+
39+
FX fees
40+
``NON-GBP TRANS FEE n.nn% CD nnnn`` normalised to
41+
``Non-GBP Transaction Fee``.
42+
43+
Faster payments (FPI/FPO/BGC)
44+
``PAYEE reference sortcode ddMMMYY HH:MM`` extracts the payer or payee
45+
name.
46+
47+
Direct debits and standing orders (DD/SO)
48+
``PAYEE mandate-reference`` extracts the payee name.
49+
50+
Service charges (PAY)
51+
``SERVICE CHARGES REF : number`` extracts the charge description.
52+
53+
Unrecognised formats fall back to the full description as payee with the
54+
transaction type code as memo.
55+
56+
Installation
57+
------------
58+
59+
.. code-block:: bash
60+
61+
pip install ofxstatement-lloyds
62+
63+
Or with pipx:
64+
65+
.. code-block:: bash
66+
67+
pipx inject ofxstatement ofxstatement-lloyds
68+
69+
Configuration
70+
-------------
71+
72+
Edit the ofxstatement configuration:
73+
74+
.. code-block:: bash
75+
76+
ofxstatement edit-config
77+
78+
Add a section for your Lloyds account:
79+
80+
.. code-block:: ini
81+
82+
[lloyds]
83+
plugin = lloyds
84+
currency = GBP
85+
86+
Usage
87+
-----
88+
89+
Export a CSV statement from Lloyds online banking, then convert:
90+
91+
.. code-block:: bash
92+
93+
ofxstatement convert -t lloyds statement.csv statement.ofx
94+
95+
The CSV is expected in the format provided by Lloyds online banking with
96+
columns: date, type, sort code, account number, description, debit, credit,
97+
balance.
98+
99+
Odoo reconciliation
100+
-------------------
101+
102+
The payee and memo split is designed to work with Odoo's reconciliation models
103+
and the OCA ``account_statement_completion_label_simple`` module.
104+
105+
The ``Label`` field in Odoo matches against the OFX ``<NAME>`` (clean payee).
106+
The ``Note`` field matches against ``<MEMO>`` (prefixed with the Lloyds
107+
transaction type code).
108+
109+
Example reconciliation model rules:
110+
111+
================= ============== =========================================
112+
Label Contains Note Contains Action
113+
================= ============== =========================================
114+
``Non-GBP`` Counterpart: bank charges expense account
115+
``DIRECT LINE`` ``DD`` Partner: Direct Line Insurance
116+
\ ``FPI`` Filter: incoming faster payments only
117+
``HMRC`` ``FPO`` Partner: HMRC
118+
================= ============== =========================================

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "ofxstatement-lloyds"
7-
version = "1.0.1.dev0"
7+
version = "1.1.2"
88
authors = [
99
{ name="Victoria Lebedeva", email="victoria@lebedev.lt" },
1010
]
@@ -30,4 +30,4 @@ dependencies = [
3030
Homepage = "https://github.com/Metasaura/ofxstatement-lloyds"
3131

3232
[project.entry-points."ofxstatement"]
33-
lloyds = "ofxstatement_lloyds.plugin:LloydsPlugin"
33+
lloyds = "ofxstatement_lloyds.plugin:LloydsPlugin"

0 commit comments

Comments
 (0)