To change the order of actions on a form, you can use the sequence field. However, the sequence field is not available on the ir.actions.report model, which is the model for report actions.
As a workaround, you can try to create a new action that inherits from the ir.actions.report model and adds the sequence field. You can then use this new action for your reports and set the sequence value to control the order of the actions.
Here is an example of how you can do this:
- Create a new model that inherits from ir.actions.report and adds the sequence field:
class ReportAction(models.Model):
_inherit = 'ir.actions.report'
sequence = fields.Integer()
- Update the ir.actions.act_window model to use the new ReportAction model instead of the default ir.actions.report model:
class ActWindow(models.Model):
_inherit = 'ir.actions.act_window'
report_id = fields.Many2one('report.action', 'Report')
- When creating a new report action, use the ReportAction model instead of the ir.actions.report model and set the sequence value to control the order of the actions:
ReportAction.create({
'name': 'My Report',
'model': 'my.model',
'report_type': 'qweb-pdf',
'sequence': 1,
})
This should allow you to control the order of the actions on the form using the sequence field.
You can add sequence to server action :)