class similar_contact(models.Model):
_inherit= 'res.partner'
@api.onchange("name")
def onchange_name(self):
if self.name:
val=self.env['softandgrid'].search([('name','=','Name')])
self._cr.execute("SELECT b FROM rel2 WHERE b=%s",(val.id,))
res = self._cr.fetchall()
logging.info(res)===>([3,])
self._cr.execute("DELETE FROM rel2 WHERE b=%s",(val.id,))
class checked_criteria(models.Model):
_name="checked.criteria"
soft=fields.Many2many('softandgrid','rel1','a','b',string="Soft Duplicates Fields")
grid=fields.Many2many('softandgrid','rel2','a','b',string="Grid Duplicates Fields")
class softandgrid(models.Model):
_name="softandgrid"
name=fields.Char("Name")
self._cr.execute("DELETE FROM rel2 WHERE b=%s",(val.id,)) cannot delet records from rel2.
How to clear all datas from rel2?Thank You.