From 0ce547db68d2ec4ac8379f9facd5391eb09536a9 Mon Sep 17 00:00:00 2001 From: Mylyna Hy Date: Tue, 7 Mar 2023 17:34:06 +0000 Subject: [PATCH] [FIX] pos_mercury: remove _gc_old_tokens Problem: When point_of_sale and pos_mercury are both installed, _gc_old_tokens will get called by the scheduled action "Base: Auto vacuum internal data" and it will try to remove the Vantiv tokens from POS orders that are 6+ months old. However, there are fields named ref_no and record_no that exists for pos.order; so the AttributeError will get thrown. Solution: It is safe to remove the entire method since the Mercury API documentation does not explicitly mandate the tokens be removed from old POS orders. It was recommended by JOV to not modify the method to prevent the modification of potentially 8 years old POS orders from client's databases. Since the method is removed, the error will not be thrown when auto vacuum is called, pos_mercury is installed, and POS orders are 6+ months older. opw-3082616 closes odoo/odoo#115466 X-original-commit: 41a82c3326150fba6948667c9e455ae82088bb6d Signed-off-by: Trinh Jacky (trj) --- addons/pos_mercury/models/pos_mercury_transaction.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/addons/pos_mercury/models/pos_mercury_transaction.py b/addons/pos_mercury/models/pos_mercury_transaction.py index ed85a5460e1..d6a14404158 100644 --- a/addons/pos_mercury/models/pos_mercury_transaction.py +++ b/addons/pos_mercury/models/pos_mercury_transaction.py @@ -119,12 +119,3 @@ class MercuryTransaction(models.Model): response = self._do_request('pos_mercury.mercury_return', data) return response - # One time (the ones we use) Vantiv tokens are required to be - # deleted after 6 months - @api.autovacuum - def _gc_old_tokens(self): - expired_creation_date = (date.today() - timedelta(days=6 * 30)).strftime(DEFAULT_SERVER_DATETIME_FORMAT) - - for order in self.env['pos.order'].search([('create_date', '<', expired_creation_date)]): - order.ref_no = "" - order.record_no = ""