From 7d55ad17b277f1f8327c67e045f1faeab70b2640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20G=C3=B6ttsch?= Date: Fri, 22 May 2026 11:26:28 +0200 Subject: [PATCH] [IMP] nfu_ecommerce: Remove is_published filtering and use job manager only on more than one --- data_nature_importer/models/product_template.py | 11 +++++++++-- nfu_ecommerce/README.rst | 1 + nfu_ecommerce/__manifest__.py | 2 +- nfu_ecommerce/controllers/main.py | 10 ++++++++++ nfu_ecommerce/models/product_template.py | 2 +- nfu_ecommerce/readme/HISTORY.rst | 3 ++- nfu_ecommerce/static/description/index.html | 2 ++ 7 files changed, 26 insertions(+), 5 deletions(-) diff --git a/data_nature_importer/models/product_template.py b/data_nature_importer/models/product_template.py index 0ef3ec3..71978e4 100644 --- a/data_nature_importer/models/product_template.py +++ b/data_nature_importer/models/product_template.py @@ -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: diff --git a/nfu_ecommerce/README.rst b/nfu_ecommerce/README.rst index 229bd2d..b57a599 100644 --- a/nfu_ecommerce/README.rst +++ b/nfu_ecommerce/README.rst @@ -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 =========== diff --git a/nfu_ecommerce/__manifest__.py b/nfu_ecommerce/__manifest__.py index f761d29..29903fb 100644 --- a/nfu_ecommerce/__manifest__.py +++ b/nfu_ecommerce/__manifest__.py @@ -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", diff --git a/nfu_ecommerce/controllers/main.py b/nfu_ecommerce/controllers/main.py index a2818c4..10abf6e 100644 --- a/nfu_ecommerce/controllers/main.py +++ b/nfu_ecommerce/controllers/main.py @@ -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, diff --git a/nfu_ecommerce/models/product_template.py b/nfu_ecommerce/models/product_template.py index 239d45c..52c0789 100644 --- a/nfu_ecommerce/models/product_template.py +++ b/nfu_ecommerce/models/product_template.py @@ -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): diff --git a/nfu_ecommerce/readme/HISTORY.rst b/nfu_ecommerce/readme/HISTORY.rst index f653eaf..1554922 100644 --- a/nfu_ecommerce/readme/HISTORY.rst +++ b/nfu_ecommerce/readme/HISTORY.rst @@ -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) \ No newline at end of file +: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 \ No newline at end of file diff --git a/nfu_ecommerce/static/description/index.html b/nfu_ecommerce/static/description/index.html index 9768a5e..406a132 100644 --- a/nfu_ecommerce/static/description/index.html +++ b/nfu_ecommerce/static/description/index.html @@ -427,6 +427,8 @@ adjustes the uom quantitiy 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 +