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.

1

Open ERP sql queries

By
Tamer Ibrahim
on 5/21/13, 8:14 AM 3,309 views

Is there a way to access open erp sql queries?

Can you please elaborate your question?

Sudhir Arya (SA)
on 5/21/13, 8:28 AM
1

Borni DHIFI

--Borni DHIFI--
5102
| 6 8 9
Tunis, Tunisia
--Borni DHIFI--

Techno Functional Consultant Odoo(OpenERP) 

http://www.linkedin.com/in/borni

Skype : dhifi.borni

Borni DHIFI
On 5/21/13, 8:25 AM

Hi,

example sql querie update:

def _execute_query(self, cr,id_object ):            
        sql ='''update  my_table_name
                 set state= 'failure'
                 where  id =  %s 
                 ''' % (id_object)                     
        cr.execute(sql)
1

patrick

--patrick--
1958
| 5 4 7
Baarn, Netherlands
--patrick--
patrick
On 5/21/13, 12:24 PM

It is not recommended to type SQL-queries directly from a field and use that to access the DB. Reason is that you can make mistakes and mes sup everything, or worse, you are vulnerable to SQL-injections.

The better way is to make your own modules, with fixed SQL, and optional some input, like the example of Borni DHIFI. Than install that module and use a button or dropdown to let users execute the query and/or fill in the needed variables.

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: 5/21/13, 8:14 AM
Seen: 3309 times
Last updated: 3/16/15, 8:10 AM