Odoo Help


How to make Prefix of the sequence is the text of selection field?

Rokon Uddin
on 7/22/14, 2:28 AM 1,496 views

I have a module called archive the user can select and create new storage type like- DVD, Tape, LTO etc from selection field. Now I want my storage accession number to be a sequence and prfix of the squence will change depanding on selection filed. e.g: if user select LTO, Accession number will be like LTO-001, LTO-002 like wise if user select DVD accession will be DVD-001, DVD002. How can I do this?




| 5 4 6
Zagreb | Karlovac, Croatia

there is only 10 kind of people the ones that understand binary ... and others

On 7/22/14, 4:14 AM

The question here is do you want separate sequences for each prefix, or one sequence with diufferent prefixes depending on selection.

For case with separate sequences, first define sequece for each prefix / selection, then in method that takes sequence number refer to selected sequence.
Or, if you need only one sequence and use it with any of selected prefixes, you create a sigle sequence without prefix, and in method that creates sequence simple add selected prefix once you got the sequence number...





| 5 4 7
Bikaner, India

OpenERP Developer at SunARC Technology

On 7/22/14, 5:08 AM

1) Create Sequence Type and Sequence in the xml Fle based on the selection ex: (LTO, DVD). 

2) Pass the context value in the selection field in the xml file.

3) Python override the create method and check the context selection value based on that call the sequence value.

Refer the below link:-




Rokon Uddin
On 7/22/14, 4:26 AM

@Bole, I want different sequence number for different prefix. But I cant figure out how to set appropriate prefix depending on Selection of Storage type.

Thanks for the response... 

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 7/22/14, 2:28 AM
Seen: 1496 times
Last updated: 3/16/15, 8:10 AM