Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Odoo 13: How to solve CacheMiss Exception


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)

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?

like image 311
m0r7y Avatar asked Jan 26 '23 04:01

m0r7y


1 Answers

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.

Wrong:

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'

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

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 = ''
like image 194
CZoellner Avatar answered Feb 04 '23 06:02

CZoellner