Merge lp:~onnis-roberto/web-addons/6.1 into lp:~webaddons-core-editors/web-addons/6.1

Proposed by Roberto Onnis
Status: Merged
Approved by: Holger Brunn (Therp)
Approved revision: 27
Merged at revision: 25
Proposed branch: lp:~onnis-roberto/web-addons/6.1
Merge into: lp:~webaddons-core-editors/web-addons/6.1
Diff against target: 128 lines (+101/-5)
2 files modified
web_export_view/i18n/web_export_view.pot (+80/-0)
web_export_view/static/js/web_advanced_export.js (+21/-5)
To merge this branch: bzr merge lp:~onnis-roberto/web-addons/6.1
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) code review Approve
Guewen Baconnier @ Camptocamp Needs Fixing
Roberto Onnis (community) Approve
Lorenzo Battistini (community) code review Approve
Pedro Manuel Baeza code review Approve
Review via email: mp+207662@code.launchpad.net

Description of the change

[web_export_view]: enables export of boolean values in tree view

To post a comment you must log in.
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, Roberto, thank you very much for your contribution. I see these little things to fix:

- You must enclose in different 'if' some conditions to avoid possible False:

if(data_id.find('input').get(0) != undefined) {
    if(data_id.find('input').get(0).type == 'checkbox' {
        if (data_id.find('input').get(0).checked){
            text = _t("True");
        }
        else {
            text = _t("False");
        }
    }
.
.
.
or am I not understanding correctly the code?

- Include updated translatation template file.

Regards.

review: Needs Fixing (code review)
lp:~onnis-roberto/web-addons/6.1 updated
25. By Roberto Onnis

[web_export_view]: fixes unandled case in if else construct

Revision history for this message
Roberto Onnis (onnis-roberto) wrote :

Hi Pedro, thanks for your fast review, I've pushed the fix in js code.

How can I create a pot file of a web module? I've tried with the openerp export functionality but it returns an empty file

Thanks in advance
Roberto

> Hi, Roberto, thank you very much for your contribution. I see these little
> things to fix:
>
> - You must enclose in different 'if' some conditions to avoid possible False:
>
> if(data_id.find('input').get(0) != undefined) {
> if(data_id.find('input').get(0).type == 'checkbox' {
> if (data_id.find('input').get(0).checked){
> text = _t("True");
> }
> else {
> text = _t("False");
> }
> }
> .
> .
> .
> or am I not understanding correctly the code?
>
> - Include updated translatation template file.
>
> Regards.

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, Roberto,

I have faced previously the same problem with translation on js files, and I finally ended adding lines by hand. It's a little odd, but very straightforward. I include here both sections for translating True and False (add them to the header generated by OpenERP):

#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/src/js/web_advanced_export.js:103
#, python-format
msgid "True"
msgstr ""

#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/src/js/web_advanced_export.js:106
#, python-format
msgid "False"
msgstr ""

I have seen that there is no current pot file, so these are the other entries you need for the full translation of the module:

#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/src/js/web_advanced_export.js:38
#, python-format
msgid "Customize"
msgstr ""

#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/src/js/web_advanced_export.js:40
#, python-format
msgid "Translate"
msgstr ""

#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/src/js/web_advanced_export.js:42
#, python-format
msgid "Technical translation"
msgstr ""

#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/src/js/web_advanced_export.js:46
#, python-format
msgid "Other Options"
msgstr ""

#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/src/js/web_advanced_export.js:49
#, python-format
msgid "Import"
msgstr ""

#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/src/js/web_advanced_export.js:52
#, python-format
msgid "Export"
msgstr ""

#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/src/js/web_advanced_export.js:56
#, python-format
msgid "Export current view"
msgstr ""

Regards.

lp:~onnis-roberto/web-addons/6.1 updated
26. By Roberto Onnis

[web_export_view]: localization template added

Revision history for this message
Roberto Onnis (onnis-roberto) wrote :

Template File added, thanks Pedro

review: Needs Resubmitting
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Thanks for the changes.

Regards.

review: Approve (code review)
Revision history for this message
Lorenzo Battistini (elbati) wrote :

Thanks Roberto.

Would this be applicable to v7 too?

review: Approve (code review)
Revision history for this message
Roberto Onnis (onnis-roberto) :
review: Approve
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Can you remove the line with "I have seen that there is no current pot file, so these are the other entries you need for the full translation of the module:" in the pot file?

review: Needs Fixing
lp:~onnis-roberto/web-addons/6.1 updated
27. By Roberto Onnis

[web_export_view] misprint deleted in localization pot file

Revision history for this message
Roberto Onnis (onnis-roberto) wrote :

line removed in pot file

R.

Revision history for this message
Holger Brunn (Therp) (hbrunn) :
review: Approve (code review)
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

Given that Guewen's concern was resolved a while ago, I set this to approved.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'web_export_view/i18n'
2=== added file 'web_export_view/i18n/web_export_view.pot'
3--- web_export_view/i18n/web_export_view.pot 1970-01-01 00:00:00 +0000
4+++ web_export_view/i18n/web_export_view.pot 2014-02-28 13:05:28 +0000
5@@ -0,0 +1,80 @@
6+# Translations template for PROJECT.
7+# Copyright (C) 2014 ORGANIZATION
8+# This file is distributed under the same license as the PROJECT project.
9+# FIRST AUTHOR <EMAIL@ADDRESS>, 2014.
10+#
11+msgid ""
12+msgstr ""
13+"Project-Id-Version: PROJECT VERSION\n"
14+"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
15+"POT-Creation-Date: 2014-02-21 18:59+0100\n"
16+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
17+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
18+"Language-Team: LANGUAGE <LL@li.org>\n"
19+"MIME-Version: 1.0\n"
20+"Content-Type: text/plain; charset=utf-8\n"
21+"Content-Transfer-Encoding: 8bit\n"
22+"Generated-By: Babel 0.9.6\n"
23+
24+#. module: web_export_view
25+#. openerp-web
26+#: code:addons/web_export_view/static/src/js/web_advanced_export.js:103
27+#, python-format
28+msgid "True"
29+msgstr ""
30+
31+#. module: web_export_view
32+#. openerp-web
33+#: code:addons/web_export_view/static/src/js/web_advanced_export.js:106
34+#, python-format
35+msgid "False"
36+msgstr ""
37+
38+#. module: web_export_view
39+#. openerp-web
40+#: code:addons/web_export_view/static/src/js/web_advanced_export.js:38
41+#, python-format
42+msgid "Customize"
43+msgstr ""
44+
45+#. module: web_export_view
46+#. openerp-web
47+#: code:addons/web_export_view/static/src/js/web_advanced_export.js:40
48+#, python-format
49+msgid "Translate"
50+msgstr ""
51+
52+#. module: web_export_view
53+#. openerp-web
54+#: code:addons/web_export_view/static/src/js/web_advanced_export.js:42
55+#, python-format
56+msgid "Technical translation"
57+msgstr ""
58+
59+#. module: web_export_view
60+#. openerp-web
61+#: code:addons/web_export_view/static/src/js/web_advanced_export.js:46
62+#, python-format
63+msgid "Other Options"
64+msgstr ""
65+
66+#. module: web_export_view
67+#. openerp-web
68+#: code:addons/web_export_view/static/src/js/web_advanced_export.js:49
69+#, python-format
70+msgid "Import"
71+msgstr ""
72+
73+#. module: web_export_view
74+#. openerp-web
75+#: code:addons/web_export_view/static/src/js/web_advanced_export.js:52
76+#, python-format
77+msgid "Export"
78+msgstr ""
79+
80+#. module: web_export_view
81+#. openerp-web
82+#: code:addons/web_export_view/static/src/js/web_advanced_export.js:56
83+#, python-format
84+msgid "Export current view"
85+msgstr ""
86
87=== modified file 'web_export_view/static/js/web_advanced_export.js'
88--- web_export_view/static/js/web_advanced_export.js 2013-05-24 11:28:51 +0000
89+++ web_export_view/static/js/web_advanced_export.js 2014-02-28 13:05:28 +0000
90@@ -89,17 +89,33 @@
91 });
92 rows = view.$element.find('.ui-widget-content tr');
93 export_rows = [];
94- $.each(rows,function(){
95+ $.each(rows,function(){
96 $row = $(this);
97- // find only rows with data
98+ // find only rows with data
99 if($row.attr('data-id')){
100 export_row = [];
101 $.each(export_columns_keys,function(){
102 cell = $row.find('td[data-field="'+this+'"]').get(0);
103- text = cell.text || cell.textContent || cell.innerHTML || "";
104- export_row.push(text.trim());
105+ var data_id = $( '<div>' + cell.innerHTML + '</div>');
106+ if(data_id.find('input').get(0) != undefined) {
107+ if(data_id.find('input').get(0).type == 'checkbox'){
108+ if(data_id.find('input').get(0).checked){
109+ text = _t("True");
110+ }
111+ else {
112+ text = _t("False");
113+ }
114+ }
115+ else {
116+ text = cell.text || cell.textContent || cell.innerHTML || "";
117+ }
118+ }
119+ else{
120+ text = cell.text || cell.textContent || cell.innerHTML || "";
121+ }
122+ export_row.push(text.trim());
123 });
124- export_rows.push(export_row);
125+ export_rows.push(export_row);
126 }
127 });
128 $.blockUI();

Subscribers

People subscribed via source and target branches