Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

2

How to export data in latest version of openerp avoiding a silent bug?

By
Vandermolt Jean-Claude
on 10/5/13, 2:12 PM 2,464 views

Hi,

Since the fix of the bug 1193563 (see bugs.launchpad)

It remains impossible to export any data from openerp V7.0 (5 october version).

After creating some customers (same bug with article, ...) and trying to export any data (name, address, bank account, whatsoever data field), nothing seems to happens. I think it can be related to this bug: openerp-web/+bug/1202154

Here is the messages I obtains in the console of Firefox 24: ` [20:23:39.387] POST IP:8069/web/export/xls [HTTP/1.0 200 OK 284ms] [20:23:39.433] [Exception... "Async version must be used" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: resource://gre/components/nsHelperAppDlg.js :: <top_level> :: line 190" data: no] @

resource://gre/components/nsHelperAppDlg.js:190

[20:23:50.682] can't access dead object @ resource://gre/modules/DownloadLastDir.jsm:168 [20:23:50.682] [Exception... "'[JavaScript Error: "can't access dead object" {file: "resource://gre/modules/DownloadLastDir.jsm" line: 168}]' when calling method: [nsIContentPrefCallback2::handleCompletion]" nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)" location: "JS frame :: resource://gre/modules/ContentPrefService2.jsm :: safeCallback :: line 797" data: yes] @ resource://gre/modules/ContentPrefService2.jsm:800 `

The log of Openerp remains silent. Even with the options: ./openerp-server --logfile=/var/log/openerp-server.log --log-handler=werkzeug:DEBUG --log-handler=openerp.orm:DEBUG

I tried it with two version of python werkzeug (8.3 and 9.1) and I obtain the same result. Does anybody knows how to avoid this export bug?

Thanks

Jean-Claude Vandermolt

Please try to backup the database from the old version and install the new version , restore the database and try to update the modules.

Mahmoud
on 10/5/13, 2:24 PM

Unfortunately, I need the export capabilities in order to create a new database. I have some data coming from a home-made solution and I need to export some 'test data' in order to give Openerp to the 'good data' some values as it's expecting it (tables links etc).

vandermolt
on 10/8/13, 4:28 AM
0
vandermolt
On 10/13/13, 8:28 AM

Finally, I managed to avoid the bug by exporting the data in another csv file, before the web export:

file openerp/addons/web/controllers/main.py
```
openerp/addons/web/controllers/

--- main.py-old 2013-10-13 12:11:17.761159074 +0200
+++ main.py 2013-10-13 12:10:36.057178027 +0200
@@ -1643,9 +1643,10 @@
def from_data(self, fields, rows):
fp = StringIO()

writer = csv.writer(fp, quoting=csv.QUOTE_ALL)

  • ofile = open('test.csv', "wb")
  • test = csv.writer(ofile, delimiter=';')

    writer.writerow([name.encode('utf-8') for name in fields])

  • test.writerow([name.encode('utf-8') for name in fields])
    for data in rows:
    row = []
    for d in data:
    @@ -1658,10 +1659,11 @@
    if d is False: d = None
    row.append(d)

    writer.writerow(row)

  • test.writerow(row)
    fp.seek(0)
    data = fp.read()
    fp.close()

  • ofile.close()
    return data

```
This write the data in a file called test.csv placed in /opt/openerp in my case. It's not perfect but it's working.

Sorry for the formatting, markdown is not helping for diff writing.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 10/5/13, 2:12 PM
Seen: 2464 times
Last updated: 3/16/15, 8:10 AM