Skip to content

Commit

Permalink
🚑 Use Project ID for xmlid namespace
Browse files Browse the repository at this point in the history
Otherwise we get a mess on making multiple projects or on switching to new gist
  • Loading branch information
yelizariev committed May 11, 2024
1 parent e9b5d07 commit f11be23
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions sync/doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

- **New:** Use prime numbers for major releases ;-)
- **New:** Support data files
- **Fix:** Use Project ID for xmlid namespace
- **Improvement:** make links dependent on project

`7.0.0`
Expand Down
9 changes: 4 additions & 5 deletions sync/models/sync_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,6 @@ def magic_upgrade(self):
raise UserError(_("Please provide url to the gist page"))

gist_content = fetch_gist_data(self.source_url)
gist_id = gist_content["id"]
gist_files = {}
for file_name, file_info in gist_content["files"].items():
gist_files[file_name] = file_info["content"]
Expand Down Expand Up @@ -496,7 +495,7 @@ def magic_upgrade(self):
"project_id": self.id,
}
self.env[model]._create_or_update_by_xmlid(
param_vals, f"PARAM_{key}", namespace=gist_id
param_vals, f"PARAM_{key}", namespace=self.id
)

# [CORE] and [LIB]
Expand Down Expand Up @@ -536,7 +535,7 @@ def magic_upgrade(self):
"file_content": file_content,
}
self.env["sync.data"]._create_or_update_by_xmlid(
data_vals, file_name, namespace=gist_id
data_vals, file_name, namespace=self.id
)

# Tasks 🦋
Expand Down Expand Up @@ -575,7 +574,7 @@ def magic_upgrade(self):
"project_id": self.id,
}
task = self.env["sync.task"]._create_or_update_by_xmlid(
task_vals, task_technical_name, namespace=gist_id
task_vals, task_technical_name, namespace=self.id
)

def create_trigger(model, data):
Expand All @@ -585,7 +584,7 @@ def create_trigger(model, data):
trigger_name=data["name"],
)
return self.env[model]._create_or_update_by_xmlid(
vals, data["name"], namespace=gist_id
vals, data["name"], namespace=self.id
)

# Create/Update triggers
Expand Down

0 comments on commit f11be23

Please sign in to comment.