[IMP] data_nature_importer: add default image field
This commit is contained in:
parent
44bbae8dd7
commit
bbec3ce533
9 changed files with 16 additions and 2 deletions
|
|
@ -35,6 +35,7 @@ Changelog
|
||||||
- 16.0.1.0.0: Initial module
|
- 16.0.1.0.0: Initial module
|
||||||
- 16.0.1.0.1: Fix security rules
|
- 16.0.1.0.1: Fix security rules
|
||||||
- 16.0.1.0.2: Add tests
|
- 16.0.1.0.2: Add tests
|
||||||
|
- 16.0.1.0.3: Add and use default image field
|
||||||
|
|
||||||
Bug Tracker
|
Bug Tracker
|
||||||
===========
|
===========
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
- 16.0.1.0.0: Initial module
|
- 16.0.1.0.0: Initial module
|
||||||
- 16.0.1.0.1: Fix security rules
|
- 16.0.1.0.1: Fix security rules
|
||||||
- 16.0.1.0.2: Add tests
|
- 16.0.1.0.2: Add tests
|
||||||
|
- 16.0.1.0.3: Add and use default image field
|
||||||
|
|
|
||||||
|
|
@ -390,6 +390,7 @@ ul.auto-toc {
|
||||||
<li>16.0.1.0.0: Initial module</li>
|
<li>16.0.1.0.0: Initial module</li>
|
||||||
<li>16.0.1.0.1: Fix security rules</li>
|
<li>16.0.1.0.1: Fix security rules</li>
|
||||||
<li>16.0.1.0.2: Add tests</li>
|
<li>16.0.1.0.2: Add tests</li>
|
||||||
|
<li>16.0.1.0.3: Add and use default image field</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="bug-tracker">
|
<div class="section" id="bug-tracker">
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ Changelog
|
||||||
- 16.0.1.0.0: Initial module.
|
- 16.0.1.0.0: Initial module.
|
||||||
- 16.0.1.0.1: Catch empty metadata response in _get_dn_metadata
|
- 16.0.1.0.1: Catch empty metadata response in _get_dn_metadata
|
||||||
- 16.0.1.1.0: Add Queue Job support and move to server action
|
- 16.0.1.1.0: Add Queue Job support and move to server action
|
||||||
|
- 16.0.1.0.2: Use default image as product image
|
||||||
|
|
||||||
Bug Tracker
|
Bug Tracker
|
||||||
===========
|
===========
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
"author": "BAKEUP",
|
"author": "BAKEUP",
|
||||||
"website": "https://www.bakeup.org",
|
"website": "https://www.bakeup.org",
|
||||||
"category": "product",
|
"category": "product",
|
||||||
"version": "16.0.1.0.1",
|
"version": "16.0.1.0.2",
|
||||||
"depends": ["product", "queue_job"],
|
"depends": ["product", "queue_job"],
|
||||||
"data": [
|
"data": [
|
||||||
"security/ir.model.access.csv",
|
"security/ir.model.access.csv",
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,14 @@ class ProductTemplate(models.Model):
|
||||||
metadata = self._get_dn_metadata()
|
metadata = self._get_dn_metadata()
|
||||||
if not metadata or not metadata.get("images"):
|
if not metadata or not metadata.get("images"):
|
||||||
return False
|
return False
|
||||||
image_id = metadata.get("images")[0].get("id")
|
images = metadata.get("images")
|
||||||
|
if not images:
|
||||||
|
return False
|
||||||
|
image_id = None
|
||||||
|
for img in images:
|
||||||
|
if img.get("default") == "true":
|
||||||
|
image_id = img.get("id")
|
||||||
|
break
|
||||||
image_data = dn_utils.get_datanature_image(self, image_id, token=None)
|
image_data = dn_utils.get_datanature_image(self, image_id, token=None)
|
||||||
if image_data:
|
if image_data:
|
||||||
return image_data
|
return image_data
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
- 16.0.1.0.0: Initial module.
|
- 16.0.1.0.0: Initial module.
|
||||||
- 16.0.1.0.1: Catch empty metadata response in _get_dn_metadata
|
- 16.0.1.0.1: Catch empty metadata response in _get_dn_metadata
|
||||||
- 16.0.1.1.0: Add Queue Job support and move to server action
|
- 16.0.1.1.0: Add Queue Job support and move to server action
|
||||||
|
- 16.0.1.0.2: Use default image as product image
|
||||||
|
|
|
||||||
|
|
@ -384,6 +384,7 @@ ul.auto-toc {
|
||||||
<li>16.0.1.0.0: Initial module.</li>
|
<li>16.0.1.0.0: Initial module.</li>
|
||||||
<li>16.0.1.0.1: Catch empty metadata response in _get_dn_metadata</li>
|
<li>16.0.1.0.1: Catch empty metadata response in _get_dn_metadata</li>
|
||||||
<li>16.0.1.1.0: Add Queue Job support and move to server action</li>
|
<li>16.0.1.1.0: Add Queue Job support and move to server action</li>
|
||||||
|
<li>16.0.1.0.2: Use default image as product image</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="bug-tracker">
|
<div class="section" id="bug-tracker">
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@ def _parse_products(xml_bytes):
|
||||||
"mime_type": img.findtext(
|
"mime_type": img.findtext(
|
||||||
"dn:mime_type", default="", namespaces=ns
|
"dn:mime_type", default="", namespaces=ns
|
||||||
),
|
),
|
||||||
|
"default": img.findtext("dn:default", default="", namespaces=ns),
|
||||||
"size": img.findtext("dn:size", default="", namespaces=ns),
|
"size": img.findtext("dn:size", default="", namespaces=ns),
|
||||||
"img_width": img.findtext(
|
"img_width": img.findtext(
|
||||||
"dn:img_width", default="", namespaces=ns
|
"dn:img_width", default="", namespaces=ns
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue