Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
5 Antwoorden
5003 Weergaven

I have a server action (with id 421) that changes the field value of a specific partner.

Then I have a scheduled action that calls the server action like this:

Object: ir.actions.server
Method: _run_actions
Arguments: ([421],)

The server action, if started from the "more" menu, works but if I manually start the scheduled action, nothing happens and I don't even have any errors.

Avatar
Annuleer

I don't think you can use a Scheduled Action to do that. Maybe someone with more technical knowledge will explain why!

Auteur

I got to this point following other forum posts so I assume it can be done but there is something in my odoo that is not right.

Auteur
I'm new to Python ... is this useful?

@api.model
    def _run_actions(self, ids):
        """
            Run server actions with given ids.
            Allow crons to run specific server actions
        """
        return self.browse(ids).run()

Thank you very much
Beste antwoord

Probably from the scheduler you don't have active records/IDs and I think that is why your code is not working from the scheduler.

From more, it is working because you have active records. If this is the case, please search the records when the method is called from the scheduler.

It would be more helpful to guide you if you share your python code as well.

EDIT:

Your python code should search the records because when the method is called from the scheduler, you will not have IDs.

def _run_actions(self, ids):
if not ids:
self.search([]) # Add your conditions in domain to search the records
return self.browse(ids).run()


Avatar
Annuleer
Auteur Beste antwoord

Thank you so much for your help but i am too beginners to fix this.

I have yet to learn domain...

Could you give me an example to understand what to write in self.search ([...])

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
okt. 23
6500
2
nov. 22
6880
0
sep. 21
2992
4
aug. 20
7797
2
mrt. 20
11693