From 36abfc5b9e7cbe37bbe5815a2adbe6f4ed3f87df Mon Sep 17 00:00:00 2001 From: Ivan Yelizariev Date: Mon, 3 Mar 2025 16:49:38 +0100 Subject: [PATCH] :zap: sync: add SECRETS._update_secret --- sync/doc/changelog.rst | 3 ++- sync/models/sync_project.py | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/sync/doc/changelog.rst b/sync/doc/changelog.rst index 624e2890..5ca32cbc 100644 --- a/sync/doc/changelog.rst +++ b/sync/doc/changelog.rst @@ -1,8 +1,9 @@ -`13.0.1` +`14.0.0` ------- - **New:** sync.order: attaching multiple records via new line_ids field; automatic link to sync.job record. - **New:** sync.task: save technical_name of the task for a better integration with Odoo UI (e.g. to call task via custom action) +- **New:** Add dynamic Secret update via `SECRETS._update_secret`. `13.0.1` ------- diff --git a/sync/models/sync_project.py b/sync/models/sync_project.py index c7892371..a19cafaf 100644 --- a/sync/models/sync_project.py +++ b/sync/models/sync_project.py @@ -357,7 +357,22 @@ def gen2csv(generator): "AttrDict": AttrDict, }, ) - SECRETS = AttrDict() + + def _update_secret(key, value): + SECRETS[key] = value + for p in self.secret_ids: + if p.key == key: + p.value = value + return + self.env["sync.project.secret"].create( + { + "project_id": self.id, + "key": key, + "value": value, + } + ) + + SECRETS = AttrDict(_update_secret) for p in self.secret_ids: SECRETS[p.key] = p.value