qif-import: ignoriert leere buchungen, prüft buchungstyp und kategorietyp
This commit is contained in:
parent
2db020f5d8
commit
1a4ed7a1df
3 changed files with 45 additions and 1 deletions
10
locale/de.po
10
locale/de.po
|
@ -12,7 +12,7 @@ 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:\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"
|
||||
msgstr "Die folgenden Transaktionen werden nun importiert:\nEinnahmen: %(credit)s\nAusgaben: %(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:"
|
||||
|
@ -70,6 +70,14 @@ msgctxt "model:ir.message,text:mds_import_book_notfound"
|
|||
msgid "The cashbook '%(bookname)s' was not found."
|
||||
msgstr "Das Kassenbuch '%(bookname)s' wurde nicht gefunden."
|
||||
|
||||
msgctxt "model:ir.message,text:mds_import_category_not_match"
|
||||
msgid "The category '%(catname)s' of the split booking does not match the bookingtype '%(bktype)s' (data: '%(data)s')"
|
||||
msgstr "Die Kategorie '%(catname)s' der Splitbuchung paßt nicht zum Buchungstyp '%(bktype)s' (Daten: '%(data)s')"
|
||||
|
||||
msgctxt "model:ir.message,text:msg_ignore_null_booking"
|
||||
msgid "Ignore empty booking, no category, amount zero: %(trinfo)s"
|
||||
msgstr "Ignoriere leere Buchung, keine Kategorie, Betrag Null: %(trinfo)s"
|
||||
|
||||
|
||||
#############
|
||||
# ir.action #
|
||||
|
|
|
@ -53,6 +53,13 @@ full copyright notices and license terms. -->
|
|||
<record model="ir.message" id="mds_import_no_account">
|
||||
<field name="text">No cashbook has been assigned for transaction '%(trdata)s'.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="mds_import_category_not_match">
|
||||
<field name="text">The category '%(catname)s' of the split booking does not match the bookingtype '%(bktype)s' (data: '%(data)s')</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_ignore_null_booking">
|
||||
<field name="text">Ignore empty booking, no category, amount zero: %(trinfo)s</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
29
qiftool.py
29
qiftool.py
|
@ -441,6 +441,24 @@ class QifTool(Model):
|
|||
if cls.check_counter_transaction(transaction, line) == True:
|
||||
# counter-transaction already exists
|
||||
continue
|
||||
else :
|
||||
# transaction: no category, no account - ignore?
|
||||
if line.get('amount', Decimal('0.0')) == Decimal('0.0'):
|
||||
# no amount --> ignore!
|
||||
tr_info = {'trdate': '-', 'amount':'-'}
|
||||
if 'date' in transaction.keys():
|
||||
tr_info['trdate'] = Report.format_date(transaction['date'], None)
|
||||
if 'amount' in transaction.keys():
|
||||
tr_info['amount'] = Report.format_currency(
|
||||
transaction['amount'],
|
||||
None,
|
||||
book.currency)
|
||||
tr_info['descr'] = transaction.get('description', '-')
|
||||
msg_list.append(gettext(
|
||||
'cashbook_dataexchange.msg_ignore_null_booking',
|
||||
trinfo = '%(trdate)s, %(amount)s, %(descr)s' % tr_info,
|
||||
))
|
||||
continue
|
||||
|
||||
# party
|
||||
if 'party' in transaction.keys():
|
||||
|
@ -470,6 +488,17 @@ class QifTool(Model):
|
|||
msg_list.append(msg_txt)
|
||||
|
||||
if cat_obj is not None:
|
||||
# category match to bookingtype?
|
||||
if ((cat_obj.cattype == 'in') and line['bookingtype'].endswith('out')) or\
|
||||
((cat_obj.cattype == 'out') and line['bookingtype'].endswith('in')):
|
||||
msg_list.append(gettext(
|
||||
'cashbook_dataexchange.mds_import_category_not_match',
|
||||
catname = '%s [%s]' % (cat_obj.rec_name, cat_obj.cattype),
|
||||
bktype = line['bookingtype'],
|
||||
data = str(transaction),
|
||||
))
|
||||
fail_cnt += 1
|
||||
|
||||
split_lines.append({
|
||||
'amount': sp_line['amount'] \
|
||||
if line['bookingtype'] in ['in', 'spin'] else sp_line['amount'].copy_negate(),
|
||||
|
|
Loading…
Reference in a new issue