Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Adding a scheduled action

By
Glenn
on 3/27/15, 10:56 AM 745 views

So I want a scheduled action that sends out the payment follow-ups. I'm using the standard module for this.

I've gone to Scheduled Actions and added a new one, the module is: account_followup_print and the method do_process.

Yet this is not yielding any results, no mails are being sent (when I do it manually it sends out 30 ish), when I check the terminal it's not even doing anything at the time it's supposed to send it out.

Any insights? Thanks !

EDIT: I've also tried adding it directly to the code without success:


<openerp>

<data>

<record forcecreate="True" id="ir_cron_project_task" model="ir.cron">

<field name="name">Run Payment Follow-up scheduler</field>

<field eval="True" name="active"/>

<field name="user_id" ref="base.user_root"/>

<field name="interval_number">1</field>

<field name="interval_type">minutes</field>

<field name="numbercall">-1</field>

<field eval="False" name="doall"/>

<field eval="'account_followup.print'" name="model"/>

<field eval="'do_process'" name="function"/>

</record>

</data>

</openerp>


@zbik: if I use your code I get the following error message:

Error while evaluating condition '_add_missing_default_values': name '_add_missing_default_values' is not defined

1

zbik

--zbik--
5941
| 6 4 7
Lodz, Poland
--zbik--


zbik
On 3/28/15, 10:10 AM

Method do_process() is not implemented as cron method. Cron method looks like this:

run_scheduler(self, cr, uid, context=None): 

but parameters do_process():

do_process(self, cr, uid, ids, context=None):

You must inherit model account_followup_print and implement run_scheduler() method like this:


from openerp import models, fields, api, _
import time
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
class account_followup_print(models.TransientModel):
   _inherit = 'account_followup.print'
   @api.v7
   def run_scheduler(self, cr, uid, context=None):
         current_date = time.strftime(DEFAULT_SERVER_DATE_FORMAT)
         if context is None:
            context = {}
         vals = {}
         vals['date'] = current_date
         id = super(account_followup_print, self).create(cr, uid, vals, context=context)
         return super(account_followup_print, self).do_process(cr, uid, [id], context=context)

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/27/15, 10:56 AM
Seen: 745 times
Last updated: 3/28/15, 3:42 PM