I'm trying to insert a record in stock.scrap and auto validate it when the creation is done but returned me a bad query error. Any idea on how to implement this?
valss = {
'lot_id': self\.DIE_SerialNumber\.name,
'product_id':\ self\.DIE_SerialNumber\.product_id\.id,
'scrap_qty':\ self\.DIE_SerialNumber\.product_qty,
'product_uom_id':\ self\.DIE_SerialNumber\.product_uom_id\.name,
\}
scrap_product\ =\ self\.env\['stock\.scrap'\]\.create\(valss\)
2021\-12\\\\\-06\\\\\ 08:10:27,948\\\\\ 242717\\\\\ ERROR\\\\\ db odoo\\\\\.sql_db:\\\\\ bad\\\\\ query:\\\\\ INSERT\\\\\ INTO\\\\\ "stock_scrap"\\\\\ \\\\\("id",\\\\\ "create_uid",\\\\\ "create_date",\\\\\ "write_uid",\\\\\ "write_date",\\\\\ "company_id",\\\\\ "location_id",\\\\\ "lot_id",\\\\\ "name",\\\\\ "product_id",\\\\\ "product_uom_id",\\\\\ "scrap_location_id",\\\\\ "scrap_qty",\\\\\ "state"\\\\\)\\\\\ VALUES\\\\\ \\\\\(nextval\\\\\('stock_scrap_id_seq'\\\\\),\\\\\ 2,\\\\\ \\\\\(now\\\\\(\\\\\)\\\\\ at\\\\\ time\\\\\ zone\\\\\ 'UTC'\\\\\),\\\\\ 2,\\\\\ \\\\\(now\\\\\(\\\\\)\\\\\ at\\\\\ time\\\\\ zone\\\\\ 'UTC'\\\\\),\\\\\ 1,\\\\\ 8,\\\\\ 'A',\\\\\ 'New',\\\\\ 1679,\\\\\ 'Units',\\\\\ 44,\\\\\ 1\\\\\.0,\\\\\ 'draft'\\\\\)\\\\\ RETURNING\\\\\ id
ERROR:\\\\\ invalid\\\\\ input\\\\\ syntax\\\\\ for\\\\\ type\\\\\ integer:\\\\\ "A"
LINE\\\\\ 1:\\\\\ \\\\\.\\\\\.\\\\\.zone\\\\\ 'UTC'\\\\\),\\\\\ 2,\\\\\ \\\\\(now\\\\\(\\\\\)\\\\\ at\\\\\ time\\\\\ zone\\\\\ 'UTC'\\\\\),\\\\\ 1,\\\\\ 8,\\\\\ 'A',\\\\\ 'New'\\\\\.\\\\\.\\\\\.
\\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\ \\\\\^
\\\\\
>\\\\\ /home/user/eclipse\\\\\-workspace/odoo13/odoo/sql_db\\\\\.py\\\\\(250\\\\\)execute\\\\\(\\\\\)
\\\\\->\\\\\ res\\\\\ =\\\\\ self._obj.execute(query, params)
PS: i'm sorry I don't know how to use their new editor.