From b20f41275c347bc4a2bca921b19d68792e649ee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Mon, 25 Nov 2024 16:48:50 +0100 Subject: [PATCH] [IMP] base_import_pdf_by_template: Add json field compatibility TT50003 --- .../models/base_import_pdf_template.py | 4 ++++ .../views/base_import_pdf_template_line_views.xml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/base_import_pdf_by_template/models/base_import_pdf_template.py b/base_import_pdf_by_template/models/base_import_pdf_template.py index 3c341b893f..99744d72e9 100644 --- a/base_import_pdf_by_template/models/base_import_pdf_template.py +++ b/base_import_pdf_by_template/models/base_import_pdf_template.py @@ -1,5 +1,6 @@ # Copyright 2024 Tecnativa - Víctor Martínez # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +import json import re from datetime import datetime @@ -339,6 +340,7 @@ def _get_fixed_field_name_ttype_mapped(self): "integer": "fixed_value_integer", "selection": "fixed_value_selection", "text": "fixed_value_text", + "json": "fixed_value_text", "many2one": "fixed_value", } @@ -348,6 +350,8 @@ def _get_fixed_value(self): f_value = self[f_name] if self.field_ttype == "selection": f_value = f_value.value + elif self.field_ttype == "json": + f_value = json.loads(f_value) return f_value def _replace_text(self, text, letters, prefix): diff --git a/base_import_pdf_by_template/views/base_import_pdf_template_line_views.xml b/base_import_pdf_by_template/views/base_import_pdf_template_line_views.xml index 02d923386b..2f62e40379 100644 --- a/base_import_pdf_by_template/views/base_import_pdf_template_line_views.xml +++ b/base_import_pdf_by_template/views/base_import_pdf_template_line_views.xml @@ -101,7 +101,7 @@