From 40ceac7bf4e3003f7f26ec39a31c93db39ec7d22 Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (ACSONE)" Date: Mon, 9 Sep 2019 17:09:45 +0200 Subject: [PATCH] [FIX]base_jsonify: Preserve initial order on ir.export.line We can't change the order on ir.export.line since it's used to preserve the order speicifed by the user when creating a export filter into the UI --- base_jsonify/models/ir_exports_line.py | 1 - base_jsonify/tests/test_get_parser.py | 26 ++++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/base_jsonify/models/ir_exports_line.py b/base_jsonify/models/ir_exports_line.py index 3d4b047ca..a49cabb7a 100644 --- a/base_jsonify/models/ir_exports_line.py +++ b/base_jsonify/models/ir_exports_line.py @@ -8,7 +8,6 @@ from odoo import api, fields, models, _ class IrExportsLine(models.Model): _inherit = 'ir.exports.line' - _order = 'name' alias = fields.Char( 'Alias', diff --git a/base_jsonify/tests/test_get_parser.py b/base_jsonify/tests/test_get_parser.py index 2527d7be0..ca8e1740d 100644 --- a/base_jsonify/tests/test_get_parser.py +++ b/base_jsonify/tests/test_get_parser.py @@ -9,30 +9,32 @@ class TestParser(TransactionCase): def test_getting_parser(self): expected_parser = [ + u'name', u'active', + u'credit_limit', + u'color', (u'category_id', [u'name']), - (u'child_ids', [( - u'child_ids', [u'name']), - (u'country_id', [u'code', u'name']), - u'email', u'id', - u'name' + (u'country_id', [u'name', u'code']), + (u'child_ids', [ + u'name', + u'id', + u'email', + (u'country_id', [u'name', u'code']), + (u'child_ids', [u'name']), ]), - u'color', - u'comment', - (u'country_id', [u'code', u'name']), - u'credit_limit', u'lang', - u'name'] + u'comment' + ] exporter = self.env.ref('base_jsonify.ir_exp_partner') parser = exporter.get_json_parser() - self.assertEqual(parser, expected_parser) + self.assertListEqual(parser, expected_parser) # modify an ir.exports_line to put an alias for a field self.env.ref('base_jsonify.category_id_name').write({ 'alias': 'category_id:category/name' }) - expected_parser[1] = (u'category_id:category', [u'name']) + expected_parser[4] = (u'category_id:category', [u'name']) parser = exporter.get_json_parser() self.assertEqual(parser, expected_parser)