[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" _inherit = "product.template"
def action_sync_datanature_information(self): def action_sync_datanature_information(self):
for product in self: if len(self) == 1:
product.with_delay()._sync_dn_information() self._sync_dn_information()
else:
for product in self:
product.with_delay()._sync_dn_information()
def _get_dn_metadata(self): def _get_dn_metadata(self):
self.ensure_one() self.ensure_one()
@ -44,6 +47,10 @@ class ProductTemplate(models.Model):
if category and category not in self.public_categ_ids: if category and category not in self.public_categ_ids:
self.public_categ_ids = [(4, category.id)] 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): def _sync_dn_images(self, metadata):
images = metadata.get("images") images = metadata.get("images")
if not images: if not images:

View file

@ -55,6 +55,7 @@ Changelog
:1.4.1: Add credit to portal details :1.4.1: Add credit to portal details
:1.4.2: Catch unescaped float values :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
Bug Tracker Bug Tracker
=========== ===========

View file

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

View file

@ -73,6 +73,16 @@ class WebsiteSale(WebsiteSale):
new_values["packaging_info"] = packaging_info new_values["packaging_info"] = packaging_info
return new_values 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( def _get_search_options(
self, self,
category=None, category=None,

View file

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

View file

@ -10,4 +10,5 @@
:1.4.0: Add credit warning and avoid debts option :1.4.0: Add credit warning and avoid debts option
:1.4.1: Add credit to portal details :1.4.1: Add credit to portal details
:1.4.2: Catch unescaped float values :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>
<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 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>
<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> </tbody>
</table> </table>
</div> </div>