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:
partners = self.env['res.partner'].search([('id', 'in', self.env.context.get('active_ids', ))]
I've also tried returning this instead of returning the result of the unlink:
But the same error arises. Can anyone help me please?!
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
|Asked: 6/15/15, 8:08 AM|
|Seen: 672 times|
|Last updated: 6/16/15, 4:35 AM|