This question has been flagged
3 Replies
4528 Views

I read the question "How to configure alerts for employee contract expiration" and I followed the video to configure an Automated Action that send me an email a month before a contract expire, but for me this does not work.

This is my configuration screenshots: http://www.yogile.com/bf2om8i3#41m

In the log file I see the scheduler running:

openerp.addons.base.ir.ir_cron: Starting job `Check Action Rules`.
openerp.addons.base.ir.ir_cron: cron.object.execute(u'test', 1, '*', u'base.action.rule', u'_check')
openerp.addons.base.ir.ir_cron: 0.005s (base.action.rule, _check)

But no email arrives in my mailbox.

I tried different things and I checked the record directly on the database, but I'm not able to discover the problem.

Someone can help me, please?

Avatar
Discard
Author

I tried http://www.yogile.com/t26qv3he#41m but nothing happened.. I also tried to create a new contract (because of the sentence "An action rule is checked when you create or modify the "Related Document Model"") that satisfy the trigger, but nothing happened

Best Answer

Maybe you should first try to send a message to the commandline, so you can see the scheduler actually works. Once you have confirmed that you should try to manually send out emails. If both work, check that mails do not get stuck in the outbox of your account.

Avatar
Discard
Author Best Answer

I know that the Automated Action is checked because of a bug (?)

If for "Delay After Trigger Date" field I set "Months" i can read in the logs:

ERROR test openerp.addons.base.ir.ir_cron: Call of self.pool.get('base.action.rule')._check(cr, uid, *()) failed in Job 6
Traceback (most recent call last):
  File "/opt/openerp/oe/server/openerp/addons/base/ir/ir_cron.py", line 136, in _callback
    method(cr, uid, *args)
  File "/opt/openerp/oe/addons/base_action_rule/base_action_rule.py", line 261, in _check
    delay = DATE_RANGE_FUNCTION[action.trg_date_range_type](action.trg_date_range)
  File "/opt/openerp/oe/addons/base_action_rule/base_action_rule.py", line 37, in <lambda>
    'month': lambda interval: timedelta(months=interval),
TypeError: 'months' is an invalid keyword argument for this function

Avatar
Discard
Author

Thank you Med Said BARA. I review the steps and all it's ok. I discovered that if I delete and recreate the Automated Action, it works correctly but ONLY FOR THE FIRST TIME (an email arrives to my mailbox as I expect), then stop to work even if the scheduler still check the action.

Author

I discovered that after the first time the "run" method of addons/base/ir/ir_actions.py is not executed.

In the form "Check Action Rules" there is a field "doall : Repeat Missed" (to be checked or unchecked) which "Specify if missed occurences should be executed when the server restart". this also means that if the action succeeded it will not be repeated. I think this is why the action could not be run after running successfully the first time.

Author

Thank you again Med Said BARA. I already tried to check that flag, but nothing changes: the action will be execute only the first time. Now I think this is another bug.

Best Answer

1- As stated by Ludo-Neobis begin by checking if your mail system is configured correctly (Outgoing Server - SMTP).

2- The error indicated in your LOG: "months" is an invalid keyword.

Perhaps, it's a bug.

3- Try to use: -30 Days instead, to see if it works.

4- Try to review the steps here:  https://www.odoo.com/forum/help-1/question/trigger-an-action-on-date-field-a-step-by-step-guide-48945#answer-48970

 

Avatar
Discard