Skip to content
Snippets Groups Projects
Commit 41a82c33 authored by Mylyna Hy's avatar Mylyna Hy
Browse files

[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#114620

Signed-off-by: default avatarTrinh Jacky (trj) <trj@odoo.com>
parent dbb0b743
No related branches found
No related tags found
No related merge requests found
......@@ -113,12 +113,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 = ""
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment