[255][IMP] data_nature_importer: Add Queue Job support and move to server action
This commit is contained in:
parent
3efc767c42
commit
44bbae8dd7
6 changed files with 20 additions and 18 deletions
|
|
@ -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
|
||||
===========
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in a new issue