Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Why I get Uncaught Record not correctly loaded error?

By
Juan Formoso
on 6/15/15, 8:08 AM 676 views

In the res.partner form view of a company, there is a tab named Contacts, in which we can see all the employees who work for that company. If you click on Edit, you will be able to see a X button, and if you click on it, the record of the employee is removed from res.partner. I'd like to add to that button a confirm message. As the attribute confirm does not work in this case (I guess because it only works on status bars), I had to create a wizard to emulate the confirm message.

Everything seems to be OK, but in the wizard, when I click in Confirm, I get a JS error:

Uncaught Record not correctly loaded

And in spite of this error, the record is removed from the database correctly. How can I avoid that? I tried adding the options reload_on_button and always_reload (both True) to the child_ids field (as you may know, this one is the one2many pointing to the employees), but nothing happened.

This is the Confirm wizard button code:

@api.one
def unlink_partner_from_company(self):
     partners = self.env['res.partner'].search([('id', 'in', self.env.context.get('active_ids', []))]
     return partners.unlink()

I've also tried returning this instead of returning the result of the unlink:

     return {
          'type': 'ir.actions.client',
          'tag': 'reload',
     }

But the same error arises. Can anyone help me please?!

I've just checked that it's not a issue of time, because I've added a delay of 20 seconds after the deletion, and then I called again the form with an action window. The error is still there!

Juan Formoso
on 6/16/15, 4:35 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 6/15/15, 8:08 AM
Seen: 676 times
Last updated: 6/16/15, 4:35 AM