İçereği Atla
Odoo Menü
  • Portal
  • Ücretsiz deneyin
  • Uygulamalar
    Finans
    • Muhasebe
    • Faturalama
    • Masraf Yönetimi
    • Elektronik Çizelge (BI)
    • Belgeler
    • İmza
    Satış
    • Müşteri İlişkileri Yönetimi (CRM)
    • Satış
    • Satış Noktası Mağaza
    • Satış Noktası Restoran
    • Abonelikler
    • Kiralama
    Web Sitesi
    • Web Sitesi Oluşturucu
    • eTicaret
    • Blog
    • Forum
    • Canlı Sohbet
    • eÖğrenme
    Tedarik Zinciri
    • Envanter
    • Üretim
    • Ürün Yaşam Döngüsü Yönetimi
    • Satın Alma
    • Bakım
    • Kalite
    İnsan Kaynakları
    • Çalışanlar
    • İşe Alım
    • İzin
    • Değerlendirme
    • Referans
    • Filo Yönetimi
    Pazarlama
    • Sosyal Medyada Pazarlama
    • E-posta ile Pazarlama
    • SMS ile Pazarlama
    • Etkinlikler
    • Pazarlama Otomasyonu
    • Anket
    Hizmetler
    • Proje Yönetimi
    • Çalışma Çizelgeleri
    • Saha Hizmeti
    • Yardım Masası
    • Planlama
    • Randevular
    Verimlilik
    • Sohbet
    • Onay
    • Nesnelerin İnterneti
    • VoIP
    • Bilgi Bankası
    • WhatsApp
    Üçüncü taraf uygulamalar Odoo Stüdyo Odoo Bulut Platformu
  • Sektörler
    Perakende satış
    • Kitapçı
    • Giyim Mağazası
    • Mobilya Mağazası
    • Gıda Marketi
    • Hırdavat Dükkanı
    • Oyuncak Dükkanı
    Gıda ve Konaklama
    • Bar ve Pub
    • Restoran
    • Fast Food Restoranı
    • Konuk Evi
    • İçecek Distribütörü
    • Otel
    Gayrimenkul
    • Emlak Acentesi
    • Mimarlık Firması
    • İnşaat
    • Emlak Yönetimi
    • Bahçe Tasarımı
    • Mülk Sahipleri Derneği
    Uzmanlık
    • Muhasebe Firması
    • Odoo Partner
    • Pazarlama Ajansı
    • Hukuk Firması
    • Yetenek Kazanımı
    • Denetim ve Belgelendirme
    Üretim
    • Tekstil
    • Metal
    • Mobilyalar
    • Gıda
    • Bira fabrikası
    • Kurumsal Hediye
    Sağlık ve Spor
    • Spor Kulübü
    • Optik Mağazası
    • Fitness Merkezi
    • Sağlıklı Yaşam Merkezi
    • Eczane
    • Kuaför Salonu
    Ticaret
    • Tamirci
    • BT Donanım & Destek
    • Güneş Enerjisi Sistemleri
    • Ayakkabı İmalatçısı
    • Temizlik Hizmetleri
    • HVAC Hizmetleri
    Diğerleri
    • Kar Amacı Gütmeyen Kuruluş
    • Çevre Ajansı
    • Reklam Panosu Kiralama
    • Fotoğrafçılık
    • Bisiklet Kiralama
    • Yazılım Bayisi
    Tüm Sektörlere Göz Atın
  • Topluluk
    Öğrenim
    • Eğitim Araçları
    • Dokümantasyon
    • Sertifikasyonlar
    • Eğitim Etkinlikleri
    • Blog
    • Podcast
    Eğitim ve Gelişim
    • Eğitim Programı
    • Scale Up! İşletme Oyunu
    • Odoo'yu Ziyaret Edin
    Yazılım
    • İndirin
    • Sürümleri Kıyaslayın
    • Sürümler
    İş Birliği
    • Github
    • Forum
    • Etkinlikler
    • Çeviriler
    • Partner Olun
    • Partnerler için Hizmetler
    • Muhasebe Firmanızı Kaydettirin
    Hizmetler
    • Partner Bulun
    • Muhasebeci Bulun
    • Bir danışmanla görüşün
    • Kurulum Hizmetleri
    • Müşteri Referansları
    • Destek
    • Sürüm Yükseltme
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Demo randevusu alın
  • Fiyatlandırma
  • Yardım

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • Müşteri İlişkileri Yönetimi
  • e-Commerce
  • Muhasebe
  • Envanter
  • PoS
  • Proje Yönetimi
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
Yardım

fields function type selection

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
functionfieldselectiontype
4 Cevaplar
37358 Görünümler
Avatar
omkar

Hi Buddies.

Good morning.

I am trying this from the couple of days but no luck..

I read the data from the table and split that into selection fields list and try to return through the function..

The Function was working Fine , But I am unable to see or edit the Selection field ..

Here is My XML Code..

    <record id="hr_team_action" model="ir.actions.act_window">
        <field name="name">Team</field>
        <field name="res_model">hr.employee</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="view_id" ref="view_hr_team_tree"/>
    </record>

    <record model="ir.ui.view" id="view_hr_team_form">
        <field name="name">hr.team.form</field>
        <field name="model">hr.employee</field>
        <field name="arch" type="xml">
            <notebook position="inside">
               <page string="Team">
                    <group col="4">
                        <field name="name_related"/>
                        <field name="department_id"/>
                        <field name="work_location"/>
                        <field name="job_id"/>
                        <button name="%(act_view_hr_performancegoals_tree)d" type="action" string="Assign Goals" class="oe_link oe_edit_only" icon="STOCK_DIRECTORY_MENU"/>
                    </group>
                </page>
              </notebook>
        </field>
    </record>

    <record model="ir.ui.view" id="view_hr_team_tree">
        <field name="name">hr.team.form</field>
        <field name="model">hr.employee</field>
        <field name="type">tree</field>
        <field name="arch" type="xml">
            <tree string="Team" editable="bottom" >
                        <field name="name_related"/>
                        <field name="department_id"/>
                        <field name="work_location"/>
                        <field name="job_id"/>
                        <button name="%(act_view_hr_performancegoals_tree)d" type="action" string="Assign Goals" class="oe_link oe_edit_only" icon="STOCK_DIRECTORY_MENU"/>
            </tree>
        </field>
    </record>

...................................................................................

.py file

class hr_performancegoals(osv.osv): _name = "hr.performancegoals" _description = "Performance Goals"

 def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
     if context is None:
        context = {}
     print "Sateesh testing here",uid
     result = super(hr_performancegoals, self).fields_view_get(cr, uid, view_id,view_type, context, toolbar,submenu)
     data = result['arch']
     if uid == 1:
        L=[]
        ldata = data.split("\n")
        for var in ldata:
             if re.search("parent_id",var):
                 pass
             else:
                 L.append(var)
        reqdata =''.join(L)
        result['arch']=reqdata
     else:
        L=[]
        ldata = data.split("\n")
        for var in ldata:
             if re.search("strategic_goals",var):
                 pass
             else:
                 L.append(var)
        reqdata =''.join(L)
        result['arch']=reqdata
     return result


 def _get_objectives(self,cr,uid,ids,name,args,context=None):
     res= dict.fromkeys(ids,'')
     print "In Objectives"
     cr.execute("select objectives from hr_performancegoals")
     data = cr.dictfetchall()
     L=[]
     for i,values in enumerate(data):
         a=unicodedata.normalize('NFKD', values['objectives']).encode('ascii','ignore')
         rest=a.split(',')
         print "Here is the List:",rest
         if len(rest)!=0:
             for j,val in enumerate(rest):
                 L.append((j,val))
                 i=j
         else:
             L.append((i,rest))
     print "Value Here :",L
     res['values']=L
     return res


 def _get_employee_id(self,cr,uid,ids,name,arg,context=None):
    res = dict.fromkeys(ids, uid)
    print "sateesh testing employee_id",res   #res['employee_id'], type(res['employee_id'])
    return res

 _columns = {
'employee_id': fields.function(_get_employee_id,method=True, type='integer', string="Employee",store=True),
'strategic_goals': fields.char('Strategic Goals', required=True),
'parent_id': fields.function(_get_objectives, type='selection',method=True, string="Stratergic Goals Parent"),
'objectives' : fields.text('Objectives'),
'completion_date' : fields.date('Completion Date'),
'specific_actions_required_to_deliver_strategic_goal' : fields.text('Specific Actions Required To Deliver Strategic Goal'),
'status': fields.selection([('1','Yet To Start'),
                           ('2','In Progress'),
                           ('3','Invalid'),
                           ('4','Completed'),
                           ('5','Closed'),],
                            'Status', required=True),

}

Working with Human Resource Module

1
Avatar
Vazgeç
Avatar
Prakash
En İyi Yanıt

In python file selection functional field replace with below code it will works:-

from osv import osv, fields

SELECTION_LIST = [
   ('1','Yet To Start'),
   ('2','In Progress'),
   ('3','Invalid'),
    ('4','Completed'),
    ('5','Closed'),
]
'parent_id': fields.function(_get_objectives, type='selection',method=True,  selection=SELECTION_LIST, string="Stratergic Goals Parent"),
2
Avatar
Vazgeç
omkar
Üretici

Thanks a Lot

Avatar
wilson zauma
En İyi Yanıt

I use a function and relation with this in my_file.py:

def _buscar_shortname_alm(self, cr, uid, context=None):

        obj=self.pool.get('stock.location')
        ids = obj.search(cr, uid, [('shortcut', '!=', False),('usage','in',('internal','production'))],
            order='shortcut') 
         resultado = obj.read(cr, uid, ids, ['id','shortcut'], context)

        #convertimos a una lista de tuplas
        res = []
        for record in resultado:
            #creamos la tupla interna
            rec = []
            #convertimos a cadena el ID para crear la tupla
            rec.append(str(record['id']))
            rec.append(record['shortcut'])
            #agregamos a tupla final
            res.append(tuple(rec))
         return res

And the _columns put this:

'aux_almacen_orig': fields.selection(_buscar_shortname_alm, type="char",store=True, method=True,size=256, required=True, string="Almacen Origen" ),

Then i put this in my_file.xml

<field name="aux_almacen_orig" />

And finally this is the result. http://(www).orchidshouseperu.com/screenshots/Seleccion_041.png

1
Avatar
Vazgeç
Avatar
omkar
Üretici En İyi Yanıt

Thanks Prakash..

Thanks for your Help.

I worked in different manner and it help me in getting the tuple.

def get_objectives(self,cr,uid,ids,context):
    cr.execute("select objectives from hr_performancegoals")
     data = cr.dictfetchall()
     L=[]
     for i,values in enumerate(data):
         a=unicodedata.normalize('NFKD', values['objectives']).encode('ascii','ignore')
             L.append((str(i),rest))
     return L


'parent_id': fields.function(get_objectives, type='selection',method=True,  string="Stratergic Goals Parent"),

This work for me..

1
Avatar
Vazgeç
Avatar
TEIMI Yassine
En İyi Yanıt

Hi omkar, I have the same problem, Could you please tell me what is rest variable for ? Thanks a lot.

0
Avatar
Vazgeç
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Üye Ol
İlgili Gönderiler Cevaplar Görünümler Aktivite
Purchase Order Function Field Issue
function field
Avatar
0
Mar 15
4634
field visible as text for manager and dropdown for employee
field selection
Avatar
0
Mar 15
4411
get Id in field selection
field selection
Avatar
Avatar
1
Mar 15
9368
Function field issue
function field
Avatar
Avatar
1
Mar 15
4936
Can you check a code of my module : filed. function
function field
Avatar
Avatar
2
Mar 15
5489
Topluluk
  • Eğitim Araçları
  • Dokümantasyon
  • Forum
Açık Kaynak
  • İndirin
  • Github
  • Runbot
  • Çeviriler
Hizmetler
  • Odoo.sh Hosting
  • Destek
  • Sürüm Yükseltme
  • Özel Geliştirmeler
  • Eğitim
  • Muhasebeci Bulun
  • Partner Bulun
  • Partner Olun
Hakkında
  • Şirketimiz
  • Pazarlama Gereçleri
  • İletişim
  • Kariyer
  • Etkinlikler
  • Podcast
  • Blog
  • Müşteriler
  • Hukuki • Gizlilik
  • Güvenlik
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo, müşteri ilişkileri yönetimi, eTicaret, muhasebe, envanter, satış noktası, proje yönetimi gibi şirketinizin tüm ihtiyaçlarını karşılayan bir açık kaynak işletme uygulamaları paketidir.

Odoo’nun eşsiz değer önermesi, aynı anda hem kullanımının çok kolay olup hem de tamamen entegre olmasıdır.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now