Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Diskusi
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

_inherits delegation OpenERP

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
_inheritsopenerpdelegation
1 Balas
15141 Tampilan
Avatar
omprakash
Hai Friends ,

     First I like to thank everyone for such good support for newbies . I have question regards _inherits delegation in OpenERP . 

1. For which purpose we make use of _inherits = {  'tiny.object_a': 'object_a_id' }  & _inherit = ['objectname']  ? Please explain with suitable example ?

2. After viewing code , had Question in my mind ..

         **sample code : addons / hr /hr.py**

class hr_employee(osv.osv):
    _name = "hr.employee"
    _inherits = {'resource.resource': "**resource_id**"}
    _columns = {
                     '**resource_id**': fields.many2one('resource.resource', 'Resource', ondelete='cascade', required=True),
                .................

                         }

    ......

     def unlink(self, cr, uid, ids, context=None):
              resource_ids = []
              for employee in self.browse(cr, uid, ids, context=context):
              resource_ids.append(employee.resource_id.id)
               return self.pool.get('resource.resource').unlink(cr, uid, resource_ids, context=context)
  ..........
  hr_employee()

 **In addons / hr /hr_view.xml** 

         Fields - **resource_id**  ( have not been used )

Actually what is described in this code . Please explain . If you explain both _inherit & _inherits  it will be more useful for understanding .. Please help me.


Thanks & Regards
 OMPRAKASH.A
2
Avatar
Buang
Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Jawaban Terbai

If you want to extend or customize anything for particular object/class _inherit is used. It is a single object/class inheritance.

When you use _inherit and add new fields, those fields will be added inside inherited object. No other table will be created in database.

For example I want to add one or more field(s) or I want to add/override method in sale.order then I will use:

class sale_order(osv.Model):
    _inherit = 'sale.order'
    _columns = {
        'my_field': fields.char('My New Field', size=50),
    }

    def my_new_method(self, cr, uid, ids, context=None):
        ...
        ...

If I want to use anything (fields or methods) of any object and I want to achieve multiple inheritance, then I will use _inherits which allows you to use features of any object. That means you can directly use fields and methods of inherited object.

When you use _inherits and new table is created in database. That will have your own fields and field ID of inherited object.

For example in hr.employee object resource.resource object is inherited. So you can see fields of hr.employee object and resource_id of resource.resource object.


Now lets talk about code you want to know.

def unlink(self, cr, uid, ids, context=None):
          resource_ids = []
          for employee in self.browse(cr, uid, ids, context=context):
          resource_ids.append(employee.resource_id.id)
           return self.pool.get('resource.resource').unlink(cr, uid, resource_ids, context=context)

This method will be called when I will delete any employee record.

When any employee record is deleted, resource record related to employee will also be deleted.

Have a look at What is _inherit and What is _inherits.

Hope my answer will help you.

4
Avatar
Buang
omprakash
Penulis

Hi Sudhir Arya , Thanks for immediate reply . You are such good friend for me . I will try in my code , If any doubt raise in my mind i will ask you . And once again thanks for reply

omprakash
Penulis

Hi Sudhir Arya , Finally i like to conclude - As you mentioned _inherits has the property to access (methods) of any object . Can you please explain with example . Please still not clear at this point .

Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
Create selection type field dynamically?
openerp
Avatar
Avatar
Avatar
2
Sep 23
8413
How to hide the create button dynamical tree view in openerp ? Diselesaikan
openerp
Avatar
Avatar
2
Mar 23
47616
ProgrammingError: can't adapt type 'dict' [SOLVED]
openerp
Avatar
Avatar
Avatar
2
Des 23
58736
How to use the audit app
openerp
Avatar
0
Mar 22
2954
unable to add column in res.users table Diselesaikan
_inherits
Avatar
Avatar
Avatar
Avatar
Avatar
17
Des 21
25671
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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