跳至内容
菜单
此问题已终结
3 回复
8445 查看

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?

形象
丢弃
最佳答案

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

 

形象
丢弃
编写者 最佳答案

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

形象
丢弃
最佳答案

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

 

形象
丢弃