Skip to content

Commit 0330c45

Browse files
lasleypedrobaeza
authored andcommitted
[MIG] base_export_manager: Upgrade to v9
* Upgrade base_export_manager to v9 * Rename JS to base_export_manager
1 parent a297aa6 commit 0330c45

12 files changed

+55
-138
lines changed

base_export_manager/README.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ To use one of those profiles, you need to:
4343

4444
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
4545
:alt: Try me on Runbot
46-
:target: https://runbot.odoo-community.org/runbot/149/8.0
46+
:target: https://runbot.odoo-community.org/runbot/149/9.0
4747

4848
Known issues / Roadmap
4949
======================
@@ -69,6 +69,7 @@ Contributors
6969
* Javier Iniesta <javieria@antiun.com>
7070
* Rafael Blasco <rafabn@antiun.com>
7171
* Jairo Llopis <yajo.sk8@gmail.com>
72+
* Dave Lasley <dave@laslabs.com>
7273

7374
Maintainer
7475
----------

base_export_manager/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# © 2015 Antiun Ingeniería S.L. - Antonio Espinosa
2+
# Copyright 2015 Antiun Ingeniería S.L. - Antonio Espinosa
33
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
44

55
from . import models

base_export_manager/__openerp__.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# -*- coding: utf-8 -*-
2-
# © 2015 Antiun Ingeniería S.L. - Antonio Espinosa
2+
# Copyright 2015 Antiun Ingeniería S.L. - Antonio Espinosa
33
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
44

55
{
66
'name': "Manage model export profiles",
77
'category': 'Personalization',
8-
'version': '8.0.2.0.0',
8+
'version': '9.0.1.0.0',
99
'depends': [
1010
'web',
1111
],
@@ -19,8 +19,10 @@
1919
],
2020
'author': 'Antiun Ingeniería S.L., '
2121
'Tecnativa, '
22+
'LasLabs, '
2223
'Odoo Community Association (OCA)',
2324
'website': 'http://www.antiun.com',
2425
'license': 'AGPL-3',
2526
'installable': True,
27+
'application': False,
2628
}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# © 2015 Antiun Ingeniería S.L. - Antonio Espinosa
2+
# Copyright 2015 Antiun Ingeniería S.L. - Antonio Espinosa
33
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
44

55
from . import ir_exports, ir_exports_line

base_export_manager/models/ir_exports_line.py

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# © 2015 Antiun Ingeniería S.L. - Antonio Espinosa
2+
# Copyright 2015 Antiun Ingeniería S.L. - Antonio Espinosa
33
# Copyright 2015-2016 Jairo Llopis <jairo.llopis@tecnativa.com>
44
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
55

@@ -127,17 +127,18 @@ def _inverse_name(self):
127127
s[s.field_n(num, True)] = self._get_field_id(
128128
model, field_name)
129129

130-
@api.one
130+
@api.multi
131131
@api.constrains("field1_id", "field2_id", "field3_id")
132132
def _check_name(self):
133-
if not self.label:
134-
raise exceptions.ValidationError(
135-
_("Field '%s' does not exist") % self.name)
136-
lines = self.search([('export_id', '=', self.export_id.id),
137-
('name', '=', self.name)])
138-
if len(lines) > 1:
139-
raise exceptions.ValidationError(
140-
_("Field '%s' already exists") % self.name)
133+
for rec_id in self:
134+
if not rec_id.label:
135+
raise exceptions.ValidationError(
136+
_("Field '%s' does not exist") % rec_id.name)
137+
lines = self.search([('export_id', '=', rec_id.export_id.id),
138+
('name', '=', rec_id.name)])
139+
if len(lines) > 1:
140+
raise exceptions.ValidationError(
141+
_("Field '%s' already exists") % rec_id.name)
141142

142143
@api.model
143144
def _install_base_export_manager(self):

base_export_manager/static/description/icon.svg

-79
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* Copyright 2015 Antiun Ingenieria, SL (Madrid, Spain, http://www.antiun.com)
2+
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
*/
4+
5+
odoo.define('base_export_manager.base_export_manager', function(require) {
6+
'use strict';
7+
8+
var DataExport = require('web.DataExport');
9+
10+
DataExport.include({
11+
do_load_export_field: function(field_list) {
12+
var export_node = this.$el.find("#fields_list");
13+
_(field_list).each(function (field) {
14+
export_node.append(new Option(field.label + ' (' + field.name + ')', field.name));
15+
});
16+
},
17+
add_field: function(field_id, string) {
18+
var field_list = this.$el.find('#fields_list');
19+
if (this.$el.find("#fields_list option[value='" + field_id + "']") &&
20+
!this.$el.find("#fields_list option[value='" + field_id + "']").length)
21+
{
22+
field_list.append(new Option(string + ' (' + field_id + ')', field_id));
23+
}
24+
},
25+
});
26+
27+
});

base_export_manager/static/src/js/main.js

-32
This file was deleted.

base_export_manager/tests/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
2-
# © 2015 Antiun Ingeniería S.L. - Javier Iniesta
3-
# © 2015 Antiun Ingeniería S.L. - Jairo Llopis
2+
# Copyright 2015 Antiun Ingeniería S.L. - Javier Iniesta
3+
# Copyright 2015 Antiun Ingeniería S.L. - Jairo Llopis
44
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
55

66
from . import test_ir_exports, test_ir_exports_line

base_export_manager/tests/test_ir_exports_line.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# © 2015 Antiun Ingenieria S.L. - Javier Iniesta
2+
# Copyright 2015 Antiun Ingenieria S.L. - Javier Iniesta
33
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
44

55
from openerp.tests.common import TransactionCase

base_export_manager/views/assets.xml

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<openerp>
3-
<data>
2+
<odoo>
43

54
<!-- Add Javascript -->
65
<template id="assets_backend"
@@ -9,9 +8,8 @@
98
priority="20">
109
<xpath expr="." position="inside">
1110
<script type="text/javascript"
12-
src="/base_export_manager/static/src/js/main.js"/>
11+
src="/base_export_manager/static/src/js/base_export_manager.js"/>
1312
</xpath>
1413
</template>
1514

16-
</data>
17-
</openerp>
15+
</odoo>

base_export_manager/views/ir_exports_view.xml

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
33
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
4-
<openerp>
5-
<data>
4+
5+
<odoo>
66

77
<record id="ir_exports_action" model="ir.actions.act_window">
88
<field name="name">Export Profiles</field>
@@ -81,5 +81,4 @@
8181
</field>
8282
</record>
8383

84-
</data>
85-
</openerp>
84+
</odoo>

0 commit comments

Comments
 (0)