Odoo Help

1

Open ERP sql queries

By
Tamer Ibrahim
on 5/21/13, 8:14 AM 3,584 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

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.

1

Borni DHIFI

--Borni DHIFI--
5122
| 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)

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)

Stats

Asked: 5/21/13, 8:14 AM
Seen: 3584 times
Last updated: 3/16/15, 8:10 AM