跳至內容
選單
此問題已被標幟
4835 瀏覽次數

Hello all,

I opened wizard(calendar view) on button.And by selecting blank space on calendar view i created new records. But i'm not able to edit previous record. By clicking saved records no action happened. In normal view(without wizard) i'm able to edit record but it's not work on wizard. So, Anybody can provide solution for this problem, that i can edit record on wizard by passing context or any other way. 

My Python Code is below:

    def farewell_room_calendar_book(self):

        ir_model_data = self.env['ir.model.data']

        try:

            view_id = ir_model_data.get_object_reference('P2N_Sales', 'view_farewell_room_calendar_calendar')[1]

        except ValueError:

            view_id = False

        record_id = self.env['farewell.calendar.booking'].search([])

        if record_id:

            record = record_id.ids

        else:

            record = False

        ctx = dict()

        ctx.update({

            'default_pack_number': self.id,

            'default_so_number': self.so_number.id,

        })

        res = {

            # 'name': record_id1,

            'view_type': 'form',

            'view_mode': 'tree',

            'views': [(view_id, 'calendar')],

            'res_model': 'farewell.calendar.booking',

            'view_id': view_id,

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

            'res_id': record,

            'domain': ['|',('state', '=', 'sale'),('pack_number', '=', self.id)],

            'target': 'new',

            # 'flags': {'form': {'action_buttons': True, 'options': {'mode': 'edit'}}},

            'context': ctx,

        }

        return res




Thanks in advance

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
5
1月 20
4005
0
8月 22
2054
1
7月 22
19666
0
4月 22
2757
3
9月 21
2941