Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
6968 มุมมอง


I want to set ir.cron job but by default it is getting Odoobot as a user but I want to set logged in User as a ir.cron job user by default.

Because each user has his own token, so, while running scheduler, it gets none instead of token because the scheduler user is Odoobot.

Note:
As we can change user from scheduler in technical setting, in this case the other user also get the token of scheduler user. or we can create scheduler for each user separately. is there any way to handle this in a single scheduler.
I want just create a generic scheduler which work for each user.
<record id="office365_cron_do_tasts_import" model="ir.cron">
        <field name="name">Auto Office365 tasks import</field>
        <field name="model_id" ref="model_sync_office365"/>
        <field name="state">code</field>
        <field name="active">0</field>
        <field name="code">model.auto_import_tasks()</field>
        <field name='interval_number'>5</field>
        <field name="user_id" ref="base.user_root"/>
        <field name='interval_type'>minutes</field>
        <field name="numbercall">-1</field>
    </record>


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Nope, there is no way single schedule can run on behalf of multiple users.
but run single scheduler as Admin (odoobot) and change the method auto_import_tasks where first search all the user from res.user and run your login behalf of the user like

for user in users:
      self.sudo(user).import_office_task()   ​     ​   ​    ​   ​      ​   ​    ​   ​     ​   ​    ​   ​       ​   ​    ​   ​     ​   ​    ​   ​      ​   ​    ​   ​     ​   ​    ​   ​

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Scheduled Actions Not Running แก้ไขแล้ว
2
เม.ย. 20
15857
Scheduler Error แก้ไขแล้ว
3
ธ.ค. 19
5047
1
พ.ย. 24
2860
Odoo Mail Sending Limit แก้ไขแล้ว
2
ธ.ค. 23
14876
0
ต.ค. 23
33