transaktion: import korrigiert

This commit is contained in:
Frederik Jaeckel 2022-09-03 20:36:16 +02:00
parent 833f49c9a6
commit 35a31cff69
4 changed files with 13 additions and 8 deletions

View file

@ -11,8 +11,8 @@ msgid "The following categories are now imported:\n%(categories)s"
msgstr "Die folgenden Kategorien werden nun importiert:\n%(categories)s"
msgctxt "model:ir.message,text:msg_wiz_transactions_found"
msgid "The following transactionen are now imported:\nBalance: %(balance)s\nNumber of transactions: %(quantity)s"
msgstr "Die folgenden Transaktionen werden nun importiert:\nSaldo: %(balance)s\nAnzahl Transactionen: %(quantity)s"
msgid "The following transactionen are now imported:\nCredit: %(credit)s\nDebit: %(debit)s\nBalance: %(balance)s\nNumber of transactions: %(quantity)s"
msgstr "Die folgenden Transaktionen werden nun importiert:\nEinnahmen: %(credit)s\Ausgaben: %(debit)s\nSaldo: %(balance)s\nAnzahl Transactionen: %(quantity)s"
msgctxt "model:ir.message,text:msg_wiz_parties_found"
msgid "The following %(numparties)s parties are now imported:"
@ -88,7 +88,7 @@ msgstr "Abbruch"
msgctxt "wizard_button:cashbook_dataexchange.qif_imp_wiz,showinfo,importf:"
msgid "Import Data"
msgstr "Daten Kategorien"
msgstr "Daten importieren"
###########################################

View file

@ -18,7 +18,7 @@ full copyright notices and license terms. -->
<field name="text">The following %(numparties)s parties are now imported:</field>
</record>
<record model="ir.message" id="msg_wiz_transactions_found">
<field name="text">The following transactionen are now imported:\nBalance: %(balance)s\nNumber of transactions: %(quantity)s</field>
<field name="text">The following transactionen are now imported:\nCredit: %(credit)s\nDebit: %(debit)s\nBalance: %(balance)s\nNumber of transactions: %(quantity)s</field>
</record>
<record model="ir.message" id="msg_wiz_transactions_error">
<field name="text">When reading the QIF file, there were the following problems:</field>

View file

@ -203,16 +203,18 @@ class ImportQifWizard(Wizard):
# count
if fail_cnt == 0:
balance = sum([
x['amount'] \
if x['bookingtype'] in ['in', 'spin'] else x['amount'].copy_sign(Decimal('-1.0')) \
for x in to_create])
debit = sum([x['amount'] for x in to_create if x['bookingtype']=='out'])
credit = sum([x['amount'] for x in to_create if x['bookingtype']=='in'])
balance = credit - debit
if len(msg_list) > 0:
msg_list.append('')
info_lst.append(gettext(
'cashbook_dataexchange.msg_wiz_transactions_found',
quantity = len(to_create),
balance = Report.format_currency(balance, None, self.start.book.currency),
credit = Report.format_currency(credit, None, self.start.book.currency),
debit = Report.format_currency(debit, None, self.start.book.currency),
))
self.showinfo.allowimport = True
else :

View file

@ -288,6 +288,7 @@ class QifTool(Model):
(cat_id, msg_txt) = cls.get_category_by_name(cat_name, cat_type)
if cat_id is None:
msg_list.append(msg_txt)
fail_cnt += 1
continue
else :
line['category'] = cat_id
@ -317,6 +318,8 @@ class QifTool(Model):
'description': sp_line.get('description', None),
'category': cat_id,
})
else :
fail_cnt += 1
if len(split_lines) > 0:
line['splitlines'] = [('create', split_lines)]