My function like this:
class scheduler_demo(models.Model):
_name = 'scheduler.demo'
name = fields.Char(required=True)
numberOfUpdates = fields.Integer('Number of updates', help='The number of times the scheduler has run and updated this field')
lastModified = fields.Date('Last updated')
#This function is called when the scheduler goes off
def process_demo_scheduler_queue(self, cr, uid, context=None):
print('Thai123')
scheduler_line_obj = self.pool.get('scheduler.demo')
#Contains all ids for the model scheduler.demo
scheduler_line_ids = self.pool.get('scheduler.demo').search(cr, uid, [])
#Loops over every record in the model scheduler.demo
for scheduler_line_id in scheduler_line_ids :
#Contains all details from the record in the variable scheduler_line
scheduler_line =scheduler_line_obj.browse(cr, uid,scheduler_line_id ,context=context)
numberOfUpdates = scheduler_line.numberOfUpdates
#Prints out the name of every record.
_logger.info('line: ' + scheduler_line.name)
#Update the record
scheduler_line_obj.write(cr, uid, scheduler_line_id, {'numberOfUpdates': (numberOfUpdates +1), 'lastModified': datetime.date.today()}, context=context)
My XML like this:
Problem is why i cant call the function process_demo_scheduler_queue.
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="ir_cron_scheduler_demo_action" model="ir.cron">
<field name="name">Demo scheduler</field>
<field name="user_id" ref="base.user_root"/>
<field name="interval_number">2</field>
<field name="interval_type">minutes</field>
<field name="numbercall">-1</field>
<field name="model_id" ref="model_scheduler_demo"/>
<field eval="False" name="doall"/>
<field eval="'scheduler.demo'" name="model"/>
<field eval="'process_demo_scheduler_queue'" name="function"/>
</record>
</data>
</odoo>
Which version you are using?
Odoo11 community