콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

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!

관련 게시물 답글 화면 활동
2
12월 23
12926
3
7월 22
23330
2
6월 21
18677
0
9월 20
3807
0
5월 16
4225