[ADD] report_carbone, jsonifier, export_json : carbone is an alternative to Py3o
This commit is contained in:
1
export_json/models/__init__.py
Normal file
1
export_json/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import file_json
|
||||
20
export_json/models/file_json.py
Normal file
20
export_json/models/file_json.py
Normal file
@@ -0,0 +1,20 @@
|
||||
import json
|
||||
|
||||
from odoo import models
|
||||
|
||||
from odoo.addons.base_import import models as model_import
|
||||
|
||||
model_import.base_import.FILE_TYPE_DICT["application/json"] = ("json", True, None)
|
||||
model_import.base_import.EXTENSIONS[".json"] = True
|
||||
|
||||
|
||||
class BaseImportJSON(models.TransientModel):
|
||||
_inherit = "base_import.import"
|
||||
|
||||
def _read_json(self, record, options):
|
||||
items = json.loads(record.file)
|
||||
if items:
|
||||
headers = items[0].keys()
|
||||
yield headers
|
||||
for item in items:
|
||||
yield [item[header] for header in headers]
|
||||
Reference in New Issue
Block a user