From 3cc53e55d3cd3b8497de62a41bb95eba5ac4aa7e Mon Sep 17 00:00:00 2001 From: Aungkokolin1997 Date: Thu, 18 May 2023 09:23:47 +0630 Subject: [PATCH] [ADD] website_sale_wishlist_archive_cron --- .../addons/website_sale_wishlist_archive_cron | 1 + .../setup.py | 6 + website_sale_wishlist_archive_cron/README.rst | 79 ++++ .../__init__.py | 1 + .../__manifest__.py | 13 + .../data/cron_data.xml | 14 + .../models/__init__.py | 1 + .../models/product_wishlist.py | 16 + .../readme/DESCRIPTION.rst | 12 + .../static/description/index.html | 421 ++++++++++++++++++ 10 files changed, 564 insertions(+) create mode 120000 setup/website_sale_wishlist_archive_cron/odoo/addons/website_sale_wishlist_archive_cron create mode 100644 setup/website_sale_wishlist_archive_cron/setup.py create mode 100644 website_sale_wishlist_archive_cron/README.rst create mode 100644 website_sale_wishlist_archive_cron/__init__.py create mode 100644 website_sale_wishlist_archive_cron/__manifest__.py create mode 100644 website_sale_wishlist_archive_cron/data/cron_data.xml create mode 100644 website_sale_wishlist_archive_cron/models/__init__.py create mode 100644 website_sale_wishlist_archive_cron/models/product_wishlist.py create mode 100644 website_sale_wishlist_archive_cron/readme/DESCRIPTION.rst create mode 100644 website_sale_wishlist_archive_cron/static/description/index.html diff --git a/setup/website_sale_wishlist_archive_cron/odoo/addons/website_sale_wishlist_archive_cron b/setup/website_sale_wishlist_archive_cron/odoo/addons/website_sale_wishlist_archive_cron new file mode 120000 index 0000000000..8c1e727392 --- /dev/null +++ b/setup/website_sale_wishlist_archive_cron/odoo/addons/website_sale_wishlist_archive_cron @@ -0,0 +1 @@ +../../../../website_sale_wishlist_archive_cron \ No newline at end of file diff --git a/setup/website_sale_wishlist_archive_cron/setup.py b/setup/website_sale_wishlist_archive_cron/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/website_sale_wishlist_archive_cron/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/website_sale_wishlist_archive_cron/README.rst b/website_sale_wishlist_archive_cron/README.rst new file mode 100644 index 0000000000..48400b53f7 --- /dev/null +++ b/website_sale_wishlist_archive_cron/README.rst @@ -0,0 +1,79 @@ +=================================== +Website Sales Wishlist Archive Cron +=================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fe--commerce-lightgray.png?logo=github + :target: https://github.com/OCA/e-commerce/tree/15.0/website_sale_wishlist_archive_cron + :alt: OCA/e-commerce +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/e-commerce-15-0/e-commerce-15-0-website_sale_wishlist_archive_cron + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/113/15.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module introduces a scheduled action record that archives wishlist items associated with +inactive (archived) products. + +Background: + +The default behavior in vanilla Odoo for archived products is as follows: + +* Existing wishlist items for the product remain unaffected (they persist in the wishlist). +* When a customer attempts to add the item to their cart, it vanishes from the wishlist and the cart + remains unchanged. + +This behavior can be confusing and may result in customer dissatisfaction. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Quartile Limited + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/e-commerce `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/website_sale_wishlist_archive_cron/__init__.py b/website_sale_wishlist_archive_cron/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/website_sale_wishlist_archive_cron/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/website_sale_wishlist_archive_cron/__manifest__.py b/website_sale_wishlist_archive_cron/__manifest__.py new file mode 100644 index 0000000000..d013544b76 --- /dev/null +++ b/website_sale_wishlist_archive_cron/__manifest__.py @@ -0,0 +1,13 @@ +# Copyright 2023 Quartile Limited +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + "name": "Website Sales Wishlist Archive Cron", + "version": "15.0.1.0.0", + "author": "Quartile Limited, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/e-commerce", + "category": "Website", + "license": "AGPL-3", + "depends": ["website_sale_wishlist"], + "data": ["data/cron_data.xml"], + "installable": True, +} diff --git a/website_sale_wishlist_archive_cron/data/cron_data.xml b/website_sale_wishlist_archive_cron/data/cron_data.xml new file mode 100644 index 0000000000..55d82244ea --- /dev/null +++ b/website_sale_wishlist_archive_cron/data/cron_data.xml @@ -0,0 +1,14 @@ + + + + Website Wishlist: Archive inactive product records + + 1 + days + -1 + code + model._process_wishlist_archive() + + + + diff --git a/website_sale_wishlist_archive_cron/models/__init__.py b/website_sale_wishlist_archive_cron/models/__init__.py new file mode 100644 index 0000000000..b6df711865 --- /dev/null +++ b/website_sale_wishlist_archive_cron/models/__init__.py @@ -0,0 +1 @@ +from . import product_wishlist diff --git a/website_sale_wishlist_archive_cron/models/product_wishlist.py b/website_sale_wishlist_archive_cron/models/product_wishlist.py new file mode 100644 index 0000000000..040d516373 --- /dev/null +++ b/website_sale_wishlist_archive_cron/models/product_wishlist.py @@ -0,0 +1,16 @@ +# Copyright 2023 Quartile Limited +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, models + + +class ProductWishlist(models.Model): + _inherit = "product.wishlist" + + @api.model + def _process_wishlist_archive(self): + wishlist_records = self.search([("active", "=", True)]) + wishlist_records_to_archive = wishlist_records.filtered( + lambda x: not x.product_id.active + ) + wishlist_records_to_archive.write({"active": False}) diff --git a/website_sale_wishlist_archive_cron/readme/DESCRIPTION.rst b/website_sale_wishlist_archive_cron/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..759e71292e --- /dev/null +++ b/website_sale_wishlist_archive_cron/readme/DESCRIPTION.rst @@ -0,0 +1,12 @@ +This module introduces a scheduled action record that archives wishlist items associated with +inactive (archived) products. + +Background: + +The default behavior in vanilla Odoo for archived products is as follows: + +* Existing wishlist items for the product remain unaffected (they persist in the wishlist). +* When a customer attempts to add the item to their cart, it vanishes from the wishlist and the cart + remains unchanged. + +This behavior can be confusing and may result in customer dissatisfaction. diff --git a/website_sale_wishlist_archive_cron/static/description/index.html b/website_sale_wishlist_archive_cron/static/description/index.html new file mode 100644 index 0000000000..d3fdc1e2e5 --- /dev/null +++ b/website_sale_wishlist_archive_cron/static/description/index.html @@ -0,0 +1,421 @@ + + + + + + +Website Sales Wishlist Archive Cron + + + +
+

Website Sales Wishlist Archive Cron

+ + +

Beta License: AGPL-3 OCA/e-commerce Translate me on Weblate Try me on Runbot

+

This module introduces a scheduled action record that archives wishlist items associated with +inactive (archived) products.

+

Background:

+

The default behavior in vanilla Odoo for archived products is as follows:

+
    +
  • Existing wishlist items for the product remain unaffected (they persist in the wishlist).
  • +
  • When a customer attempts to add the item to their cart, it vanishes from the wishlist and the cart +remains unchanged.
  • +
+

This behavior can be confusing and may result in customer dissatisfaction.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Quartile Limited
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/e-commerce project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ +