[FIX] l10n_fr_pos_cert: datetime.timedelta
When a user was closing a POS to go into the backend, and click on "Reprendre", there was an error which prevent him to reopen the POS. There was a confusion between object <datetime> and <datetime.datetime>, as the previous code was trying to use the function timedelta() from datetime.datetime instead of datetime. As a result, the error states that datetime.datetime has no function timedelta. opw-801523
This commit is contained in:
committed by
Nicolas Martinelli
parent
fbaee8b267
commit
262bec6af5
@@ -1,4 +1,4 @@
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta
|
||||
from hashlib import sha256
|
||||
from json import dumps
|
||||
import pytz
|
||||
@@ -41,7 +41,7 @@ class pos_session(models.Model):
|
||||
self.ensure_one()
|
||||
date_today = datetime.utcnow()
|
||||
session_start = Datetime.from_string(self.start_at)
|
||||
if not date_today - datetime.timedelta(hours=24) <= session_start:
|
||||
if not date_today - timedelta(hours=24) <= session_start:
|
||||
raise UserError(_("This session has been opened another day. To comply with the French law, you should close sessions on a daily basis. Please close session %s and open a new one.") % self.name)
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user