diff options
| author | Alexandre Kühn <aku@odoo.com> | 2017-12-22 11:50:39 +0100 |
|---|---|---|
| committer | Nicolas Martinelli <nim-odoo@users.noreply.github.com> | 2017-12-22 15:48:15 +0100 |
| commit | 262bec6af53fe2cf7108faa8ec7d6bbfb67d89d6 (patch) | |
| tree | 2e3cb23e800e9272cf98d077486c846388483ba6 | |
| parent | fbaee8b267d7fe57ca5a81f529969f262c26b102 (diff) | |
[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
| -rw-r--r-- | addons/l10n_fr_pos_cert/models/pos.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/l10n_fr_pos_cert/models/pos.py b/addons/l10n_fr_pos_cert/models/pos.py index d6d88604e8c..9ce9694e979 100644 --- a/addons/l10n_fr_pos_cert/models/pos.py +++ b/addons/l10n_fr_pos_cert/models/pos.py @@ -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 |
