Odoo Help

Welcome!

This community 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.

0

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

By
Rokon Uddin
on 7/22/14, 2:28 AM 693 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?

0

Bole

--Bole--
2385
| 5 4 6
Zagreb | Karlovac, Croatia
--Bole--

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

Bole
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...

 

0

Prakash

--Prakash--
3173
| 5 4 7
Bikaner, India
--Prakash--

OpenERP Devloper at SunARC Technology

Prakash
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:-

https://www.odoo.com/forum/help-1/question/auto-generated-employee-id-according-to-their-company-name-in-employee-profile-help-me-to-solve-47967#answer-48419

https://openerp.my.openerp.com/nl_NL/forum/help-1/question/passing-field-values-with-context-in-wizard-47408

 

0
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... 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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