How to set unique to custom field in axelor

Hi guys,
I adding a custom model in axelor
In my model, I have a code field, I want this field to be unique and automatically increments according to a sequence defined in axelor’s Sequences function.
How to set unique to custom field?
And how to set sequence to a custom field ?

Please help me. Thanks

unique is keyword to add in model variable XML or domain

you can extend or override save of any repository

1 J'aime

Hello
I did also a sequence for the Employee model.
Added a custom field (employee_internal_id) created a sequence (Employee_sequence), on save event set that value.