REName base_sparse_field to base_sparse_field_list_support with only monkey patch

pull/2533/head
David Beal 2017-10-02 14:08:23 +02:00 committed by hda
parent 5ca1105b11
commit 0016f9cf72
4 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,2 @@
# coding: utf-8
from . import models

View File

@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
{
"name": "Base Sparse Field List Support",
"summary": "add list support to convert_to_cache()",
"version": "8.0.1.0.0",
'category': 'Technical Settings',
"website": "www.akretion.com",
"author": " Akretion",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"base",
],
}

View File

@ -0,0 +1,2 @@
# coding: utf-8
from . import fields

View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
import json
from odoo import fields
#
# Definition and implementation of serialized fields: override
#
def convert_to_cache(self, value, record, validate=True):
# cache format: dict / list
value = value or {}
return value if isinstance(value, (dict, list)) else json.loads(value)
fields.Serialized.convert_to_cache = convert_to_cache