2016-03-18 28 views
0

我在评估代码时得到属性错误,代码对odoo 8正常工作,但在odoo 9中它给出错误。odoo 9 AttributeError:'NoneType'对象没有属性'find'

请给我解决方案。这里下面

是我的代码


def approve_loan(self ,cr ,uid ,ids ,context=None): 
    move_pool = self.pool.get('account.move') 
    period_pool = self.pool.get('account.period') 
    timenow = time.strftime('%Y-%m-%d') 
    loan_slip = self.browse(cr ,uid ,ids)[0] 
    line_ids = [] 
    # get period 
    ctx = dict(context or {}, account_period_prefer_normal=True) 
    search_periods = period_pool.find(cr, uid, loan_slip.start_date, context=ctx) 
    period_id = search_periods[0] 
+1

因此'period_pool'必须是'None',所以'self.pool.get()'返回'None'。 – cdarke

+0

你能提供错误堆栈吗? – Bhuro

回答

0

为什么你的错误

没有在模型中不存在的时刻回来了。

可能原因返回None

  • 你可能没有所需模式 “account.period” 模块。 (你应该考虑将它添加到你的模块的依赖关系中。)
  • Odoo更改了它们的模块,以便模型“account.period”不再存在(您应该弄清楚它被替换的代码并编辑代码以使用新的Odoo9代码)
+0

我试图找出代替'account.period'的替换模型,因为我是odoo的新手,我没有得到。无论如何,感谢您的亲切帮助。 – Sohan

相关问题