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

Inherit partner_id from account.payment with different domain. How to do it?

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
inheritancepaymentsodoo12.0
2 Cevaplar
6796 Görünümler
Avatar
Paulo Matos

Hello everyone,

I am working with Odoo 12 and having a problem on setting a domain on a form view for the account.payments model.

What I need to do is to show only users (partner_id) that has the field "parent_id" = False under partner_id field.

I have successfully tried on the account.invoice and changed the xml for the form view to:

       <record id="mymodule_form_view_account_invoice" model="ir.ui.view">
           <field name="name">Account Invoice Hide Children Partners</field>
           <field name="model">account.invoice</field>
           <field name="inherit_id" ref="account.invoice_form"/>
           <field name="arch" type="xml">
                <xpath expr="//field[@name='partner_id']" position="replace">
                       <field string="Customer" name="partner_id" widget="res_partner_many2one" context="{'search_default_customer':1, 'show_address': 1, 'default_is_company': True, 'show_vat': True}" options="{"always_reload": True, "no_quick_create": True}" domain="[('customer', '=', True),('parent_id', '=', False)]" required="1"/>
                </xpath>
          </field>
      </record>

I was able to hide partners with "parent_id" using the domain:

       domain="[('customer', '=', True),('parent_id', '=', False)]" required="1"

Tried to do the same for the account.payment model and was unable to achieve what I want.

I can see that on the account.payment form view there's a "partner_id" field and tried to:

       <field name="partner_id" domain="[('parent_id', '=', False)]" attrs="{'required': [('state', '=', 'draft'), ('payment_type', 'in', ('inbound', 'outbound'))], 'invisible': [('payment_type', 'not in', ('inbound', 'outbound'))], 'readonly': [('state', '!=', 'draft')]}" context="{'default_is_company': True, 'default_supplier': payment_type == 'outbound', 'default_customer': payment_type == 'inbound'}"/>

...and it does not work.

Using debug mode with mouse over the field, I can see that the domain is applied but it simple does not work.

Then, I have noticed that, in fact there is no "partner_id" on the account.payment form. This field in on the "account.abstract.payment" abstract model that is shared among models which allows to register payments.

Since I cannot find any related xml id for this model for changing the partner_id default values, I have tried to directly (for testing purposes) change the field definition to:

      _name = "account.abstract.payment"
      ....
      ....
      partner_id = fields.Many2one('res.partner', string='Partner', domain=lambda self: [("parent_id", "=", "False")])

Even adding the domain above on the field definition, I am unable to achieve what I need.

Can anyone help me please?

Thank you all in advance

Best regards

PM

0
Avatar
Vazgeç
Avatar
Avinash Nk
En İyi Yanıt

Hello Paulo Matos,

Like the way you expected, this problem is not because of that

This is happening because there is an onchange function in account.payment model that returns the domain of the partner_id.

So even if you put some domains in XML, it overrides by that function.

This onchange function is work when you change the partner_type field. so it will always execute when you create a new record.

So better you have to override that function.

Like this.


@api.onchange('partner_type')
def _onchange_partner_type(self):
self.ensure_one()
# Set partner_id domain
if self.partner_type:
return {'domain': {'partner_id': [(self.partner_type, '=', True), ('parent_id', '=', False)]}}



Code is not tested. I hope it will work.

Anyway, I think you get some idea about this.


Edited Part:

----

This code is for inheriting the function instead of the override.

@api.onchange('partner_type')
def _onchange_partner_type(self):
res = super(YourClass, self)._onchange_partner_type()
if 'domain' in res:
if 'partner_id' in res['domain']:
res['domain']['partner_id'].append(('parent_id', '=', False))
else:
res['domain']['partner_id'] = [('parent_id', '=', False)]
return res
else:
return {'domain': {'partner_id': [('parent_id', '=', False)]}}


-----

Thanks & Regards

Avinash N K


1
Avatar
Vazgeç
Paulo Matos
Üretici

@Avinash,

Thank you very much for your help and time.

The code itself did not work but with your help I get an idea of what the problem is.

Thank you very very much

Best regards

PM

Avinash Nk

Hi EuroGold,

I update some code for you. check if it helps you.

Thanks

Paulo Matos
Üretici

@Avinash,,

Thank you once again.

Your code worked exactly as expected.

Thank you very much once again

Best regards

PM

Avatar
Arturo Velázquez
En İyi Yanıt

Hello Avinash & Paulo.

I'm facing the same issue, I am unable to change the domain of partner_id field on account.payments model.  I see Avinash posted the solution to this problem, but I don't know how and where to put the code for inherit the onchange function.  Can someone put me in the right direction?  Best regards

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
Inherit a method without copy/paste full original code Çözüldü
inheritance odoo12.0
Avatar
Avatar
1
Eyl 19
4548
How to inherit view and add widget in Odoo 12CE ? Çözüldü
form inheritance odoo12.0
Avatar
1
Ağu 23
6677
how to use model inheritance on the existing Product model to add some field for my new module ? Çözüldü
inheritance product.product Module odoo12.0
Avatar
Avatar
Avatar
4
Nis 19
9320
Expected singleton: hr.emp.travel.location(62, 63)
odoo12.0
Avatar
Avatar
Avatar
2
Eki 25
1994
When registering payment, i get "can't create a new payment without an outstanding payments/receipts account set"
payments
Avatar
Avatar
1
Nis 25
2994
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