so_number = fields.Many2one('sale.order', string='Sale Order Number')
product_technical
= fields.Many2one('product.product', string='Product Name' ,change_default=True,)
def show_lot(self, product_technical=None, so_number=None ):
sql = "select sml.lot_id from stocK_move_line as sml
join stock_move as sm on sm.id = sml.move_id
join stock_picking as sp on sp.id = sm.picking_id
where sml.product_id = %d and sp.origin = %s " % (self.product_technical , str(self.so_number))
self.env.cr.execute(sql)
res_one = self.env.cr.fetchone()
return res_one
<table>
<tr t-foreach="item.show_lot(product_technical, so_number )" t-as="p">
<td align="center" style="border:1px solid black;" width="10%">
<center><span t-esc="(p_index + 1)"/> </center>
</td>
<td align="right" style="border:1px solid black;" width="40%"><span t-esc="p[0]"/></td>
</tr>
</table>
error:
Error to render compiling AST ProgrammingError: syntax error at or near ")" LINE 1: ...re sml.product_id = 47577 and sp.origin = sale.order(6987,)
Hi, Thanks