Skip to Content

Welcome!

human made "AI" (advises & inputs) forum by Odoo professionals, experts and enthusiasts challenging real use cases with standard solutions!

-> solutions should be applicable for Odoo community or online (at the limit with Studio), all without custom modules.

This question has been flagged
1 Reply
221 Views

when creating contacts, having the option to add the reference manually is good, but if it is not added, the reference should be added automatically based on a sequence or ID

-> even nicer would be to ensure that the added value is unique per contact!

Avatar
Discard
Author
  • activate the developer mode and go to settings->technical-> automation rules (in Odoo enterprise it can also be done opening studio from contact app)
  • for sequence based reference, create the following sequence (with required prefix and/or suffix) and automation:


  • to create reference based on contact ID, there are options to also define size and prefix:

    for existing contacts, the ref could also be updated with the ID, i.e. with the following server/contextual action:


-> options to auto add ID to ref on contact creation, using python code to add "size" or "prefix"

  • 5 digits:
  • Prefix: "C"


  • code to set digits and prefix
for record in records:
    if not record.ref:
        record.write({'ref': 'C' + str(record.id).zfill(5)})


  • additional action to certify "unique" references:
Avatar
Discard
Related Posts Replies Views Activity
1
Aug 25
138
1
Mar 26
103
2
Mar 26
200
2
Mar 26
246
1
Aug 25
150