本文介绍了Odoo 13:如何解决 CacheMiss 异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在 Odoo 13 上生成 .docx 文档,我检查了report_py3o"模块,但没有适用于 Odoo 13 的版本,所以我决定进行某种迁移(我刚刚删除了@api.multi")Odoo 12 版本到 Odoo 13.我收到类似 odoo.exceptions.CacheMiss: ('ir.actions.report(85,).is_py3o_report_not_available', None) 的错误,我的数据库已损坏.这是完整的日志:错误日志.


I'm working on generating a .docx document on Odoo 13, I checked the "report_py3o" module but there is no version for Odoo 13 so I decided to some kind of migrate (I just deleted the "@api.multi") the Odoo 12 version to Odoo 13. I got an error like odoo.exceptions.CacheMiss: ('ir.actions.report(85,).is_py3o_report_not_available', None) and my database was corrupted. Here is the full log : error log.

odoo.exceptions.CacheMiss: ('ir.actions.report(85,).is_py3o_report_not_available', None)

我也检查了 aero 模块,但它仅适用于 8.0 和 9.0.
你能帮助我吗?你有替代品吗?

I also checked the aero module but it is avaible for 8.0 and 9.0 only.
Can you help me? Do you have alternative for me?

推荐答案

我没有仔细研究过,但是当计算字段方法没有计算值时,通常会抛出 CacheMiss对于它获得的每条记录.

I haven't watched into it, but a CacheMiss is usually thrown, when a computed field method isn't computing a value for every record it gets.

错误:

computed_char_field = fields.Char(compute="_compute_computed_char_field")
some_boolean = fields.Boolean()

def _compute_computed_char_field(self):
    for record in self:
        if record.some_boolean:
            record.computed_char_field = 'something'

如果有一些记录带有 some_boolean == False,你会在调用它们时得到一个 CacheMiss(例如在列表视图中)

If there are some records with some_boolean == False you will get a CacheMiss when calling them (in a list view for example)

正确的做法是总是设置一个值,在这个例子中只添加一个 else 分支:

Correct way is to always set a value, in this example just add an else branch:

def _compute_computed_char_field(self):
    for record in self:
        if record.some_boolean:
            record.computed_char_field = 'something'
        else:
            record.computed_char_field = ''

这篇关于Odoo 13:如何解决 CacheMiss 异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 09:44