コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
5856 ビュー

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)

 
アバター
破棄
最善の回答

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

アバター
破棄
著作者

Oh okay I see the mistake

Thanks for the help

関連投稿 返信 ビュー 活動
0
11月 21
3260
1
9月 21
3001
1
11月 19
4952
0
1月 22
4011
0
10月 21
1691