A custom HTML view or open URL inline

Asked by Rinse Ringma

Hello,

I just had discovered OpenERP, so I'm kinda new to it. I am working with OpenERP for my internship and I'm building a SCADA system for a company.

For more info about SCADA: http://en.wikipedia.org/wiki/Supervisory_control_and_data_acquisition

I already built a SCADA system and it is working properly. It's web based and built in HTML and jQuery, the styling is done by CSS3. It contains a monitor for tanks that contain a egg-product. The system is monitoring the weight, temperature, pressure and will also contain a flow.

The thing is that I want to implement this system within OpenERP. I had discovered that you can make a button to open a external URL. You can set the target to a new window or the current window, but what I wanted it to do is opening this link with OpenERP such as the modules do.

So my question is, is it possible to create a custom view containing HTML or can you open a external URL within the framework of OpenERP?

Sorry for my horrible English!

Kind regards,
Rinse Ringma
The Netherlands

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Web Client Edit question
Assignee:
No assignee Edit question
Solved by:
Rinse Ringma
Solved:
Last query:
Last reply:
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) said :
#1

Hi Rinse,

the OpenERP web client framework, especially in 6.1 and the forthcoming 7.0 allows you to build custom client side components in javascript. You can hook into the client both view wise and function wise in a very flexible manner. That should give you the tools to fully integrate the SCADA system with OpenERP.

See this part of the web client documentation on how to build such a 'web addon': http://openerp-web.readthedocs.org/en/latest/addons.html

Regards,
Stefan.

Revision history for this message
Rinse Ringma (ringmarinse) said :
#2

Hello Stefan,

Thank you for your answer!

I had a look at the documentation you gave me and I sort of understand the basic development of a web addon, but I really don't have a clue how to start with this.

Should I just create the directory structure and build the regular files of a module?
I'm very new to the structure of OpenERP, are there tutorials/how-to's about how this is setup?

Regards,
Rinse Ringma

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) said :
#3

Hi Rinse,

if you are struggling with the module layout, maybe this package can help you:

http://planet.domsense.com/en/2012/04/how-to-create-an-openerp-module-the-easy-way/

I have not used this package myself.

You can also look at existing web addons. See here:

http://bazaar.launchpad.net/~domsense/domsense-agilebg-web-addons/6.1/files

and the modules support_branding, trp_extended_search and trp_saved_selection in
http://bazaar.launchpad.net/~therp-nl/therp-addons/6.1/files

Cheers,
Stefan.

Revision history for this message
Rinse Ringma (ringmarinse) said :
#4

Stefan,

Again thank you for the usefull links!

I'm starting to understand both of the structures. I now know how to make a module and I had a look at one of your web addons, but what I don't understand is the connection between the two.

Sorry for, maybe, being annoying with all those question, but I really want to know OpenERP better and therby making a module based on I think QWeb?

Regards,
Rinse

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) said :
#5

Note that an OpenERP addon can contain both ORM modelling and views as well as web functionality and layout. You can combine both in a single addon, depending on your needs.

If you want to inject a view component in the web client, then you can write a Qweb template. Specific logic around this view element is encoded in javascript.

If on the other hand, you want to store information in the OpenERP database you write your model definition in a python file. The view layout to display this data structure is encoded in XML 'record' tags with model='ir.ui.view'.

To integrate OpenERP web with another web application you will almost certainly want to look into the first option but to exchange data with OpenERP and store it in the database you need to take the second option also into account.

Revision history for this message
Rinse Ringma (ringmarinse) said :
#6

Well, I have tried to build a module with a QWeb template. I had found this document on the web:

http://pinakinnayi.blogspot.nl/2012/04/how-to-add-custom-widget-in-your-open.html

But for some reason I can't get it to work. I get the following error:
AssertionError: Invalid attribute widget for element field, line 5

Maybe I can post my code here?

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) said :
#7

Sure, go ahead. To avoid cluttering the thread, put up a link to pastebin.

Revision history for this message
Rinse Ringma (ringmarinse) said :
#8

A made account at Pastebin, this the link to all the files of my module:

http://pastebin.com/GbFUxE9Y

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) said :
#9

Your XML view definition is incomplete. It needs name, type and model tags. The view definition itself should be in a form tag in an arch tag with type="xml". Plus you did not include a python file with the model definition.

I suggest you try your hands on the model file plus OpenERP view definition first, and when that works proceed with custom widgets. Here is a good place to start: http://doc.openerp.com/v6.1/developer/03_modules.html

Revision history for this message
Rinse Ringma (ringmarinse) said :
#10

I have created a seperate website regarding the SCADA system.

Now I need to add a menu item to this website within a different module. See my other question.

Thanks for a the help!