[255][IMP] data_nature_importer: Add Queue Job support and move to server action

This commit is contained in:
Niels Göttsch 2026-01-16 08:57:42 +01:00 committed by madmooose
parent 3efc767c42
commit 44bbae8dd7
6 changed files with 20 additions and 18 deletions

View file

@ -40,6 +40,7 @@ Changelog
- 16.0.1.0.0: Initial module.
- 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
Bug Tracker
===========

View file

@ -5,7 +5,7 @@
"website": "https://www.bakeup.org",
"category": "product",
"version": "16.0.1.0.1",
"depends": ["product"],
"depends": ["product", "queue_job"],
"data": [
"security/ir.model.access.csv",
"views/product_template_views.xml",

View file

@ -8,9 +8,7 @@ class ProductTemplate(models.Model):
def action_sync_datanature_image(self):
for product in self:
image_data = product._get_dn_image()
if image_data:
product.image_1920 = image_data
product.with_delay()._sync_datanature_image()
def _get_dn_metadata(self):
self.ensure_one()
@ -31,3 +29,9 @@ class ProductTemplate(models.Model):
if image_data:
return image_data
return False
def _sync_datanature_image(self):
self.ensure_one()
image_data = self._get_dn_image()
if image_data:
self.image_1920 = image_data

View file

@ -1,2 +1,3 @@
- 16.0.1.0.0: Initial module.
- 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

View file

@ -383,6 +383,7 @@ ul.auto-toc {
<ul class="simple">
<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.1.0: Add Queue Job support and move to server action</li>
</ul>
</div>
<div class="section" id="bug-tracker">

View file

@ -1,18 +1,13 @@
<odoo>
<record id="product_template_action_menu" model="ir.ui.view">
<field name="name">product.template.action.menu</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<xpath expr="//header" position="inside">
<button
name="action_sync_datanature_image"
type="object"
string="Sync DataNature Image"
class="oe_highlight"
<record id="model_product_template_action_sync_image" model="ir.actions.server">
<field name="name">Sync Datanature Image</field>
<field name="model_id" ref="product.model_product_template"/> <field
name="binding_model_id"
ref="product.model_product_template"
/>
</xpath>
<field name="state">code</field>
<field name="code">
action = records.action_sync_datanature_image()
</field>
</record>
</odoo>