[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.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
Bug Tracker Bug Tracker
=========== ===========

View file

@ -5,7 +5,7 @@
"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.1",
"depends": ["product"], "depends": ["product", "queue_job"],
"data": [ "data": [
"security/ir.model.access.csv", "security/ir.model.access.csv",
"views/product_template_views.xml", "views/product_template_views.xml",

View file

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

View file

@ -383,6 +383,7 @@ ul.auto-toc {
<ul class="simple"> <ul class="simple">
<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>
</ul> </ul>
</div> </div>
<div class="section" id="bug-tracker"> <div class="section" id="bug-tracker">

View file

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