Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

How to add State_id field as select type in signup page?

Subscriure's

Get notified when there's activity on this post

This question has been flagged
fieldsignupstate_idodooV8
1 Respondre
7993 Vistes
Avatar
lama lili

Hello,

Iam working with Odoo 8 and really i tried a lot of solutions before posting my question here.

So, i want to add another field in signup page that post State_id.

This is my file.xml

In my folder "Controllers", i have:
<xpath expr="//div[@class='form-group field-confirm_password']" position="after">
<div class="form-group field-country">
<label class="control-label" for="state_id"
style="font-weight: normal">Wilaya
</label>
<select name="state_id" class="form-control">
<option value="">selectionner...</option>
<t t-foreach="states or []" t-as="state">
<option t-att-value="state.id" t-att-selected="state.id == auth_signup.get('state_id')">
<t t-esc="state.name"/>
</option>
</t>
</select>
</div>
</xpath>


And now , i have in my main.py of the folder of Controllers:


_logger = logging.getLogger(__name__)
class AuthSignupHome(openerp.addons.web.controllers.main.Home):

def do_signup(self, qcontext):
""" Shared helper that creates a res.partner out of a token """
values = dict((key, qcontext.get(key)) for key in ('login', 'name', 'password', 'state_id'))
assert any([k for k in values.values()]), "The form was not properly filled in."
assert values.get('password') == qcontext.get('confirm_password'), "Passwords do not match; please retype them."
self._signup_with_values(qcontext.get('token'), values)
request.cr.commit()

@http.route('/web/signup', type='http', auth='public', website=True)
def web_auth_signup(self, *args, **kw):
qcontext = self.get_auth_signup_qcontext()
qcontext['states'] = request.env['res.country.state'].sudo().search([])

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)
return super(AuthSignupHome, self).web_login(*args, **kw)
except (SignupError, AssertionError), 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(e.message)
qcontext['error'] = _("Could not create a new account.")

return request.render('auth_signup.signup', qcontext)

 The result is : Internal server Error :

foreach enumerator 'providers' is not defined while rendering template 'auth_oauth.providers'

Can you explain me please? I really need help.

0
Avatar
Descartar
Avatar
Ashish Singh
Best Answer

Hi, lama


It seems "auth_oauth" is added in __openerp__.py file as dependency due to this you are getting this issue.

Or you can also update your code like below,

View File : Inherit "auth_sign_up.fields"
<template id="auth_signup_fields_inherit" inherit_id="auth_signup.fields" name="Sign up - Reset Password">
    <xpath expr="//div[hasclass('field-confirm_password)]" position="after">
        <div t-attf-class="form-group col-lg-6">
            <label class="control-label" for="state_id" style="font-weight: normal">State / Province</label>
            <select name="state_id" class="form-control">
                <option value="">select...</option>
                <t t-foreach="states or []" t-as="state">
                    <option t-att-value="state.id" style="display:none;"><t t-esc="state.name"/></option>
                </t>
            </select>
        </div>
    </xpath>
</template>


Py File: Override method: "get_auth_signup_qcontext" from AuthSignupHome class
def get_auth_signup_qcontext(self):
    qcontext = super(AuthSignupHome, self).get_auth_signup_qcontext()
    cr, uid, context, registry = request.cr, request.uid, request.context, request.registry
    state_orm = registry.get('res.country.state')
    states_ids = state_orm.search(cr, SUPERUSER_ID, [], context=context)
    states = state_orm.browse(cr, SUPERUSER_ID, states_ids, context)
    qcontext['states'] = states
    request qcontext
Thanks,
Ashish Singh (Team Lead)
Webkul Software Private Limited
3
Avatar
Descartar
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
How do you translate a field.Select item? (not the field label but the select options) Solved
field translations select odooV8
Avatar
Avatar
1
de gen. 25
14685
How to update field value by query based on another object field?
field automatic update odooV8
Avatar
Avatar
1
de jul. 16
5264
Field added to account.invoice but when user assigns 0.00 or 0 it is updated into database to 10.0
database field account.invoice odooV8
Avatar
0
de febr. 16
3150
How do you get sale.order from sale.order.line? Solved
field sale.order.line sale.order odooV8
Avatar
Avatar
2
de febr. 16
6062
How to define a read only field
field qweb readonly odooV8
Avatar
Avatar
Avatar
5
de febr. 16
9701
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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