[MIG] base_jsonify: Migration to 14.0
parent
b03b7e6808
commit
5c6520adfa
|
@ -14,13 +14,13 @@ Base Jsonify
|
||||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||||
:alt: License: AGPL-3
|
:alt: License: AGPL-3
|
||||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
|
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
|
||||||
:target: https://github.com/OCA/server-tools/tree/13.0/base_jsonify
|
:target: https://github.com/OCA/server-tools/tree/14.0/base_jsonify
|
||||||
:alt: OCA/server-tools
|
:alt: OCA/server-tools
|
||||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||||
:target: https://translation.odoo-community.org/projects/server-tools-13-0/server-tools-13-0-base_jsonify
|
:target: https://translation.odoo-community.org/projects/server-tools-14-0/server-tools-14-0-base_jsonify
|
||||||
:alt: Translate me on Weblate
|
:alt: Translate me on Weblate
|
||||||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||||
:target: https://runbot.odoo-community.org/runbot/149/13.0
|
:target: https://runbot.odoo-community.org/runbot/149/14.0
|
||||||
:alt: Try me on Runbot
|
:alt: Try me on Runbot
|
||||||
|
|
||||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||||
|
@ -200,7 +200,7 @@ Bug Tracker
|
||||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
|
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
|
||||||
In case of trouble, please check there if your issue has already been reported.
|
In case of trouble, please check there if your issue has already been reported.
|
||||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||||
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20base_jsonify%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20base_jsonify%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||||
|
|
||||||
Do not contact contributors directly about support or help with technical issues.
|
Do not contact contributors directly about support or help with technical issues.
|
||||||
|
|
||||||
|
@ -233,6 +233,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
mission is to support the collaborative development of Odoo features and
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.
|
promote its widespread use.
|
||||||
|
|
||||||
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/13.0/base_jsonify>`_ project on GitHub.
|
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/14.0/base_jsonify>`_ project on GitHub.
|
||||||
|
|
||||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
{
|
{
|
||||||
"name": "Base Jsonify",
|
"name": "Base Jsonify",
|
||||||
"summary": "Base module that provide the jsonify method on all models",
|
"summary": "Base module that provide the jsonify method on all models",
|
||||||
"version": "13.0.3.0.0",
|
"version": "14.0.1.0.0",
|
||||||
"category": "Uncategorized",
|
"category": "Uncategorized",
|
||||||
"website": "https://github.com/OCA/server-tools",
|
"website": "https://github.com/OCA/server-tools",
|
||||||
"author": "Akretion, Odoo Community Association (OCA)",
|
"author": "Akretion, Odoo Community Association (OCA)",
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
|
||||||
|
|
||||||
from openupgradelib import openupgrade
|
|
||||||
|
|
||||||
|
|
||||||
@openupgrade.migrate()
|
|
||||||
def migrate(env, version):
|
|
||||||
openupgrade.rename_columns(env.cr, {"ir_exports_line": [("alias", "target")]})
|
|
|
@ -8,7 +8,7 @@ from odoo import fields, models
|
||||||
from odoo.tools import ormcache
|
from odoo.tools import ormcache
|
||||||
|
|
||||||
|
|
||||||
def partition(l, accessor):
|
def partition(line, accessor):
|
||||||
"""Partition a recordset according to an accessor (e.g. a lambda).
|
"""Partition a recordset according to an accessor (e.g. a lambda).
|
||||||
Returns a dictionary whose keys are the values obtained from accessor,
|
Returns a dictionary whose keys are the values obtained from accessor,
|
||||||
and values are the items that have this value.
|
and values are the items that have this value.
|
||||||
|
@ -16,7 +16,7 @@ def partition(l, accessor):
|
||||||
=> {True: [{"name": "ax"}], False: [{"name": "by"}]}
|
=> {True: [{"name": "ax"}], False: [{"name": "by"}]}
|
||||||
"""
|
"""
|
||||||
result = {}
|
result = {}
|
||||||
for item in l:
|
for item in line:
|
||||||
key = accessor(item)
|
key = accessor(item)
|
||||||
if key not in result:
|
if key not in result:
|
||||||
result[key] = []
|
result[key] = []
|
||||||
|
|
|
@ -17,8 +17,7 @@ help_message = [
|
||||||
|
|
||||||
|
|
||||||
class FieldResolver(models.Model):
|
class FieldResolver(models.Model):
|
||||||
"""Arbitrary function to process a field or a dict at export time.
|
"""Arbitrary function to process a field or a dict at export time."""
|
||||||
"""
|
|
||||||
|
|
||||||
_name = "ir.exports.resolver"
|
_name = "ir.exports.resolver"
|
||||||
_description = "Export Resolver"
|
_description = "Export Resolver"
|
||||||
|
|
|
@ -233,8 +233,7 @@ class TestParser(SavepointCase):
|
||||||
self.assertEqual(json["X"], "X") # added by global resolver
|
self.assertEqual(json["X"], "X") # added by global resolver
|
||||||
|
|
||||||
def test_simple_parser_translations(self):
|
def test_simple_parser_translations(self):
|
||||||
"""The simple parser result should depend on the context language.
|
"""The simple parser result should depend on the context language."""
|
||||||
"""
|
|
||||||
parser = ["name"]
|
parser = ["name"]
|
||||||
json = self.category.jsonify(parser)[0]
|
json = self.category.jsonify(parser)[0]
|
||||||
json_fr = self.category_lang.jsonify(parser)[0]
|
json_fr = self.category_lang.jsonify(parser)[0]
|
||||||
|
@ -243,8 +242,7 @@ class TestParser(SavepointCase):
|
||||||
self.assertEqual(json_fr["name"], self.translated_target)
|
self.assertEqual(json_fr["name"], self.translated_target)
|
||||||
|
|
||||||
def test_simple_star_target_and_field_resolver(self):
|
def test_simple_star_target_and_field_resolver(self):
|
||||||
"""The simple parser result should depend on the context language.
|
"""The simple parser result should depend on the context language."""
|
||||||
"""
|
|
||||||
code = (
|
code = (
|
||||||
"is_number = field_type in ('integer', 'float');"
|
"is_number = field_type in ('integer', 'float');"
|
||||||
"ftype = 'NUMBER' if is_number else 'TEXT';"
|
"ftype = 'NUMBER' if is_number else 'TEXT';"
|
||||||
|
|
|
@ -7,7 +7,7 @@ from odoo.tests.common import TransactionCase
|
||||||
|
|
||||||
class TestIrExportsLine(TransactionCase):
|
class TestIrExportsLine(TransactionCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestIrExportsLine, self).setUp()
|
super().setUp()
|
||||||
self.ir_export = self.env.ref("base_jsonify.ir_exp_partner")
|
self.ir_export = self.env.ref("base_jsonify.ir_exp_partner")
|
||||||
|
|
||||||
def test_target_contrains(self):
|
def test_target_contrains(self):
|
||||||
|
|
Loading…
Reference in New Issue