Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
1367 Prikazi

I am using python and trying to archive and unarchive products using XMLRPC. The python code is as follow:


self.models.execute_kw(self.db,self.uid,self.password, "product.template", "write",[ids, {"active": True}])


The code worked for archiving a product, by updating the active column to be False, but when I run it to unarchive the product and set the column to be True it won't work. No error is returned and it simply does nothing to the product/database. Is there any way to do this?

Avatar
Opusti
Best Answer

There are methods already built for that with names action_archive​ and action_unarchive​ on the models

You could call those models instead.

One important thing to check it's if your ids are having the values ok, the records that  are with value active = False​ because in order to get those values I think that you need to search using an specific context having this value active_test = False

Otherwise the value of the ids could be empty of the desired record ids to be unarchived

Avatar
Opusti