From c7666fb35f21384f422326ddf6f0696889f46105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Sat, 20 Jul 2024 23:48:23 +0000 Subject: [PATCH] [FIX] l10n_br_nfe: don't read stacking point id --- l10n_br_nfe/models/document.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/l10n_br_nfe/models/document.py b/l10n_br_nfe/models/document.py index 2de65a4611a2..fdce68441bcc 100644 --- a/l10n_br_nfe/models/document.py +++ b/l10n_br_nfe/models/document.py @@ -655,6 +655,10 @@ def _export_field(self, xsd_field, class_obj, member_spec, export_value=None): return super()._export_field(xsd_field, class_obj, member_spec, export_value) def _export_many2one(self, field_name, xsd_required, class_obj=None): + """ + Overriden to avoid creating inner tag for m2o if none of the + denormalized inner attribute has been set. + """ self.ensure_one() if field_name in self._stacking_points.keys(): if field_name == "nfe40_ISSQNtot" and not any( @@ -668,7 +672,10 @@ def _export_many2one(self, field_name, xsd_required, class_obj=None): fields = [ f for f in comodel._fields - if f.startswith(self._field_prefix) and f in self._fields.keys() + if f.startswith(self._field_prefix) + and f in self._fields.keys() + and not f + in self._stacking_points.keys() # don't try to nfe40_fat id when reading nfe40_cobr ] sub_tag_read = self.read(fields)[0] if not any( @@ -1223,7 +1230,7 @@ def _nfe_send_for_authorization(self): # Commit to secure receipt info for future queries. in_testing = getattr(threading.current_thread(), "testing", False) if not in_testing: - self.env.cr.commit() + self.env.cr.commit() # pylint: disable=invalid-commit # Check if 'nfe_separate_async_process' is set in the company # settings. If True, skip the receipt consultation in this