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

add filed to signup page

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
selectionsignup
5 Cevaplar
3347 Görünümler
Avatar
zaynab ibrahim

i add a custom filed (selection field "sex") to res.partner and i want to add it to sign up page , how to do that?

0
Avatar
Vazgeç
Avatar
Mily Shajan
En İyi Yanıt

Hi

Inherit the auth.signup.fields and add the following template into it,it shows gender in the signup form

<template id="signup_customisation_gender" inherit_id="auth_signup.fields">
   <xpath expr="//div[hasclass('field-confirm_password')]" position="after">
        <label for="gender">gender</label>
           <input type="text" class="form-control form-control-sm"
                  name="gender" id="gender"/>
   </xpath>
</template>

Add the gender from partner in the controller

class WebAuthSignup(AuthSignupHome):

@http.route('/web/signup', type='http', auth='public', website=True,
sitemap=False, csrf=False)
def web_auth_signup(self, *args, **kw):
"""function used to add extra information at the time of signup"""
res = super().web_auth_signup(*args, **kw)
qcontext = self.get_auth_signup_qcontext()
user = request.env['res.users']
user_sudo = user.sudo().search(
user._get_login_domain(qcontext.get('login')),
order=user._get_login_order(), limit=1
)
if 'gender' in kw:
user_sudo.partner_id.gender = kw['gender']
return res


Regards

1
Avatar
Vazgeç
zaynab ibrahim
Üretici

i want gender as selection field not text

Khoi Bui

This is the BEST ANSWER after I've spending millenials on this issue. And it will also work for any fields. Thanks a lot.

Avatar
Adil Akbar
En İyi Yanıt

Hi, this is exactly what you need: https://youtu.be/An6YTH3kJD8

Thanks

0
Avatar
Vazgeç
Avatar
Volt
En İyi Yanıt

Answer of Mily Shajan works ! saved my day, thanks

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

Hi

In xml, you can have this code. Here we are inheriting the signup page template and add the field




<?xml version="1.0" encoding="utf-8"?>
<!--Add an input field in sign up page, to have the gender-->
<odoo>
<template id="signup_add_gender" inherit_id="auth_signup.signup">
        <xpath expr="//input[@name='token']" position="before">
            <div class="mb-3">
                <label for="sex">Sex</label>
                <select name="gender" class="form-control link-style">
                    <option value="">--select--</option>
                    <option value="male">Male</option>
                    <option value="female">Female</option>
<option value="transgender">Transgender</option>
                </select>
            </div>
        </xpath>
    </template>
</odoo>




In controllers, by overwriting the function 'web_auth_signup' like this, and we can update the qcontext with gender,  later we can have the value

import werkzeug
from werkzeug.urls import url_encode
from odoo import _
from odoo.addons.auth_signup.controllers.main import AuthSignupHome
from odoo.addons.auth_signup.models.res_users import SignupError
from odoo.exceptions import UserError
from odoo.http import _logger, request


class WebsiteLogin(AuthSignupHome):
def web_auth_signup(self, *args, **kw):
    """Overwrite the function web_auth_signup, to add the value of gender
    to qcontext"""
    qcontext = self.get_auth_signup_qcontext()
    qcontext.update({
        'gender': kw.get('gender')
    })
      if not qcontext.get('token') and not qcontext.get('signup_enabled'):
        raise werkzeug.exceptions.NotFound()
    if 'error' not in qcontext and request.httprequest.method == 'POST':
        try:
            self.do_signup(qcontext)
            User = request.env['res.users']
            user_sudo = User.sudo().search(
                User._get_login_domain(qcontext.get('login')),
                order=User._get_login_order(), limit=1
            )
            template = request.env.ref(
                'auth_signup.mail_template_user_signup_account_created',
                raise_if_not_found=False)
            if user_sudo and template:
                template.sudo().send_mail(user_sudo.id, force_send=True)
            return self.web_login(*args, **kw)
        except UserError as e:
            qcontext['error'] = e.args[0]
        except (SignupError, AssertionError) as e:
            if request.env["res.users"].sudo().search(
                    [("login", "=", qcontext.get("login"))]):
                qcontext["error"] = _("Another user is already registered"
                                      " using this email address.")
            else:
                _logger.error("%s", e)
                qcontext['error'] = _("Could not create a new account.")
    elif 'signup_email' in qcontext:
        user = request.env['res.users'].sudo().search(
            [('email', '=', qcontext.get('signup_email')),
             ('state', '!=', 'new')], limit=1)
        if user:
            return request.redirect('/web/login?%s' % url_encode(
                {'login': user.login, 'redirect': '/web'}))
    response = request.render('auth_signup.signup', qcontext)
    response.headers['X-Frame-Options'] = 'SAMEORIGIN'
    response.headers['Content-Security-Policy'] = "frame-ancestors 'self'"
    return response

Hope it helps

0
Avatar
Vazgeç
Avatar
zaynab ibrahim
Üretici En İyi Yanıt

for python

class AuthSignupHomePage(AuthSignupHome):
@http.route('/web/signup', type='http', auth='public', website=True, sitemap=False)
def web_auth_signup(self, *args, **kw):
qcontext = self.get_auth_signup_qcontext()
web_company = request.env.company

res = super(AuthSignupHomePage, self).web_auth_signup()
user = request.env['res.users'].sudo().search([("login", "=", qcontext.get("login"))])
user.sudo().write({
'sex': kw.get('sex'),
})
return res

def get_auth_signup_qcontext(self):
qcontext = super(AuthSignupHomePage, self).get_auth_signup_qcontext()
sex = request.env['res.partner']._fields['sex'].selection
# print("dddddddddddddddddddddddddddddddddd", sex)
qcontext['sex'] = sex
return qcontext

for xml 

id="signup_edit" name="edit signup" inherit_id="auth_signup.fields" >

expr="//div[hasclass('field-confirm_password')]" position="after">
t-attf-class="form-group ">












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 add values dynamically in selection fields? Çözüldü
selection
Avatar
Avatar
Avatar
Avatar
Avatar
4
Ara 23
23325
Dynamically change choices in selection fields Çözüldü
selection
Avatar
Avatar
Avatar
Avatar
Avatar
5
Tem 24
16712
Working with fields.selection values Çözüldü
selection
Avatar
Avatar
1
Haz 22
28428
How to change the values for a selection field? Çözüldü
selection
Avatar
Avatar
Avatar
Avatar
Avatar
9
May 22
54724
How to get values from a radio button in a Selection
selection
Avatar
0
Tem 20
3797
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