Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
335 Vistas

"Trying to navigate to the next record in a form view using a server action as a start event for further steps. So far, I have been unsuccessful. Thanks for your help! In the following example, nothing happens:"


def action_next_record(records):

    for record in records:

        # Nächsten Datensatz suchen

        next_record = record.search([('id', '>', next_record.id,

                "target": "current",

            }


Avatar
Descartar
Autor Mejor respuesta

Thank you for your help, but nothing happens. To be on the safe side, I also used sale.order(modul)  with the following code:

def action_next_record(self):

    for record in self:

        next_record = self.search([('id', '>', record.id)], limit=1, order='id ASC')

        if next_record:

            return {

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

                'res_model': 'sale.order',

                'view_mode': 'form',

                'res_id': next_record.id,

                'target': 'new',

            }

Avatar
Descartar
Mejor respuesta

Hello Peter Kathriner,


To achieve the desired functionality of navigating to the next record in a form view, you need to return an action with the respective model and ID.

For example, in the case of a Sale Order, you can try using the following approach:


//Code in Comment//


Hope this Helps,

If you need any help in customization feel free to contact us.


Thanks & Regards,

Email:  odoo@aktivsoftware.com           

Skype: kalpeshmaheshwari


Avatar
Descartar

Code:

def action_next_record(self):
for record in self:
next_record = self.search([('id', '>', record.id)], limit=1, order='id ASC')
if next_record:
return {
'type': 'ir.actions.act_window',
'res_model': 'sale.order',
'view_mode': 'form',
'res_id': next_record.id,
'target': 'new',
}