Fix transaction post_date being set to midnight local.

Reported for Invoices on gnucash-user. Checked all other uses of
xaccTransSetPostDateSecs(), fixed the ones that weren't passing an
already normalized time64. For Invoices change the post_date to also be
normalized so that it stays the same as the transaction post_date. That
also protects it from the displayed date changing depending on timezone.

The python binding invoice post_time test had to be changed to match.
This commit is contained in:
John Ralls
2020-04-30 11:30:03 -07:00
parent 1e59819176
commit b4177bc60a
4 changed files with 7 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
from unittest import main
from datetime import datetime, timedelta
from datetime import datetime, timezone
from gnucash import Account, \
ACCT_TYPE_RECEIVABLE, ACCT_TYPE_INCOME, ACCT_TYPE_BANK, \
@@ -56,8 +56,8 @@ class TestBusiness(BusinessSession):
self.assertEqual( NAME, self.employee.GetUsername() )
def test_post(self):
self.assertEqual(self.today - timedelta(0, 0, self.today.microsecond),
self.invoice.GetDatePosted())
self.assertEqual(datetime.now(timezone.utc).replace(hour=10, minute=59, second=0, microsecond=0).astimezone(),
self.invoice.GetDatePosted().astimezone())
self.assertTrue( self.invoice.IsPosted() )
def test_owner(self):