From 663c35ffecc4e7d807bccf91f4c6a0e2e7077f3a Mon Sep 17 00:00:00 2001 From: tarteo Date: Thu, 28 Nov 2024 11:50:17 +0100 Subject: [PATCH] [FIX] argocd.application.get_value --- argocd_deployer/models/application.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/argocd_deployer/models/application.py b/argocd_deployer/models/application.py index d1357a8..62bca68 100644 --- a/argocd_deployer/models/application.py +++ b/argocd_deployer/models/application.py @@ -4,7 +4,7 @@ import jinja2 from git import Repo -from odoo import _, api, fields, models +from odoo import Command, _, api, fields, models from odoo.exceptions import ValidationError from odoo.tools.safe_eval import safe_eval @@ -61,7 +61,10 @@ class Application(models.Model): def get_value(self, key, default=""): self.ensure_one() kv_pair = self.value_ids.filtered(lambda v: v.key == key) - return kv_pair and kv_pair.value or default + if kv_pair: + return kv_pair.value + self.value_ids = [Command.create({"key": key, "value": default})] + return default def has_tag(self, key): self.ensure_one()