Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
5795 Weergaven

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
Annuleer
Beste antwoord

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
Annuleer
Auteur

Oh okay I see the mistake

Thanks for the help

Gerelateerde posts Antwoorden Weergaven Activiteit
0
nov. 21
3245
1
sep. 21
2962
1
nov. 19
4937
0
jan. 22
3993
0
okt. 21
1691