mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-20 18:12:04 +02:00
19.0 vanilla
This commit is contained in:
parent
d1963a3c3a
commit
2d3ee4855a
7430 changed files with 2687981 additions and 2965473 deletions
|
|
@ -6,7 +6,7 @@ import typing
|
|||
|
||||
from psycopg2.extras import Json as PsycopgJson
|
||||
|
||||
from odoo.tools import SQL
|
||||
from odoo.tools import SQL, json_default
|
||||
|
||||
from .fields import Field
|
||||
from .identifiers import IdType
|
||||
|
|
@ -54,8 +54,8 @@ class Boolean(Field[bool]):
|
|||
|
||||
class Json(Field):
|
||||
""" JSON Field that contain unstructured information in jsonb PostgreSQL column.
|
||||
This field is still in beta
|
||||
Some features have not been implemented and won't be implemented in stable versions, including:
|
||||
|
||||
Some features won't be implemented, including:
|
||||
* searching
|
||||
* indexing
|
||||
* mutating the values.
|
||||
|
|
@ -71,10 +71,12 @@ class Json(Field):
|
|||
def convert_to_cache(self, value, record, validate=True):
|
||||
if not value:
|
||||
return None
|
||||
return json.loads(json.dumps(value))
|
||||
return json.loads(json.dumps(value, ensure_ascii=False, default=json_default))
|
||||
|
||||
def convert_to_column(self, value, record, values=None, validate=True):
|
||||
if not value:
|
||||
if validate:
|
||||
value = self.convert_to_cache(value, record)
|
||||
if value is None:
|
||||
return None
|
||||
return PsycopgJson(value)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue