74
74
def __init__(self, obj, rel, id1, id2, string='unknown', limit=None, **args):
75
75
super(many2many_notlazy, self).__init__(obj, rel, id1, id2, string, limit, **args)
77
def set(self, cr, obj, id, name, values, user=None, context=None):
77
def set(self, cr, obj, m_id, name, values, user=None, context=None):
78
78
if context is None:
106
106
cr.execute('delete from '+self._rel+' where '+self._id1+'=%s AND '+self._id2+' IN (SELECT '+self._rel+'.'+self._id2+' FROM '+self._rel+', '+','.join(tables)+' WHERE '+self._rel+'.'+self._id1+'=%s AND '+self._rel+'.'+self._id2+' = '+obj._table+'.id '+ d1 +' and '+self._rel+'.'+self._id2+' not in %s)', args)
109
cr.execute('select '+self._id2+' from '+self._rel+' where '+self._id1+'=%s', [id, ])
109
cr.execute('select '+self._id2+' from '+self._rel+' where '+self._id1+'=%s', [m_id, ])
110
110
existing = [x[0] for x in cr.fetchall()]
112
112
for act_nbr in act[2]:
113
113
if act_nbr not in existing:
114
114
if self._rel == 'account_destination_link':
115
115
link_obj = pooler.get_pool(cr.dbname).get('account.destination.link')
116
link_obj.create(cr, user, {self._id1: id, self._id2: act_nbr})
116
link_obj.create(cr, user, {self._id1: m_id, self._id2: act_nbr})
118
cr.execute('insert into '+self._rel+' ('+self._id1+','+self._id2+') values (%s, %s)', (id, act_nbr))
118
cr.execute('insert into '+self._rel+' ('+self._id1+','+self._id2+') values (%s, %s)', (m_id, act_nbr))
121
121
newargs.append(act)
123
return super(many2many_notlazy, self).set(cr, obj, id, name, newargs, user=user, context=context)
123
return super(many2many_notlazy, self).set(cr, obj, m_id, name, newargs, user=user, context=context)
125
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
b'\\ No newline at end of file'