# When importing statement, partys are not automatically selected

**URL:** https://discuss.tryton.org/t/when-importing-statement-partys-are-not-automatically-selected/4330
**Category:** User
**Created:** [June 17, 2021, 8:03am UTC](https://discuss.tryton.org/t/when-importing-statement-partys-are-not-automatically-selected/4330 "2021-06-17T08:03:25Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Simon](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/simon/32/1150_2.png) [@Simon](https://discuss.tryton.org/u/Simon)
#### Post date: [June 17, 2021, 8:03am UTC](https://discuss.tryton.org/t/when-importing-statement-partys-are-not-automatically-selected/4330/1 "2021-06-17T08:03:25Z")

</div>

When I’m importing a statement, Most of partys are not automatically linked, depsites their bank account is correctly encoded in database.

Is this considered a normal behaviour?

This is only working when the name are exactly similar, but the bank account is a better key, also because some users can have more than one.

Or maybe it’s a configuration problem?

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [June 17, 2021, 8:07am UTC](https://discuss.tryton.org/t/when-importing-statement-partys-are-not-automatically-selected/4330/2 "2021-06-17T08:07:49Z")

</div>

Hi Simon,

Which format are you using? The imported data depends on the format you are importing.

Also it is possible to use the [account\_statement\_rule](https://docs.tryton.org/projects/modules-account-statement-rule/en/latest/) module to create rules to find the party using the `bank_account` keyword or the `party` keyword. We recently had [a discussion about party matthinc](https://discuss.tryton.org/t/improve-statement-rule-party-matching/4318/10) that may be relevant to your case.

---

<div class="post-metadata">

### Author: ![Simon](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/simon/32/1150_2.png) [@Simon](https://discuss.tryton.org/u/Simon)
#### Post date: [June 17, 2021, 9:18am UTC](https://discuss.tryton.org/t/when-importing-statement-partys-are-not-automatically-selected/4330/3 "2021-06-17T09:18:21Z")

</div>

Hi,

Thanks for your answer, I use an OFX format.

I’ll have look on [account\_statement\_rule](https://docs.tryton.org/projects/modules-account-statement-rule/en/latest/) module then.

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [June 17, 2021, 9:44am UTC](https://discuss.tryton.org/t/when-importing-statement-partys-are-not-automatically-selected/4330/4 "2021-06-17T09:44:38Z")

</div>

> [@Simon](#):
>
> Thanks for your answer, I use an OFX format.

This format does not read the bank account. Is there a deidcated field for it or it’s just included on a description field?

---

<div class="post-metadata">

### Author: ![Simon](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/simon/32/1150_2.png) [@Simon](https://discuss.tryton.org/u/Simon)
#### Post date: [June 17, 2021, 10:15am UTC](https://discuss.tryton.org/t/when-importing-statement-partys-are-not-automatically-selected/4330/5 "2021-06-17T10:15:06Z")

</div>

In the OFX file, I’ve a dedicated field with the partys account number:

```
<BANKACCTTO>
  <ACCTID>BE0 ************ </ACCTID>
  <ACCTTYPE>CHECKING</ACCTTYPE>
</BANKACCTTO>

```

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [June 17, 2021, 10:36am UTC](https://discuss.tryton.org/t/when-importing-statement-partys-are-not-automatically-selected/4330/6 "2021-06-17T10:36:23Z")

</div>

As far as I can see the transactions do not have any bank account but only payee. And this is the value that Tryton is using to search for a party.

---

<div class="post-metadata">

### Author: ![Simon](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/simon/32/1150_2.png) [@Simon](https://discuss.tryton.org/u/Simon)
#### Post date: [June 17, 2021, 11:50am UTC](https://discuss.tryton.org/t/when-importing-statement-partys-are-not-automatically-selected/4330/7 "2021-06-17T11:50:22Z")

</div>

I’m sorry I don’t understand what you mean.

There is actually a bank account (IBAN) in the OFX file for each transactions. Here is a full example. I have a name and bank account. Tryton is able to find party from the name.

```
<STMTTRN>
  <TRNTYPE>DEBIT</TRNTYPE>
  <DTPOSTED>20210511</DTPOSTED>
  <TRNAMT>Amount</TRNAMT>
  <FITID>7d83941f77eadf9fba6db729af00ca933f29e03d</FITID>
  <NAME>Name of owner</NAME>
  <MEMO>communication</MEMO>
  <BANKACCTTO>
    <ACCTID>DE00000000000000000000</ACCTID>
    <ACCTTYPE>CHECKING</ACCTTYPE>
  </BANKACCTTO>
</STMTTRN>

```

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [June 17, 2021, 12:35pm UTC](https://discuss.tryton.org/t/when-importing-statement-partys-are-not-automatically-selected/4330/8 "2021-06-17T12:35:59Z")

</div>

Indeed it is an optional tag that [ofxparse](https://github.com/jseutter/ofxparse) does not support. So the first thing to do is to make a proposal to this project to add the support.

---

<div class="post-metadata">

### Author: ![Simon](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/simon/32/1150_2.png) [@Simon](https://discuss.tryton.org/u/Simon)
#### Post date: [June 17, 2021, 3:53pm UTC](https://discuss.tryton.org/t/when-importing-statement-partys-are-not-automatically-selected/4330/9 "2021-06-17T15:53:04Z")

</div>

Ok. It’s looks the right way as tryton delegate to ofxparse this question.  
However, as this is a optionnal tag, it is maybe not widely used and this is almost a dead end for developpement. I feel it could be more useful to invest time to implement a mapping for CSV, as it is a common format for bank statement and would provide a more generic solution.

I can see this was discussed here: I’ll answer this post then.

> [@Import account statement in CSV format](https://discuss.tryton.org/t/import-account-statement-in-csv-format/3394/):
>
> In France, many banks (all those of the BPCE group at least) don’t propose bank statement export in formats other than csv. Currently I use a complex process to convert this csv to OFX, then I manually add some missing field, to be able to import statement as a OFX file. I propose to write a module account\_statement\_csv that would use directly the csv from the online bank account interface to import statements. Is it a bad idea or do you think to a better way?

---

<div class="post-metadata">

### Author: ![Simon](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/simon/32/1150_2.png) [@Simon](https://discuss.tryton.org/u/Simon)
#### Post date: [June 19, 2021, 5:21am UTC](https://discuss.tryton.org/t/when-importing-statement-partys-are-not-automatically-selected/4330/10 "2021-06-19T05:21:04Z")

</div>

I was ready to open an issue but you’ve done it already 🙂

> <https://github.com/jseutter/ofxparse/issues/164>
>
> A statement transaction can have an optional BANKACCTTO or CCACCTTO tag.
> It can… be useful to have this information when trying to match the transaction with an existing party of a system.
> References:
> \* https://www.ofx.net/downloads/OFX%202.2.pdf#G13.15938
> \* https://www.ofx.net/downloads/OFX%202.2.pdf#G13.15273

I’m not sure I’ve understood how to use the rules but **encoding the bank name in identifiers for each parties** is a working solution.

---

<div class="post-metadata">

### Author: ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)
#### Post date: [July 19, 2021, 5:21am UTC](https://discuss.tryton.org/t/when-importing-statement-partys-are-not-automatically-selected/4330/11 "2021-07-19T05:21:33Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
