home
·
contact
·
privacy
projects
/
misc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improve accounting scripts.
[misc]
/
ledger.py
diff --git
a/ledger.py
b/ledger.py
index 46035bc3790ac42815fd1b9c2a1910cf574da07e..f29f73ec190d3b1391b4a3f05ca088607ac221d2 100755
(executable)
--- a/
ledger.py
+++ b/
ledger.py
@@
-449,8
+449,8
@@
class Booking:
self.description = description
self.top_comment = top_comment
self.validate_head()
self.description = description
self.top_comment = top_comment
self.validate_head()
- self.transfer_lines = transfer_lines
- if
len(self.transfer_lines) < 2 and self.validate
:
+ self.transfer_lines = transfer_lines
if transfer_lines else []
+ if
self.validate and len(self.transfer_lines) < 2
:
raise PlomException(f'{self.intro}: too few transfer lines')
self.calculate_account_changes()
self.lines = [LedgerTextLine(l) for l in self.for_writing]
raise PlomException(f'{self.intro}: too few transfer lines')
self.calculate_account_changes()
self.lines = [LedgerTextLine(l) for l in self.for_writing]
@@
-1032,8
+1032,11
@@
class LedgerDB(PlomDB):
content = sent if sent else ([] if 'textarea'==edit_mode else None)
else:
content = self.bookings[index]
content = sent if sent else ([] if 'textarea'==edit_mode else None)
else:
content = self.bookings[index]
+ date_today = str(datetime.now())[:10]
if copy:
if copy:
- content.date = str(datetime.now())[:10]
+ content.date = date_today
+ elif -1 == index and (content is None or [] == content):
+ content = Booking(date=date_today, validate=False)
if 'textarea' == edit_mode and content:
content = content.for_writing
else:
if 'textarea' == edit_mode and content:
content = content.for_writing
else: