Skip to content

Commit

Permalink
Merge PR #801 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Jul 3, 2023
2 parents 9ea5486 + 3cc53e5 commit ddda4c1
Show file tree
Hide file tree
Showing 10 changed files with 564 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup/website_sale_wishlist_archive_cron/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
79 changes: 79 additions & 0 deletions website_sale_wishlist_archive_cron/README.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/OCA/e-commerce/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 <https://github.com/OCA/e-commerce/issues/new?body=module:%20website_sale_wishlist_archive_cron%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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 <https://github.com/OCA/e-commerce/tree/15.0/website_sale_wishlist_archive_cron>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions website_sale_wishlist_archive_cron/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
13 changes: 13 additions & 0 deletions website_sale_wishlist_archive_cron/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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,
}
14 changes: 14 additions & 0 deletions website_sale_wishlist_archive_cron/data/cron_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding='UTF-8' ?>
<odoo noupdate="1">
<record model="ir.cron" id="ir_cron_action_archive_wishlist">
<field name="name">Website Wishlist: Archive inactive product records
</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="state">code</field>
<field name="code">model._process_wishlist_archive()</field>
<field name="doall" eval="False" />
<field name="model_id" ref="model_product_wishlist" />
</record>
</odoo>
1 change: 1 addition & 0 deletions website_sale_wishlist_archive_cron/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import product_wishlist
16 changes: 16 additions & 0 deletions website_sale_wishlist_archive_cron/models/product_wishlist.py
Original file line number Diff line number Diff line change
@@ -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})
12 changes: 12 additions & 0 deletions website_sale_wishlist_archive_cron/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -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.
Loading

0 comments on commit ddda4c1

Please sign in to comment.