Skip to content

Commit

Permalink
⚡ Sync Order
Browse files Browse the repository at this point in the history
  • Loading branch information
yelizariev committed May 19, 2024
1 parent 193bc76 commit a896317
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 13 deletions.
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.1",
"version": "16.0.11.1.0",
"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.1.0`
-------

- **New:** add *Sync Order* — advanced manual trigger with blackjack, partners list, text input, etc.
- **New:** support `data.markdown` for custom documentation at the `DATA.🐫` tab

`11.0.1`
-------

Expand Down
7 changes: 6 additions & 1 deletion sync/models/sync_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class SyncProject(models.Model):
link_ids = fields.One2many("sync.link", "project_id")
link_count = fields.Integer(compute="_compute_link_count")
data_ids = fields.One2many("sync.data", "project_id")
data_description = fields.Html(readonly=True)

def copy(self, default=None):
default = dict(default or {})
Expand Down Expand Up @@ -508,11 +509,15 @@ def magic_upgrade(self):
vals[field_name] = gist_files[file_name]

# [DATA]
file_content = gist_files.get("data.markdown")
if file_content:
vals["data_description"] = compile_markdown_to_html(file_content)

http = urllib3.PoolManager()
for file_info in gist_content["files"].values():
# e.g. "data.emoji.csv"
file_name = file_info["filename"]
if not file_name.startswith("data."):
if not (file_name.startswith("data.") and file_name != "data.markdown"):
continue
raw_url = file_info["raw_url"]
response = http.request("GET", raw_url)
Expand Down
9 changes: 5 additions & 4 deletions sync/models/sync_trigger_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ def write(self, vals):
self._update_name(vals)
return res

@api.model
def create(self, vals):
res = super().create(vals)
res._update_name(vals)
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
res = super().create(vals)
res._update_name(vals)
return res

def default_get(self, fields):
Expand Down
17 changes: 10 additions & 7 deletions sync/views/sync_project_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,6 @@
</notebook>
</page>
<page string="DATA.🐫">
<field name="data_ids">
<tree editable="bottom">
<field name="name" />
<field name="file_name" invisible="1" />
<field name="file_content" filename="file_name" />
</tree>
</field>
<p>
<em>
Hint:
Expand All @@ -272,6 +265,16 @@
</a>
</em>
</p>
<field name="data_ids">
<tree editable="bottom">
<field name="name" />
<field name="file_name" invisible="1" />
<field name="file_content" filename="file_name" />
</tree>
</field>
<div class="html_field_container">
<field name="data_description" nolabel="1" />
</div>
</page>
<page string="SECRETS.🔐">
<p class="oe_read_only">
Expand Down

0 comments on commit a896317

Please sign in to comment.