diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-01-22 17:47:32 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-01-22 17:47:32 +0100 |
| commit | fa1f2132e79f2ac2314a8b417d5d35d6571bd41b (patch) | |
| tree | 3789a8335dd5089998de3c5c6a391b2d95a85187 /addons/l10n_fr_pos_cert | |
| parent | db27489fe756b24647e993a22340705625839698 (diff) | |
| parent | 950d9b2369046f2e3199d144df8edbd0e63f8a2f (diff) | |
[MERGE] forward port branch 11.0 up to 950d9b23690
Diffstat (limited to 'addons/l10n_fr_pos_cert')
| -rw-r--r-- | addons/l10n_fr_pos_cert/models/pos.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/addons/l10n_fr_pos_cert/models/pos.py b/addons/l10n_fr_pos_cert/models/pos.py index f3a35a5a878..d74641e3c88 100644 --- a/addons/l10n_fr_pos_cert/models/pos.py +++ b/addons/l10n_fr_pos_cert/models/pos.py @@ -79,13 +79,13 @@ class pos_order(models.Model): _('An error occured when computing the inalterability. Impossible to get the unique previous posted point of sale order.')) #build and return the hash - return self._compute_hash(prev_order.l10n_fr_hash if prev_order else '') + return self._compute_hash(prev_order.l10n_fr_hash if prev_order else u'') def _compute_hash(self, previous_hash): """ Computes the hash of the browse_record given as self, based on the hash of the previous record in the company's securisation sequence given as parameter""" self.ensure_one() - hash_string = sha256(previous_hash + self.l10n_fr_string_to_hash) + hash_string = sha256((previous_hash + self.l10n_fr_string_to_hash).encode('utf-8')) return hash_string.hexdigest() def _compute_string_to_hash(self): @@ -108,7 +108,7 @@ class pos_order(models.Model): values[k] = _getattrstring(line, field) #make the json serialization canonical # (https://tools.ietf.org/html/draft-staykov-hu-json-canonical-form-00) - order.l10n_fr_string_to_hash = dumps(values, sort_keys=True, encoding="utf-8", + order.l10n_fr_string_to_hash = dumps(values, sort_keys=True, ensure_ascii=True, indent=None, separators=(',',':')) @@ -155,7 +155,7 @@ class pos_order(models.Model): if not orders: raise UserError(_('There isn\'t any order flagged for data inalterability yet for the company %s. This mechanism only runs for point of sale orders generated after the installation of the module France - Certification CGI 286 I-3 bis. - POS') % self.env.user.company_id.name) - previous_hash = '' + previous_hash = u'' start_order_info = [] for order in orders: if order.l10n_fr_hash != order._compute_hash(previous_hash=previous_hash): |
