I tried to update qty_done for a purchase order with with @route
Here is my code:
@route('/api/purchase_order2/', type='http', auth='none', methods=['PUT'], csrf=False)
def update_purchase_order(self, purchase_order_id, **kwargs):
purchase_order_id = int(purchase_order_id)
# Get purchase order
purchase_order = request.env['purchase.order'].sudo().search([('id', '=', purchase_order_id)])
picking = purchase_order.picking_ids[0]
picking.move_line_ids.write({'qty_done': 1})
res_dict = picking.button_validate()
# print('res_dict', res_dict)
data = json.loads(request.httprequest.data)
headers = {'Content-Type': 'application/json'}
return Response(json.dumps({'data': 'success'}), headers=headers)
I got the following error message when i call the api
`2023-05-03 14:02:06,067 2124917 ERROR dev_db odoo.sql_db: bad query:
SELECT fol.id, fol.res_id, fol.partner_id, array_agg(subtype.id)
FROM mail_followers fol
LEFT JOIN mail_followers_mail_message_subtype_rel fol_rel ON fol_rel.mail_followers_id = fol.id
LEFT JOIN mail_message_subtype subtype ON subtype.id = fol_rel.mail_message_subtype_id
WHERE fol.res_model = 'stock.picking' AND fol.res_id IN (1)AND (fol.partner_id IN (false))
GROUP BY fol.id
ERROR: operator does not exist: integer = boolean
LINE 7: ...picking' AND fol.res_id IN (1)AND (fol.partner_id IN (false)...
^
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.`
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- إدارة علاقات العملاء
- e-Commerce
- المحاسبة
- المخزون
- PoS
- المشروع
- MRP
لقد تم الإبلاغ عن هذا السؤال
1
الرد
2901
أدوات العرض
Hi,
SELECT fol.id, fol.res_id, fol.partner_id, array_agg(subtype.id)FROM mail_followers fol
LEFT JOIN mail_followers_mail_message_subtype_rel fol_rel ON fol_rel.mail_followers_id = fol.id
LEFT JOIN mail_message_subtype subtype ON subtype.id = fol_rel.mail_message_subtype_id
WHERE fol.res_model = 'stock.picking' AND fol.res_id IN (1) AND (fol.partner_id IS NOT NULL)
GROUP BY fol.id
Hope it helps
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!
أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!
تسجيل| المنشورات ذات الصلة | الردود | أدوات العرض | النشاط | |
|---|---|---|---|---|
|
|
0
مارس 24
|
2067 | ||
|
|
3
فبراير 24
|
5217 | ||
|
|
1
مايو 23
|
3158 | ||
|
|
0
ديسمبر 23
|
2906 | ||
|
|
0
يناير 24
|
2174 |