From 35a31cff6903219231fd58844b1713bfc67aed32 Mon Sep 17 00:00:00 2001 From: Frederik Jaeckel Date: Sat, 3 Sep 2022 20:36:16 +0200 Subject: [PATCH] transaktion: import korrigiert --- locale/de.po | 6 +++--- message.xml | 2 +- qif_import_wiz.py | 10 ++++++---- qiftool.py | 3 +++ 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/locale/de.po b/locale/de.po index 5ba30ee..b452c61 100644 --- a/locale/de.po +++ b/locale/de.po @@ -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" ########################################### diff --git a/message.xml b/message.xml index 265ca49..b777317 100644 --- a/message.xml +++ b/message.xml @@ -18,7 +18,7 @@ full copyright notices and license terms. --> The following %(numparties)s parties are now imported: - The following transactionen are now imported:\nBalance: %(balance)s\nNumber of transactions: %(quantity)s + The following transactionen are now imported:\nCredit: %(credit)s\nDebit: %(debit)s\nBalance: %(balance)s\nNumber of transactions: %(quantity)s When reading the QIF file, there were the following problems: diff --git a/qif_import_wiz.py b/qif_import_wiz.py index 352ceb3..d6a41ba 100644 --- a/qif_import_wiz.py +++ b/qif_import_wiz.py @@ -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 : diff --git a/qiftool.py b/qiftool.py index a3c11e8..2625775 100644 --- a/qiftool.py +++ b/qiftool.py @@ -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)]