[IMP] nfu_ecommerce: Remove is_published filtering and use job manager only on more than one

This commit is contained in:
Niels Göttsch 2026-05-22 11:26:28 +02:00 committed by madmooose
parent 7ff88653a8
commit 7d55ad17b2
7 changed files with 26 additions and 5 deletions

View file

@ -13,8 +13,11 @@ class ProductTemplate(models.Model):
_inherit = "product.template"
def action_sync_datanature_information(self):
for product in self:
product.with_delay()._sync_dn_information()
if len(self) == 1:
self._sync_dn_information()
else:
for product in self:
product.with_delay()._sync_dn_information()
def _get_dn_metadata(self):
self.ensure_one()
@ -44,6 +47,10 @@ class ProductTemplate(models.Model):
if category and category not in self.public_categ_ids:
self.public_categ_ids = [(4, category.id)]
# TODO: remove legacy methode aber cleaning up failed jobs
def _sync_datanature_image(self, metadata):
return self._sync_dn_images(metadata)
def _sync_dn_images(self, metadata):
images = metadata.get("images")
if not images:

View file

@ -55,6 +55,7 @@ Changelog
:1.4.1: Add credit to portal details
:1.4.2: Catch unescaped float values
:1.4.3: Drop session if SO belongs to another website (Odoo 16 bug)
:1.4.3: Remove is_published filtering and use job manager only on more than one
Bug Tracker
===========

View file

@ -4,7 +4,7 @@
"author": "BAKEUP",
"website": "https://www.bakeup.org",
"category": "website",
"version": "16.0.1.4.3",
"version": "16.0.1.4.4",
"depends": [
"sale_product_configurator",
"website_sale",

View file

@ -73,6 +73,16 @@ class WebsiteSale(WebsiteSale):
new_values["packaging_info"] = packaging_info
return new_values
def _get_search_order(self, post):
# is_published is company_dependent and has no DB column, so it cannot
# be used in ORDER BY. The shop domain already filters published products,
# so dropping it from the sort has no visible effect for visitors.
order = (
post.get("order")
or request.env["website"].get_current_website().shop_default_sort
)
return "%s, id desc" % order
def _get_search_options(
self,
category=None,

View file

@ -8,7 +8,7 @@ class ProductTemplate(models.Model):
copy=False,
default=lambda self: self._default_is_published(),
index=True,
company_dependent=True,
company_dependent=True, # added
)
def action_publish_on_website(self):

View file

@ -10,4 +10,5 @@
:1.4.0: Add credit warning and avoid debts option
:1.4.1: Add credit to portal details
:1.4.2: Catch unescaped float values
:1.4.3: Drop session if SO belongs to another website (Odoo 16 bug)
:1.4.3: Drop session if SO belongs to another website (Odoo 16 bug)
:1.4.3: Remove is_published filtering and use job manager only on more than one

View file

@ -427,6 +427,8 @@ adjustes the uom quantitiy</li>
</tr>
<tr class="field"><th class="field-name">1.4.3:</th><td class="field-body">Drop session if SO belongs to another website (Odoo 16 bug)</td>
</tr>
<tr class="field"><th class="field-name">1.4.3:</th><td class="field-body">Remove is_published filtering and use job manager only on more than one</td>
</tr>
</tbody>
</table>
</div>