Skip to content
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

😍 sync: add PARAMS to core eval context #477

Merged
merged 1 commit into from
May 19, 2024
Merged
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
2 changes: 1 addition & 1 deletion sync/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"name": "Sync 🪬 Studio",
"summary": """Join the Amazing 😍 Community ⤵️""",
"category": "VooDoo ✨ Magic",
"version": "16.0.11.0.0",
"version": "16.0.11.0.1",
"application": True,
"author": "Ivan Kropotkin",
"support": "[email protected]",
Expand Down
6 changes: 6 additions & 0 deletions sync/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
`11.0.1`
-------

- **Improvement:** add `PARAMS.*` to the core eval context
- **Improvement:** clarify error message when model is not found

`11.0.0`
-------

Expand Down
12 changes: 10 additions & 2 deletions sync/models/sync_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,15 +327,16 @@ def record2image(record, fname="image_1920"):
DATA[d.name] = d

core_eval_context = {
"MAGIC": MAGIC,
"SECRETS": SECRETS,
"MAGIC": MAGIC,
"PARAMS": PARAMS,
}
CORE = eval_export(safe_eval__MAGIC, self.core_code, core_eval_context)

lib_eval_context = {
"MAGIC": MAGIC,
"CORE": CORE,
"PARAMS": PARAMS,
"CORE": CORE,
"WEBHOOKS": WEBHOOKS,
"DATA": DATA,
}
Expand Down Expand Up @@ -596,6 +597,13 @@ def create_trigger(model, data):

for data in meta.get("DB_TRIGGERS", []):
model_id = self.env["ir.model"]._get(data["model"]).id
if not model_id:
raise ValidationError(
_(
"Model %s is not available. Check if you need to install an extra module first."
)
% data["model"]
)
create_trigger(
"sync.trigger.automation", dict(data, model_id=model_id, model=None)
)
Expand Down
Loading