I am working with Odoo 18 and have inherited the state field from account.move. I added a new state (to_approve) to the selection using selection_add. However, in the status bar, the states are not displayed in the correct order (draft → to_approve → posted). Instead, they appear as draft → posted → to_approve.
Here’s my code:
/python file snippet-----------------------
state = fields.Selection(
selection_add=[("to_approve", "To Approve")],
ondelete={'to_approve': 'set default'}
)
/xml file snippet-----------------------
<field name="state" position="attributes">
<attribute name="statusbar_visible">draft,to_approve,posted</attribute>
</field>