تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
7510 أدوات العرض

Is it possible to dynamically create selection type field using functional fields? 

For Example : I am having a maximum limit of leaves a person can take at one type

Casual Leave : 2

Sick Leave : 3

User can take these leave with 0.5 interval, means for CL 0.5,1,1.5 and 2

I am having around 10 types of leaves.

So is it possiblt to create a selection type field dynamically in OpenERP?

الصورة الرمزية
إهمال
أفضل إجابة

You can use many2one with domain for this purpose.

You need create object "Leave" like:


    _columns = {
        'name': fields.char('Leave'),
        'type': fields.char('Type'),
        'interval': fields.char('interval'),
        }

Then create records for "Leave" with all available combination type and interval.

In object, where you need selection field, define instead many2one to "Leave" object (for example: leave_id).
And define selection filed for type (for example: type).
Now you can dinamically select available leaves, depend from type, like:

    <field name="type"/>
    <field name="leave_id" domain="[('type','=',type)]"/>

الصورة الرمزية
إهمال

Hi Vasilliy ....Can u explain with an example

الكاتب

Vasiliy, Thanks for your answer. It will be great if you can give me an example!!

أفضل إجابة

Hi, 

You can follow following link for this:

https://youtu.be/GPhgxxwprA4

Hope it helps,

Thanks

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
2
مارس 23
46551
2
ديسمبر 23
57500
0
مارس 22
2202
3
يونيو 20
10488
1
أكتوبر 19
4329