Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
5924 มุมมอง

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

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
พ.ย. 21
3389
How to solved this SQL error ?? แก้ไขแล้ว
1
ก.ย. 21
3153
1
พ.ย. 19
5024
0
ม.ค. 22
4127
0
ต.ค. 21
1691