Browse Source

[MIG] base_export_manager: Upgrade to v9

* Upgrade base_export_manager to v9
* Rename JS to base_export_manager
pull/505/head
Dave Lasley 8 years ago
committed by Pedro M. Baeza
parent
commit
0330c45771
  1. 3
      base_export_manager/README.rst
  2. 2
      base_export_manager/__init__.py
  3. 6
      base_export_manager/__openerp__.py
  4. 2
      base_export_manager/models/__init__.py
  5. 21
      base_export_manager/models/ir_exports_line.py
  6. 79
      base_export_manager/static/description/icon.svg
  7. 27
      base_export_manager/static/src/js/base_export_manager.js
  8. 32
      base_export_manager/static/src/js/main.js
  9. 4
      base_export_manager/tests/__init__.py
  10. 2
      base_export_manager/tests/test_ir_exports_line.py
  11. 8
      base_export_manager/views/assets.xml
  12. 7
      base_export_manager/views/ir_exports_view.xml

3
base_export_manager/README.rst

@ -43,7 +43,7 @@ To use one of those profiles, you need to:
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot :alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/8.0
:target: https://runbot.odoo-community.org/runbot/149/9.0
Known issues / Roadmap Known issues / Roadmap
====================== ======================
@ -69,6 +69,7 @@ Contributors
* Javier Iniesta <javieria@antiun.com> * Javier Iniesta <javieria@antiun.com>
* Rafael Blasco <rafabn@antiun.com> * Rafael Blasco <rafabn@antiun.com>
* Jairo Llopis <yajo.sk8@gmail.com> * Jairo Llopis <yajo.sk8@gmail.com>
* Dave Lasley <dave@laslabs.com>
Maintainer Maintainer
---------- ----------

2
base_export_manager/__init__.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2015 Antiun Ingeniería S.L. - Antonio Espinosa
# Copyright 2015 Antiun Ingeniería S.L. - Antonio Espinosa
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models from . import models

6
base_export_manager/__openerp__.py

@ -1,11 +1,11 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2015 Antiun Ingeniería S.L. - Antonio Espinosa
# Copyright 2015 Antiun Ingeniería S.L. - Antonio Espinosa
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{ {
'name': "Manage model export profiles", 'name': "Manage model export profiles",
'category': 'Personalization', 'category': 'Personalization',
'version': '8.0.2.0.0',
'version': '9.0.1.0.0',
'depends': [ 'depends': [
'web', 'web',
], ],
@ -19,8 +19,10 @@
], ],
'author': 'Antiun Ingeniería S.L., ' 'author': 'Antiun Ingeniería S.L., '
'Tecnativa, ' 'Tecnativa, '
'LasLabs, '
'Odoo Community Association (OCA)', 'Odoo Community Association (OCA)',
'website': 'http://www.antiun.com', 'website': 'http://www.antiun.com',
'license': 'AGPL-3', 'license': 'AGPL-3',
'installable': True, 'installable': True,
'application': False,
} }

2
base_export_manager/models/__init__.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2015 Antiun Ingeniería S.L. - Antonio Espinosa
# Copyright 2015 Antiun Ingeniería S.L. - Antonio Espinosa
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import ir_exports, ir_exports_line from . import ir_exports, ir_exports_line

21
base_export_manager/models/ir_exports_line.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2015 Antiun Ingeniería S.L. - Antonio Espinosa
# Copyright 2015 Antiun Ingeniería S.L. - Antonio Espinosa
# Copyright 2015-2016 Jairo Llopis <jairo.llopis@tecnativa.com> # Copyright 2015-2016 Jairo Llopis <jairo.llopis@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
@ -127,17 +127,18 @@ class IrExportsLine(models.Model):
s[s.field_n(num, True)] = self._get_field_id( s[s.field_n(num, True)] = self._get_field_id(
model, field_name) model, field_name)
@api.one
@api.multi
@api.constrains("field1_id", "field2_id", "field3_id") @api.constrains("field1_id", "field2_id", "field3_id")
def _check_name(self): def _check_name(self):
if not self.label:
raise exceptions.ValidationError(
_("Field '%s' does not exist") % self.name)
lines = self.search([('export_id', '=', self.export_id.id),
('name', '=', self.name)])
if len(lines) > 1:
raise exceptions.ValidationError(
_("Field '%s' already exists") % self.name)
for rec_id in self:
if not rec_id.label:
raise exceptions.ValidationError(
_("Field '%s' does not exist") % rec_id.name)
lines = self.search([('export_id', '=', rec_id.export_id.id),
('name', '=', rec_id.name)])
if len(lines) > 1:
raise exceptions.ValidationError(
_("Field '%s' already exists") % rec_id.name)
@api.model @api.model
def _install_base_export_manager(self): def _install_base_export_manager(self):

79
base_export_manager/static/description/icon.svg
File diff suppressed because it is too large
View File

27
base_export_manager/static/src/js/base_export_manager.js

@ -0,0 +1,27 @@
/* Copyright 2015 Antiun Ingenieria, SL (Madrid, Spain, http://www.antiun.com)
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
*/
odoo.define('base_export_manager.base_export_manager', function(require) {
'use strict';
var DataExport = require('web.DataExport');
DataExport.include({
do_load_export_field: function(field_list) {
var export_node = this.$el.find("#fields_list");
_(field_list).each(function (field) {
export_node.append(new Option(field.label + ' (' + field.name + ')', field.name));
});
},
add_field: function(field_id, string) {
var field_list = this.$el.find('#fields_list');
if (this.$el.find("#fields_list option[value='" + field_id + "']") &&
!this.$el.find("#fields_list option[value='" + field_id + "']").length)
{
field_list.append(new Option(string + ' (' + field_id + ')', field_id));
}
},
});
});

32
base_export_manager/static/src/js/main.js

@ -1,32 +0,0 @@
/* © 2015 Antiun Ingeniería S.L. - Antonio Espinosa
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). */
// Check jQuery available
if (typeof jQuery === 'undefined') { throw new Error('Requires jQuery') }
+function ($) {
'use strict';
openerp.base_exports_manager = function(instance, local) {
var _t = instance.web._t,
_lt = instance.web._lt;
var QWeb = instance.web.qweb;
instance.web.DataExport.include({
do_load_export_field: function(field_list) {
var export_node = this.$el.find("#fields_list");
_(field_list).each(function (field) {
export_node.append(new Option(field.label + ' (' + field.name + ')', field.name));
});
},
add_field: function(field_id, string) {
var field_list = this.$el.find('#fields_list');
if (this.$el.find("#fields_list option[value='" + field_id + "']")
&& !this.$el.find("#fields_list option[value='" + field_id + "']").length) {
field_list.append(new Option(string + ' (' + field_id + ')', field_id));
}
},
});
}
}(jQuery);

4
base_export_manager/tests/__init__.py

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2015 Antiun Ingeniería S.L. - Javier Iniesta
# © 2015 Antiun Ingeniería S.L. - Jairo Llopis
# Copyright 2015 Antiun Ingeniería S.L. - Javier Iniesta
# Copyright 2015 Antiun Ingeniería S.L. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import test_ir_exports, test_ir_exports_line from . import test_ir_exports, test_ir_exports_line

2
base_export_manager/tests/test_ir_exports_line.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2015 Antiun Ingenieria S.L. - Javier Iniesta
# Copyright 2015 Antiun Ingenieria S.L. - Javier Iniesta
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.tests.common import TransactionCase from openerp.tests.common import TransactionCase

8
base_export_manager/views/assets.xml

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<odoo>
<!-- Add Javascript --> <!-- Add Javascript -->
<template id="assets_backend" <template id="assets_backend"
@ -9,9 +8,8 @@
priority="20"> priority="20">
<xpath expr="." position="inside"> <xpath expr="." position="inside">
<script type="text/javascript" <script type="text/javascript"
src="/base_export_manager/static/src/js/main.js"/>
src="/base_export_manager/static/src/js/base_export_manager.js"/>
</xpath> </xpath>
</template> </template>
</data>
</openerp>
</odoo>

7
base_export_manager/views/ir_exports_view.xml

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com> <!-- Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<openerp>
<data>
<odoo>
<record id="ir_exports_action" model="ir.actions.act_window"> <record id="ir_exports_action" model="ir.actions.act_window">
<field name="name">Export Profiles</field> <field name="name">Export Profiles</field>
@ -81,5 +81,4 @@
</field> </field>
</record> </record>
</data>
</openerp>
</odoo>
Loading…
Cancel
Save