talkincode 2020-01-11
错误的示范:
from odoo import api, fields, models from dateutil.relativedelta import relativedelta from ..controllers.cls_get_trans_info import SpiderTrans from odoo import exceptions import gevent import logging from gevent import monkey monkey.patch_all() # 这是一个错误的示例 class ClassName(models.Model): _name = 'model.name' ...
正确的示范:
from odoo import api, fields, models from dateutil.relativedelta import relativedelta from ..controllers.cls_get_trans_info import SpiderTrans from odoo import exceptions import gevent import logging from gevent import monkey monkey.patch_all() # 这是一个错误的示例 class ClassName(models.Model): _name = 'model.name field_name= fields.Char() def func(self): monkey.patch_all() #猴子补丁需要在该位置调用