Implemented data export to OO Calc (code included)

Bug #399278 reported by Dukai Gábor
24
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo GTK Client (MOVED TO GITHUB)
Confirmed
Wishlist
OpenERP sa GTK client R&D

Bug Description

Hi!
I've implemented data export to OpenOffice.org Calc and I share the code here, maybe others need this functionality, too. It does the same job as the 'Open in Excel' function for win32. This code was tested on Ubuntu 8.04 and 9.04.
The needed oootools.py is attached.

So replace this line: :)
common.message(_("Function only available for MS Office !\nSorry, OOo users :("))

with this:
        try:
            import subprocess
            import time
            retcode = subprocess.call(["soffice", "-accept=socket,host=localhost,port=2002;urp;", "-nodefault"], shell=False)
            from oootools import OOoTools
            for i in range(10):
                ooo = OOoTools('localhost', 2002)
                if ooo and ooo.desktop:
                    break
                time.sleep(1)
            doc = ooo.desktop.loadComponentFromURL("private:factory/scalc",'_blank',0,())
            sheet = doc.CurrentController.ActiveSheet
            for col in range(len(fields)):
                cell = sheet.getCellByPosition(col, 0)
                cell.String = fields[col]
            cellrange = sheet.getCellRangeByPosition(0, 1, len(fields) - 1, len(result))
            tresult = []
            for i in range(len(result)):
                tresult.append(tuple(result[i]))
            tresult = tuple(tresult)
            cellrange.setDataArray(tresult)
        except:
            common.error(_('Error Opening Excel !'),'')

Revision history for this message
Dukai Gábor (gdukai) wrote :
Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote :

I've integrated this patch into Koo and given you due credit, but can you give us permission to use it? Koo is GPLv2 licensed.

Revision history for this message
Dukai Gábor (gdukai) wrote :

Of course! I'm glad you integrated OO Calc export into Koo.

Changed in openobject-client:
assignee: nobody → uco (Open ERP) (uco-openerp)
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello Dukai,

Would you please check this again?

This does not fit with OO 3.0 .

Thanks.

Revision history for this message
Dukai Gábor (gdukai) wrote :

Ubuntu 9.04 has OO 3.0 which I have tested with.

Revision history for this message
Ujjvala Collins (uco-openerp) wrote :

Hello Dukai,
I have tested the code with Ubuntu 8.10 with Openoffice version 3.1.0-11. But its not working as it requires to fulfill many dependencies including python-uno packages and Openoffice core files, which i think a normal user may not understand.
Thanks you.

Revision history for this message
Dukai Gábor (gdukai) wrote :

No problem. IMHO you should change the "Function only available for MS Office !\nSorry, OOo users :(" error message in the client to inform the user that the KDE client has this functionality.

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

Hello, I think we should merge this in trunk, but put a try/except on the pyuno so that it does not crash if you did not installed the dependencies. Also, the error message must be something like "Install pyuno if you want this feature"

Changed in openobject-client:
assignee: uco (Open ERP) (uco-openerp) → Anup (Open ERP) (ach-openerp)
importance: Undecided → Wishlist
milestone: none → 6.0
Revision history for this message
Mantavya Gajjar (Open ERP) (mga) wrote :

Hello,

This feature is implemented as simple as copy and paste a record from one sheet to other sheet.
now you can copy from the openerp gtk client and paste it in to the spreadsheet.

I think no need extra development for very simple thing

M Gajjar

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

@mga
I think you make this a little bit to simple. I do agree with you if data output contains only a few records. In that case why not removing the MS Office functionality. It would not be necessary then either and will not make users wonder why it is not there for a Open Source Office program.

If one needs all data which could contain over 1000 record or even more like with accounting, copy/paste is not sufficient anymore. One would have the data directly pushed in a spreadsheet.

To my guesses make the needed dependencies directly into the setup.py routine of the GTK-client and webserver and it will work out of the box for both clients (web and gtk) with the provided code.
I don't see the problem as KDE-client can adopt it directly while GTK can't?

But perhaps I did misunderstand your comment? Feel free to correct me if that's the case.

Revision history for this message
Nhomar - Vauxoo (nhomar) wrote :

@mga

I'm not agree with you, simple things for programers in many cases are so abstracts for end users (even copy and paste for a sheet to another).... This function directly on clients is very usefull,

BTW, when we give solutions to end users, we need to make easier them lifes not more complicated ;-), and direct access of all data for analysis in a spreedsheet directly is one of the features more asked for accountants.

regards.

Revision history for this message
digitalsatori(Shine IT) (digitalsatori) wrote :

I didn't even notice before now that we can simply copy a list of record and paste into ooo, Cool.

Revision history for this message
Ferdinand (office-chricar) wrote :

It's a todo - user friendly - missing opensource support

Changed in openobject-client:
status: New → Confirmed
assignee: Anup (OpenERP) (ach-openerp) → nobody
milestone: 6.0 → none
assignee: nobody → OpenERP sa GTK client R&D (openerp-dev-gtk)
milestone: none → 6.0
Changed in openobject-client:
milestone: 6.0 → none
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Please have a look at bug 677205 too.
Thanks.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.