server-ux icon indicating copy to clipboard operation
server-ux copied to clipboard

Generic "sequence" and "display_name"

Open norlinhenrik opened this issue 7 months ago • 3 comments

Here are new modules sequence and display_name, and a suggestion of how to use them in a sequence module.

Which generic features should (not) be in sequence and display_name?

  1. Is it useful for a database administrators to configure a sequence field and a display name pattern directly in the Models UI? Is it ok to store settings in ir.model?
  2. sequence.mixin: Field name: sequence_code or code?
  3. sequence.mixin: Should there be a unique constraint, and if so, should it be unique or unique per company?
  4. Is it ok that sequences and actions to Set Sequence Code are not removed when modules are uninstalled?
  5. Should a record without a name get the sequence code as the name?
  6. In project_sequence, when name is identical with sequence_code, then display_name is computed the default way, not using display_name_pattern. Is this how it should be with all models?
  7. Should the licence be AGPL or LGPL?
  8. Is the performance good? Or does display_name slow down Odoo?

I would like to get some feedback before I make pull requests to the OCA, since it is easier to develop all modules in the same branch when they depend on each other.

norlinhenrik avatar Mar 31 '25 17:03 norlinhenrik

@norlinhenrik Sorry if this is a bit of an obvious question, but why not just use Odoo's ir.sequence, in the way it's used around Odoo? What's better about the sequence module implementation?

thomaspaulb avatar Mar 31 '25 20:03 thomaspaulb

The sequence module adds a field sequence_code_field_id to ir.model so a user can select a field to store sequence codes.

create() and write() trigger @api.constrains("sequence_code_field_id") to create an ir.sequence & ir.server.action for the model.

norlinhenrik avatar Apr 01 '25 05:04 norlinhenrik

Hi @norlinhenrik these modules could indeed be useful in a number of use cases. FYI Odoo added on master (future v19) a way to pass extra arguments in view when searching / displaying m2x fields : https://github.com/odoo/odoo/pull/202534

remi-filament avatar Apr 01 '25 09:04 remi-filament

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

github-actions[bot] avatar Sep 28 '25 12:09 github-actions[bot]