Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
5800 Zobrazení

I'm currently developing a function that can delete an order line with a click on a button and a SQL query.

My query has a syntax error but I'm inspiring myself with odoo's addons.


The error is this:

psycopg2.ProgrammingError: syntax error at or near "%"
LINE 2:                        WHERE (product_id = %(product_id)s)AN...

And my query is this:

DELETE FROM sale_order_line WHERE (product_id = %(product_id)s)AND (order_id = %(order_id)s)

 
Avatar
Zrušit
Nejlepší odpověď

Hello

try will below code:

self._cr.execute("DELETE FROM sale_order_line WHERE product_id=%s AND order_id=%s", (product_idorder_id))

in above query you have pass the interger value of variable product_id and order_id

Avatar
Zrušit
Autor

Oh okay I see the mistake

Thanks for the help

Related Posts Odpovědi Zobrazení Aktivita
0
lis 21
3250
1
zář 21
2966
1
lis 19
4942
0
led 22
3999
0
říj 21
1691