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

Hi Friends. ,

In 'stock.picking' model, I create two records for 'my.model'.

def _create_check_record(self, vals):
self.ensure_one()
qa_check_rec = self.env['my.model'].create(vals)
return qa_check_rec

def action_check(self):
results = self._parse_vals()
for val in results:
print("val =========", val)
qa_check_rec = self._create_check_record(val)

​return {
'res_model': 'my.model',
'res_id': qa_check_rec.id,
​'type': 'ir.actions.act_window',
​'view_mode': 'form',
​'view_id': self.env.ref('my.model.check_form_view').id,
​}


After the creation, it returns one record of form view of 'my.model'. How can I let it display two created records' form views.  

Thank you very much for  shed light on this.



Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi Crbrosys,

In Od0017 Enterprise Quality module, below pop-up window allows to show two windows by clicking "Previous" button. This window appears after clicking "Quality Check" button on the top left. What is the logic to get such pop-up window?    


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

The form view typically displays a single record at a time, so opening multiple form views simultaneously for different records isn't directly supported.


If you need to display multiple records simultaneously, you might consider using a tree view instead of a form view. A tree view allows you to display multiple records in a tabular format, and users can click on individual records to view their details in a form view.


def _create_check_record(self, vals):

    self.ensure_one()

    qa_check_rec = self.env['my.model'].create(vals)

    return qa_check_rec


def action_check(self):

    results = self._parse_vals()

    for val in results:

        print("val =========", val)

        qa_check_rec = self._create_check_record(val)

return {

    'res_model': 'my.model',

    'res_id': qa_check_rec.id,  

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

    'view_mode': 'tree',

    'view_id': self.env.ref('my.model.check_form_view').id,


Hope it Helps



Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 5 25
2095
2
thg 5 25
5416
1
thg 3 25
1330
4
thg 3 25
4108
V17 Tree, Form view Đã xử lý
1
thg 3 25
1058