İç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 to get value from a radio button in a form

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
xmlformradiobuttonv15
1 Cevapla
4395 Görünümler
Avatar
luca li

Hello, 

I want to create an object from the website, i can catch a simple field but i dont undetstand how to do with radio. When i tried i only got "on" value

So here i want to have a field with 3 radio for the remediation_type (soil,choice2,choice3-

here is my controller 

from odoo import http
from odoo.http import request


class Estimate(http.Controller):

@http.route('/estimate_webform/', type="http",auth="public",website="true")
def patient_webform(self,**kw):
return http.request.render('theme_haemertest.create_estimate',{})

@http.route('/create/estimate/', type="http",auth="public",website="true")
def create_estimate(self, **kw):
estimate = request.env['haemer.estimate'].sudo().create({
'owner': kw.get('nowner'),
'name': kw.get('name'),
'address': kw.get('address'),
'latitude': kw.get('latitude'),
'longitude': kw.get('longitude'),
'past_activity': kw.get('past_activity'),
'future_activity': kw.get('future_activity'),
'remediation_type': kw.get('remediation_type'),
'volume': kw.get('volume'),
'density': kw.get('density'),
'humidity': kw.get('humidity'),
'porosity': kw.get('porosity'),
})
vals = {
'estimate': estimate,
}
return request.render("theme_haemertest.create_estimate", vals)

my model : 

from odoo import models, fields

class HaemertestEstimate (models.Model):
_name= "haemer.estimate"
_description = "Estimate's customer"

owner = fields.Char(string='Owner')
name = fields.Char(string='Name')
address = fields.Char(string='Address')
latitude = fields.Integer(string='Latitude')
longitude = fields.Integer(string='Longitude')
past_activity = fields.Char(string='Past Activity')
future_activity = fields.Char(string='Future Activity')
remediation_type = fields.Selection([
('soil', 'Soil'),
('n2', 'Choice2'),
('n3', 'Choice3'),
], required=True, default='soil', tracking=True)
volume = fields.Integer(string='Volume')
density = fields.Integer(string='Density')
humidity = fields.Float(string='Humidity')
porosity = fields.Float(string='Porosity')



xml version="1.0" encoding="UTF-8" ?>

id="menu_estimate_form" model="website.menu">
name="name">create estimate
name="url">/estimate_webform
name="parent_id" ref="website.main_menu"/>
name="sequence">75

id="create_estimate" name="Create Estimate">
t-call="website.layout">
id="wrap">
class="oe_structure">
class="container">
role="form" action="/create/estimate" method="post">
type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
class="form-group">

type="text" name="name" t-att-value="owner" id="owner"
class="form-control" placeholder="owner" required ="required"/>

class="form-group">

type="text" name="name" t-att-value="name" id="name"
class="form-control" placeholder="name" required ="required"/>

class="form-group">

type="text" name="address" t-att-value="address" id="address"
class="form-control" placeholder="address" required ="required"/>

class="form-group">

type="number" step ="any" name="latitude" t-att-value="latitude" id="latitude"
class="form-control" placeholder="0" required ="required"/>

class="form-group">

type="number" step ="any" name="longitude" t-att-value="longitude" id="longitude"
class="form-control" placeholder="0" required ="required"/>

class="form-group">

type="text" name="past_activity" t-att-value="past_activity" id="past_activity"
class="form-control" placeholder="past activity" required ="required"/>

class="form-group">

type="text" name="future_activity" t-att-value="future_activity" id="future_activity"
class="form-control" placeholder="future activity" required ="required"/>

class="form-group">






class="form-group">

type="number" step ="any" name="volume" t-att-value="volume" id="volume"
class="form-control" placeholder="0" required ="required"/>

class="form-group">

type="number" step ="any" name="density" t-att-value="density" id="density"
class="form-control" placeholder="0" required ="required"/>

class="form-group">

type="number" step ="any" name="humidity" t-att-value="humidity" id="humidity"
class="form-control" placeholder="0" required ="required"
min="0" max="1"/>

class="form-group">

type="number" step ="any" name="porosity" t-att-value="porosity" id="porosity"
class="form-control" placeholder="0" required ="required"
min="0" max="1"/>

class="clearfix oe_login_buttons">









 

0
Avatar
Vazgeç
luca li
Üretici

any one ?

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

Hi,

Add the selection field as radio button as follows.

<div>


    <input type="radio" id="Choice1" name="remediation_type" value="soil" />


    <label for="Choice1">Soil</label>


    <input type="radio" id="Choice2" name="remediation_type" value="n2" />


    <label for="Choice2">Choice2</label>


    <input type="radio" id="Choice3" name="remediation_type" value="n3" />


    <label for="Choice3">Choice3</label>


</div>

Inside the controller, can access the field as follows:-

kw.get('remediation_type')

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
how to set radio widget as a required field? Çözüldü
radiobutton v15
Avatar
Avatar
Avatar
2
Kas 22
4729
How to set a domain
domain xml v15
Avatar
Avatar
1
Kas 25
391
Error while creating template for pdf
pdf xml v15
Avatar
Avatar
1
May 25
4031
How do i add stages for odoo 15 kanban view?
views xml v15
Avatar
Avatar
1
May 24
3856
ValueError: Wrong value for ir.ui.view.type: 'data'
xml valueerror v15
Avatar
1
Nis 24
3277
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