Skip to content
Snippets Groups Projects
Commit b6305b72 authored by Raphael Collet's avatar Raphael Collet
Browse files

[IMP] pos_cache: use JSON instead of pickle for the cache format

parent 9bd3240b
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import base64
import json
from ast import literal_eval
from odoo import models, fields, api
from odoo.tools import pickle as cPickle
class pos_cache(models.Model):
......@@ -29,7 +29,7 @@ class pos_cache(models.Model):
prod_ctx = prod_ctx.sudo(self.compute_user_id.id)
res = prod_ctx.read(self.get_product_fields())
datas = {
'cache': base64.encodestring(cPickle.dumps(res)),
'cache': base64.encodestring(json.dumps(res)),
}
self.write(datas)
......@@ -49,8 +49,7 @@ class pos_cache(models.Model):
self.product_fields = str(fields)
self.refresh_cache()
cache = base64.decodestring(self.cache)
return cPickle.loads(cache)
return json.loads(base64.decodestring(self.cache))
class pos_config(models.Model):
......
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