Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
5065 Lượt xem

Hello everybody!!

I have inherited wthe write function of hr.contract model.

ANd now i want to open a popup of hr_payslip model.

I have tried the code above but it doesnt work:


@api.multi

 def write(self, vals):

   super(SoldeToutCompte, self).write(vals)

  if vals.get('state') == 'close':

           return  {

'name': "SOLDE",

         'view_type': 'form',

         'res_model': 'hr.employee',

         'view_mode': 'form',

         'nodestroy': True,

         'target': 'new',

         'flags': {'form': {'action_buttons': True}}, 

          'type': 'ir.actions.act_window',

     }

Ảnh đại diện
Huỷ bỏ
Tác giả

can anyone help plz!!!

Hi, i think it wont be possible with the write function, i know that we cannot return a view from onchange function, may be similar case in the write function. One thing to note is that we have to return "super(SoldeToutCompte, self).write(vals)"

Niyas is right, you cannot return a view from a write() function, as this function should return a record (more specifically the record that was just written). Returning a view from a write function does not make sense, as write() will be called internally by odoo.

What are you trying to accomplish? Maybe someone can suggest an alternative approach.

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 1 24
1102
1
thg 5 21
9120
1
thg 11 17
11232
2
thg 8 16
5410
0
thg 5 24
1158