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

How can I save custom many2many fields inside configuration settings of website Odoo 13?

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
configurationmany2manywebsiteres.configOdoo13.0
3 Cevaplar
11293 Görünümler
Avatar
Rob Bro

I was trying to make two many2many fields inside configuration settings of website. I could make both fields fields but I was not able to save the multiple entered values.  This is the error that occured


 File "/home/RobertD'Souza/Desktop/odoo-13.0/odoo/models.py", line 1688, in _add_missing_default_values     if self._fields[name].type == 'many2many' and value and isinstance(value[0], int):
KeyError: 'web_products'



And this is the code I used


class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
web_product = fields.Many2many('product.template', string="Website Products")
web_category = fields.Many2many('product.public.category', string="Website Categories")

def set_values(self):
res = super(ResConfigSettings, self).set_values()
self.env['ir.config_parameter'].set_param('website_product_visibility.web_product', self.web_product)
self.env['ir.config_parameter'].set_param('website_product_visibility.web_category', self.web_category)
return res

@api.model
def get_values(self):
res = super(ResConfigSettings, self).get_values()
ICPsudo = self.env['ir.config_parameter'].sudo()
web_product = ICPsudo.get_param('website_product_visibility.web_product')
web_category = ICPsudo.get_param('website_product_visibility.web_category')
res.update(
web_products=web_product,
web_categories=web_category
)
return res
1
Avatar
Vazgeç
Avatar
Niyas Raphy (Walnut Software Solutions)
En İyi Yanıt

Hi,

You can try this code.

class XYZConfigSettings(models.TransientModel):
_name = 'xyz.config.settings'
_inherit = 'res.config.settings'

product_ids = fields.Many2many('product.product', string="Products")

@api.model
def get_default_values(self, fields):
IrValues = self.env['ir.values'].sudo()
product_ids = IrValues.get_default('xyz.config.settings', 'product_ids')
lines = False
if product_ids:
lines = [(6, 0, product_ids)]
return {
'product_ids': lines,
}

@api.multi
def set_default_values(self):
IrValues = self.env['ir.values'].sudo()
IrValues.set_default('xyz.config.settings', 'product_ids', self.product_ids.ids)

For adding settings and saving values in settings, see: How To Add Settings/Configuration For Module in Odoo

To add many2many Field in the Settings in Odoo12 See this: How To Save Many2many Field Value In Settings Odoo

Thanks


1
Avatar
Vazgeç
Rob Bro
Üretici

Thank you for answering Niyas, unfortunately it does not work as most of your code is written in Odoo 10 and I'm doing in Odoo 13. I've tried changing ir.values to ir.default and other necessary changes to fields but still not working.

Niyas Raphy (Walnut Software Solutions)

https://www.youtube.com/watch?v=-n7Ttx1Czdw

Rob Bro
Üretici

Thank you so much, this was what I needed.

Avatar
Cybrosys Techno Solutions Pvt.Ltd
En İyi Yanıt

Hi,

You can refer the blog below for storing a many2many field in settings of Odoo 13

https://www.cybrosys.com/blog/how-to-save-many2many-field-in-odoo-13-settings

Regards

2
Avatar
Vazgeç
Avatar
Anusha
En İyi Yanıt

Hi,

   Refer this https://www.odoo.com/forum/help-1/question/how-to-get-and-set-a-many2many-field-in-res-config-settings-odoo-12-159437        Make changes accordingly   

1
Avatar
Vazgeç
Rob Bro
Üretici

It is working fine with a text field, the problem only arises during the usage of many2many fields.

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
Store Many2many field in Configuration settings odoo13
configuration store many2many res.config Odoo13.0
Avatar
Avatar
Avatar
Avatar
3
Ağu 25
7537
How to set Configuration Values from Database for mandatory_billing_fields
configuration databsecursor website website_sale res.config
Avatar
0
Mar 15
5194
Odoo 15 - Can't properly update custom many2many field from website
many2many website
Avatar
0
May 22
3266
Record in many2many is not visible when click save
many2many Odoo13.0
Avatar
Avatar
1
Şub 21
4495
Odoo 16 - Programatically setup 'Free Sign Up'
configuration signup website
Avatar
Avatar
1
May 24
2700
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