Skip to content

⚡ sync: add SECRETS._update_secret #494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: 17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sync/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -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`
-------
Expand Down
17 changes: 16 additions & 1 deletion sync/models/sync_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 6 additions & 2 deletions sync/models/sync_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def _compute_active_triggers(self):
r.active_automation_ids = r.with_context(active_test=True).automation_ids
r.active_webhook_ids = r.with_context(active_test=True).webhook_ids

def action_magic_button(self):
def _magic_button(self):
# TODO: This should be refactored, because we use single button per task
if not self.button_ids:
self.button_ids.create(
Expand All @@ -113,7 +113,11 @@ def action_magic_button(self):
"sync_task_id": self.id,
}
)
return self.button_ids.start_button()

return self.button_ids

def action_magic_button(self):
return self._magic_button().start_button()

def _get_current_date_formatted(self):
user_lang = self.env.user.lang or "en_US"
Expand Down
Loading