This question has been flagged
1 Reply
6773 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

Avatar
Discard
Best Answer

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)

Avatar
Discard