Help

0

How to Edit calendar view saved record by passing context or else way?

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

Avatar
Discard