1.安装第三方模块queue_job
queue/queue_job at 16.0 · OCA/queue · GitHub
2.odoo配置文件,启动多workers
workers = 3 proxy_mode = True server_wide_modules = web,queue_job [queue_job] channels = root:2
3.使用方法
from odoo import models, fields, api class MyModel(models.Model): _name = 'my.model' def my_method(self, a, k=None): _logger.info('executed with a: %s and k: %s', a, k) class MyOtherModel(models.Model): _name = 'my.other.model' def button_do_stuff(self): self.env['my.model'].with_delay().my_method('a', k=2)
4.
标签:Odoo16,self,queue,models,job,model,my From: https://www.cnblogs.com/wangdianchao/p/17849830.html