Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
1379 Представления

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?

Аватар
Отменить
Лучший ответ

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

Аватар
Отменить