2015-06-20 6:36 GMT-03:00 <[email protected]>:
> Hello,
>
> i have a tree view which contains a button on each record.
> Now i want to edit/update the values of fields of the row if clicking the
> button.
>
> But i donk konw how to get the ID of the row and how to update.
> I tried something like this:
>
> def myButton(cls, records):
> pool = Pool()
> Model = pool.get(mymodul.mymodul)
> row = Model.search(['field1','=','test'])
>
> But as i said, i don't know how to get the ID of the ckicked row and i
> don't found an update command.
>
They are held in the 'records' parameter of your cassmethod.
@classmethod
@ModelView.button
def my_button(cls, records):
for row in records:
#do your changes to row here (preferably calling a method who does
the real work)
Hope it helps.
K.
--
-------------------------
Karla Mª Stenger Sábat
[email protected]