Issue 8857

Title
Transaction description is blank when importing some OFX files
Priority
feature
Status
resolved
Nosy list
ced, dave, reviewbot, roundup-bot
Assigned to
dave
Keywords
review

Created on 2019-11-22.16:57:53 by dave, last changed 12 months ago by roundup-bot.

Messages

New changeset 260e0692b1e4 by C├ędric Krier in branch 'default':
Add unrecognized payees to origin description
https://hg.tryton.org/tryton-env/rev/260e0692b1e4
New changeset 3f2fdc134660 by David Harper in branch 'default':
Add unrecognized payees to origin description
https://hg.tryton.org/modules/account_statement_ofx/rev/3f2fdc134660
Author: [hidden] (dave) Tryton committer
Date: 2019-11-22.17:26:05
I think that is a good suggestion.

I was considering reporting the issue upstream, but the spec is rather ambiguous about what the name field should contain, so I'm not too sure how ofxparse could resolve it, plus it doesn't look like there have been any commits to ofxparse since late 2018.
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2019-11-22.17:09:28
I think the best will be to append the payee to the description if any party was found.
Author: [hidden] (dave) Tryton committer
Date: 2019-11-22.16:57:52
When importing OFX files generated by some banks the description field is not filled in from the OFX data, making it hard for the user to correctly identify the transactions. (e.g: https://discuss.tryton.org/t/create-journal-for-ofx-import/1526/9).

It appears that the banks are using the name element* inside the stmttrn aggregate* for the description of the transaction.  This is then parsed by ofxparse into the payee field and the memo field is left blank, which results in blank descriptions.

Rather confusingly, the OFX spec (https://www.ofx.net/downloads/OFX%202.2.pdf) says (on page 216) the name element* is for the "Name of payee or description of transaction".

Definitions from OFX spec:
*element: a tag that contains only data and no other tags.
*aggregate: a tag that contains other tags and no data.

Examples of parts of OFX data downloaded from two different banks, which don't have the memo element*, and which show the name element* being used for the transaction description:

----------------
<STMTTRN>
  <TRNTYPE>OTHER
  <DTPOSTED>20191112000000[-5:EST]
  <TRNAMT>-12.34
  <FITID>+201911120000001

  <NAME>100457
</STMTTRN>

<STMTTRN>
  <TRNTYPE>DIRECTDEBIT
  <DTPOSTED>20191111000000[-5:EST]
  <TRNAMT>-123.45
  <FITID>+201911110000001

  <NAME>B/CARD PLAT VISA 123456789012345
</STMTTRN>
----------------
<STMTTRN>
  <TRNTYPE>POS</TRNTYPE>
  <DTPOSTED>20191111120000.000[+1]</DTPOSTED>
  <TRNAMT>-1.2</TRNAMT>
  <FITID>00POS201911111200000001-12TESCOSTORESGB</FITID>
  <NAME>TESCO STORES GB</NAME>
</STMTTRN>
<STMTTRN>
  <TRNTYPE>CREDIT</TRNTYPE>
  <DTPOSTED>20191112120000.000[+1]</DTPOSTED>
  <TRNAMT>12.34</TRNAMT>
  <FITID>00CREDIT2019111212000000011234BankcreditfromXXXXXXXXXXXX</FITID>
  <NAME>Bank credit from XXXXXXXX XXXX</NAME>
</STMTTRN>
----------------
History
Date User Action Args
2019-11-25 11:15:12roundup-botsetmessages: + msg53474
2019-11-25 11:15:05roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg53473
2019-11-24 13:44:13reviewbotsetmessages: + msg53461
2019-11-24 12:42:11reviewbotsetmessages: + msg53457
2019-11-22 19:03:25reviewbotsetmessages: + msg53434
2019-11-22 18:08:20reviewbotsetnosy: + reviewbot
messages: + msg53431
2019-11-22 18:08:19reviewbotsetreviews: 276391005
keyword: + review
2019-11-22 17:45:54davesetstatus: in-progress -> testing
2019-11-22 17:26:46davesetstatus: unread -> in-progress
assignedto: dave
2019-11-22 17:26:06davesetstatus: chatting -> unread
messages: + msg53429

Showing 10 items. Show all history (warning: this could be VERY long)