İç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

Odoo docs Chapter 12: Inheritance

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
developmentdebug
1 Cevapla
1741 Görünümler
Avatar
Kareem
Python Inheritance -> 

 Exercise

Add business logic to the CRUD methods.

  • Prevent deletion of a property if its state is not ‘New’ or ‘Cancelled’

Tip: create a new method with the example)

any help of what self do

vals : data send from form

self : ?????

it's a way to query the data from the data base .

​or

​it 's have the context send from ui and if it's the context how can i debug or print this object to navigate throw it's member




@api.model_create_multi
def create(self, vals):
for val in vals:
# get estate_property
estate_property = self.env["estate.property"].browse(val["property_id"])

estate_property.state = "offer_Received"
# get list of estate_property_offers from estate_property
estate_property_offers = estate_property.offer_ids

new_val = val["price"]
max_all_value_before_save = max(estate_property_offers.mapped("price"), default=0.0)

if new_val < max_all_value_before_save:
raise UserError("Price must bigger than the highest offers")

return super().create(vals)
1
Avatar
Vazgeç
Kareem
Üretici

thank u  Chathura , your answer help me lot 


In your code, create(self, vals) is a method being decorated with @api.model_create_multi, which means,

  • self is the model class ===> estate.property
  • vals is a list of dictionaries containing the values to create multiple records --> = offer_ids with id == 0 
  • print(vals)


estate_property = self.env["estate.property"].browse(val["property_id"])

so this code working because  estate.property is the model class 

 and i get estate_property_offers from estate.property


self.env["estate.property.type"].browse(val["property_type_id"]) --> throw error 

but this not, so if i want to get to any look up i need deal with model class estate.property  first

is that's right  and if i want to query estate_property_offers  it's have another  method 

@api.model_create_multi


def create(self, vals):
for val in vals:
# get estate_property
estate_property = self.env["estate.property"].browse(val["property_id"])

estate_property.state = "offer_Received"
# get list of estate_property_offers from estate_property
estate_property_offers = estate_property.offer_ids

new_val = val["price"]
max_all_value_before_save = max(estate_property_offers.mapped("price"), default=0.0)

if new_val < max_all_value_before_save:
raise UserError("Price must bigger than the highest offers")

return super().create(vals)



Avatar
Chathura Munasinghe
En İyi Yanıt

Hello Kareem,

In Odoo, self represents the current object instance. When you define methods in an Odoo model, self is the first parameter and it refers to,

  1. In a regular method - The recordset (collection of records) you're working with
  2. In the @api.model decorated methods - The model class itself (not a specific record)

In your code, create(self, vals) is a method being decorated with @api.model_create_multi, which means,

  • self is the model class
  • vals is a list of dictionaries containing the values to create multiple records

Hope this helps.

1
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
(((guia-ayuda)))¿Cómo llamar a Latam Chile desde celular?
development debug
Avatar
0
Ara 25
1
Testing of computed field in Odoo 18 extension dev
development debug
Avatar
1
Kas 25
614
How do I correctly create a calculated field to sum two other field values in Odoo Studio (Odoo Online)? Çözüldü
development debug
Avatar
Avatar
2
Kas 25
734
How can I make buttons in Odoo 18? Çözüldü
development debug
Avatar
Avatar
Avatar
3
Eyl 25
1733
Problem when creating my first module locally
development debug
Avatar
Avatar
Avatar
Avatar
Avatar
4
Ağu 25
2193
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