From b4ef5152ddafd4246c740a7136f94849fe2b4cc3 Mon Sep 17 00:00:00 2001 From: Lorenzo Romero Date: Mon, 8 Jul 2024 11:58:44 +0200 Subject: [PATCH] Added check for payment_transaction entry to Customer filter in abandoned_carts --- abandoned_carts/README.rst | 4 ++-- abandoned_carts/readme/DESCRIPTION.rst | 2 +- abandoned_carts/static/description/index.html | 4 ++-- abandoned_carts/wizard/customer.py | 3 +++ payment_bitcoin/models/bitcoin.py | 4 ++-- payment_bitcoin/static/src/js/bitcoin.js | 4 ++++ payment_bitcoin/static/src/js/countdown.js | 2 ++ 7 files changed, 16 insertions(+), 7 deletions(-) diff --git a/abandoned_carts/README.rst b/abandoned_carts/README.rst index f218c298..ab4f3600 100644 --- a/abandoned_carts/README.rst +++ b/abandoned_carts/README.rst @@ -7,7 +7,7 @@ Abandoned Carts !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:36086800288d4ccd5baaf3ede4a2092f0189410265752e244f869ab966c41b6e + !! source digest: sha256:b2bb1241a503d410a6cd3968a08bfd8862738faaa20fb4bc813277877c2afa0d !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -48,7 +48,7 @@ This module identifies orders as abandoned (and to be deleted) if all of the fol These orders will be displayed in "Abandoned orders" and can be deleted manually. Customers, which have -`"lead = 0" and "meetings = 0" and "is_employee = false" and "helpdesk_tickets = 0" and "newsletter_subscriptions = 0" and "phonecalls = 0" and "orders = 0" and "account moves = 0" and "tasks = 0" and "portal or user account = 0" and "parent_id = NULL" and "is_company = false" and "create_uid = system_user"` +`"lead = 0" and "meetings = 0" and "is_employee = false" and "helpdesk_tickets = 0" and "newsletter_subscriptions = 0" and "phonecalls = 0" and "orders = 0" and "account moves = 0" and "tasks = 0" and "portal or user account = 0" and "parent_id = NULL" and "is_company = false" and "create_uid = system_user" and "payment_transaction = 0"` will be displayed in "Abandoned customers" and can be deleted manually. diff --git a/abandoned_carts/readme/DESCRIPTION.rst b/abandoned_carts/readme/DESCRIPTION.rst index 46affa95..8fd432da 100644 --- a/abandoned_carts/readme/DESCRIPTION.rst +++ b/abandoned_carts/readme/DESCRIPTION.rst @@ -18,7 +18,7 @@ This module identifies orders as abandoned (and to be deleted) if all of the fol These orders will be displayed in "Abandoned orders" and can be deleted manually. Customers, which have -`"lead = 0" and "meetings = 0" and "is_employee = false" and "helpdesk_tickets = 0" and "newsletter_subscriptions = 0" and "phonecalls = 0" and "orders = 0" and "account moves = 0" and "tasks = 0" and "portal or user account = 0" and "parent_id = NULL" and "is_company = false" and "create_uid = system_user"` +`"lead = 0" and "meetings = 0" and "is_employee = false" and "helpdesk_tickets = 0" and "newsletter_subscriptions = 0" and "phonecalls = 0" and "orders = 0" and "account moves = 0" and "tasks = 0" and "portal or user account = 0" and "parent_id = NULL" and "is_company = false" and "create_uid = system_user" and "payment_transaction = 0"` will be displayed in "Abandoned customers" and can be deleted manually. diff --git a/abandoned_carts/static/description/index.html b/abandoned_carts/static/description/index.html index a02a26b7..47361372 100644 --- a/abandoned_carts/static/description/index.html +++ b/abandoned_carts/static/description/index.html @@ -367,7 +367,7 @@

Abandoned Carts

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:36086800288d4ccd5baaf3ede4a2092f0189410265752e244f869ab966c41b6e +!! source digest: sha256:b2bb1241a503d410a6cd3968a08bfd8862738faaa20fb4bc813277877c2afa0d !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/odoo-modules Translate me on Weblate Try me on Runboat

This module allows to delete Quotations and related partner records when those are older than a definable retention period.

@@ -383,7 +383,7 @@

Algorithm

(“state = draft” or “state = sent”) and “website_id is set” and “(current_time - create_date) < abandoned_carts.order_retention_period” and “create_uid = system_user”

These orders will be displayed in “Abandoned orders” and can be deleted manually.

Customers, which have -“lead = 0” and “meetings = 0” and “is_employee = false” and “helpdesk_tickets = 0” and “newsletter_subscriptions = 0” and “phonecalls = 0” and “orders = 0” and “account moves = 0” and “tasks = 0” and “portal or user account = 0” and “parent_id = NULL” and “is_company = false” and “create_uid = system_user”

+“lead = 0” and “meetings = 0” and “is_employee = false” and “helpdesk_tickets = 0” and “newsletter_subscriptions = 0” and “phonecalls = 0” and “orders = 0” and “account moves = 0” and “tasks = 0” and “portal or user account = 0” and “parent_id = NULL” and “is_company = false” and “create_uid = system_user” and “payment_transaction = 0”

will be displayed in “Abandoned customers” and can be deleted manually.

Child partner records (e.g. delivery addresses) of deleted records will remain and don’t get deleted implicitly. However, in subsequent executions they may fulfill all criteria and get deleted too.

A cron job can be configured to delete abandoned orders and abandoned customers automatically.

diff --git a/abandoned_carts/wizard/customer.py b/abandoned_carts/wizard/customer.py index 3c853581..23fcabb2 100644 --- a/abandoned_carts/wizard/customer.py +++ b/abandoned_carts/wizard/customer.py @@ -98,6 +98,9 @@ def set_fix_customer(self): where gid = (select id from res_groups where id=%s) and uid=ru.id ) and + NOT EXISTS ( + SELECT 1 FROM payment_transaction pt WHERE pt.partner_id = p.id + ) and p.parent_id is NULL and p.is_company = False and p.customer_rank > 0 and diff --git a/payment_bitcoin/models/bitcoin.py b/payment_bitcoin/models/bitcoin.py index 62c98592..578a3292 100644 --- a/payment_bitcoin/models/bitcoin.py +++ b/payment_bitcoin/models/bitcoin.py @@ -180,7 +180,7 @@ def cnvrt_list_to_string(self, ldata): return ", ".join([str(data) for data in ldata]) @api.model - def cron_bitcoin_payment_reconciliation(self): + def cron_bitcoin_payment_reconciliation(self): # noqa: C901 acquirer_obj = self.env["payment.acquirer"].search( [("provider", "=", "bitcoin")] ) @@ -437,7 +437,7 @@ class BitcoinRate(models.Model): ) @api.model - def get_rate( + def get_rate( # noqa: C901 self, order_id=False, order_ref=False, invoice_id=False, invoice_ref=False ): # function returns bitcoin rate and address for the order currency diff --git a/payment_bitcoin/static/src/js/bitcoin.js b/payment_bitcoin/static/src/js/bitcoin.js index ae1d4558..94483fc3 100644 --- a/payment_bitcoin/static/src/js/bitcoin.js +++ b/payment_bitcoin/static/src/js/bitcoin.js @@ -1,4 +1,6 @@ odoo.define("payment_bitcoin.bitcoin", function (require) { + "use strict"; + var ajax = require("web.ajax"); var core = require("web.core"); var _t = core._t; @@ -25,7 +27,9 @@ odoo.define("payment_bitcoin.bitcoin", function (require) { order_ref: $order_ref, }).then(function (data) { if (data === false) { + /* eslint-disable no-alert */ alert(_t("Payment method Bitcoin is currently unavailable.")); + /* eslint-enable no-alert */ $(ev.currentTarget) .find('input[name="o_payment_radio"]') .attr("disabled", "disabled"); diff --git a/payment_bitcoin/static/src/js/countdown.js b/payment_bitcoin/static/src/js/countdown.js index 3010fb57..5c42590d 100644 --- a/payment_bitcoin/static/src/js/countdown.js +++ b/payment_bitcoin/static/src/js/countdown.js @@ -1,4 +1,6 @@ odoo.define("payment_bitcoin.duration", function (require) { + "use strict"; + var publicWidget = require("web.public.widget"); publicWidget.registry.reloadDuration = publicWidget.Widget.extend({