Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • e-learning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Conocimientos
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyecto
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

QWeb conditional in website_sale.address

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
addressqwebecommerceB2Bwebsite_sale
6511 Vistas
Avatar
Adrian Schultze

Hey there,

I want to sell a digital product through ecommerce module. Its a B2B transaction and I need the following logic. Whenever a customer selects a country that is Intra-Europe and not Germany, the VAT/ID Field shall be required. How to do that? This is the code. As you can see, I removed "phone" from required and added "company_name".


<?xml version="1.0"?>
<t name="Address Management" t-name="website_sale.address">
        <t t-set="no_footer">1</t>
        <t t-call="website.layout">
            <div id="wrap">
                <div class="container oe_website_sale">
                    <div class="row">
                        <div class="col-md-8 col-md-offset-2 oe_cart">
                    <div class="row">
                        <t t-call="website_sale.wizard_checkout">
                            <t t-set="step" t-value="20"/>
                        </t>
                    </div>
                            <div class="row">
                                <t t-if="mode == ('new', 'billing')">
                                    <h2 class="page-header mt8 ml16">Your Address
                                        <small> or </small>
                                        <a href="/web/login?redirect=/shop/checkout" class="btn btn-primary" style="margin-top: -11px">Log In</a>
                                    </h2>
                                </t>
                                <t t-if="mode == ('edit', 'billing')">
                                    <h2 class="page-header mt8 ml16">Your Address</h2>
                                </t>
                                <t t-if="mode[1] == 'shipping'">
                                    <h2 class="page-header mt8 ml16">Shipping Address </h2>
                                </t>
                                <t t-if="error" t-foreach="error.get('error_message', [])" t-as="err">
                                    <h4 class="text-danger" t-esc="err"/>
                                </t>
                                <form name="/shop/checkout" method="post" class="checkout_autoformat">
                                    <div t-attf-class="form-group #{error.get('name') and 'has-error' or ''} col-md-12 div_name">
                                        <label class="control-label label-optional" for="name">Name</label>
                                        <input type="text" name="name" class="form-control" t-att-value="'name' in checkout and checkout['name']"/>
                                    </div>
                                    <div class="clearfix"/>
                                    <t t-if="mode[1] == 'billing'">
                                        <div t-attf-class="form-group #{error.get('email') and 'has-error' or ''} col-md-6" id="div_email">
                                            <label class="control-label" for="email">Email</label>
                                            <input type="email" name="email" class="form-control" t-att-value="'email' in checkout and checkout['email']"/>
                                        </div>
                                    </t>
                                    <div t-attf-class="form-group #{error.get('phone') and 'has-error' or ''} col-md-6" id="div_phone">
                                        <label class="control-label" for="phone">Phone</label>
                                        <input type="tel" name="phone" class="form-control" t-att-value="'phone' in checkout and checkout['phone']"/>
                                    </div>
                                    <div class="clearfix"/>
                                    <t t-if="mode == ('new', 'billing')">
                                        <div t-attf-class="form-group #{error.get('company_name') and 'has-error' or ''} col-md-6">
                                            <label class="control-label" for="company_name">Company Name</label>
                                            <input type="text" name="company_name" class="form-control" t-att-value="'company_name' in checkout and checkout['company_name']"/>
                                        </div>
                                        <div t-attf-class="form-group #{error.get('vat') and 'has-error' or ''} col-md-6 div_vat">
                                            <label class="control-label font-weight-normal label-optional" for="vat">TIN / VAT </label>
                                            <input type="text" name="vat" class="form-control" t-att-value="'vat' in checkout and checkout['vat']"/>
                                        </div>
                                    </t>
                                    <div class="clearfix"/>
                                    <div t-attf-class="form-group #{error.get('street') and 'has-error' or ''} col-md-12 div_street">
                                        <label class="control-label" for="street">Street <span class="hidden-xs"> and Number</span></label>
                                        <input type="text" name="street" class="form-control" t-att-value="'street' in checkout and checkout['street']"/>
                                    </div>
                                    <div t-attf-class="form-group #{error.get('street2') and 'has-error' or ''} col-md-12 div_street2">
                                        <label class="control-label label-optional" for="street2">Street 2</label>
                                        <input type="text" name="street2" class="form-control" t-att-value="'street2' in checkout and checkout['street2']"/>
                                    </div>
                                    <div class="clearfix"/>
                                    <t t-set="zip_city" t-value="country and [x for x in country.get_address_fields() if x in [&quot;zip&quot;, &quot;city&quot;]] or [&quot;city&quot;, &quot;zip&quot;]"/>
                                    <t t-if="'zip' in zip_city and zip_city.index('zip') &lt; zip_city.index('city')">
                                        <div t-attf-class="form-group #{error.get('zip') and 'has-error' or ''} col-sm-4 div_zip">
                                            <label class="control-label label-optional" for="zip">Zip Code</label>
                                            <input type="text" name="zip" class="form-control" t-att-value="'zip' in checkout and checkout['zip']"/>
                                        </div>
                                    </t>
                                    <div t-attf-class="form-group #{error.get('city') and 'has-error' or ''} col-sm-8 div_city">
                                        <label class="control-label" for="city">City</label>
                                        <input type="text" name="city" class="form-control" t-att-value="'city' in checkout and checkout['city']"/>
                                    </div>
                                    <t t-if="'zip' in zip_city and zip_city.index('zip') &gt; zip_city.index('city')">
                                        <div t-attf-class="form-group #{error.get('zip') and 'has-error' or ''} col-sm-4 div_zip">
                                            <label class="control-label label-optional" for="zip">Zip Code</label>
                                            <input type="text" name="zip" class="form-control" t-att-value="'zip' in checkout and checkout['zip']"/>
                                        </div>
                                    </t>
                                    <div class="clearfix"/>
                                    <div t-attf-class="form-group #{error.get('country_id') and 'has-error' or ''} col-md-6 div_country">
                                        <label class="control-label" for="country_id">Country</label>
                                        <select id="country_id" name="country_id" class="form-control">
                                            <option value="">Country...</option>
                                            <t t-foreach="countries" t-as="c">
                                                <option t-att-value="c.id" t-att-selected="c.id == (country and country.id or -1)">
                                                    <t t-esc="c.name"/>
                                                </option>
                                            </t>
                                        </select>
                                    </div>
                                    <div t-attf-class="form-group #{error.get('state_id') and 'has-error' or ''} col-md-6 div_state" t-att-style="(not country or not country.state_ids) and 'display: none'">
                                        <label class="control-label" for="state_id">State / Province</label>
                                        <select name="state_id" class="form-control" data-init="1">
                                            <option value="">State / Province...</option>
                                            <t t-foreach="country and country.state_ids or []" t-as="s">
                                                <option t-att-value="s.id" t-att-selected="s.id == ('state_id' in checkout and country and checkout['state_id'] != '' and int(checkout['state_id']))">
                                                    <t t-esc="s.name"/>
                                                </option>
                                            </t>
                                        </select>
                                    </div>

                                    <input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
                                    <input type="hidden" name="submitted" value="1"/>
                                    <input type="hidden" name="partner_id" t-att-value="partner_id or '0'"/>
                                    <input type="hidden" name="callback" t-att-value="callback"/>
                                    <!-- Example -->
                                    <input type="hidden" name="field_required" t-att-value="'company_name'"/>

                                    <div class="clearfix"/>
                                    <div style="padding: 0 15px">
                                        <a t-att-href="mode == ('new', 'billing') and '/shop/cart' or '/shop/checkout'" class="btn btn-default mb32">
                                            <span class="fa fa-long-arrow-left"/> Back
                                        </a>
                                        <a class="btn btn-primary pull-right mb32 a-submit a-submit-disable a-submit-loading">
                                            <span>Next </span><span class="fa fa-long-arrow-right"/>
                                        </a>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </t>
    </t>
    

Thanks for your help.


Adrian



0
Avatar
Descartar
Rupesh Dalvi

Hello @Adrian,
I am working on a similar case, did you find the solution?

¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
Qweb foreign currency printing problem Resuelto
qweb currency ecommerce website_sale
Avatar
Avatar
Avatar
3
oct 25
5595
B2B Product Access Restricted by Company
ecommerce B2B
Avatar
Avatar
Avatar
Avatar
4
dic 24
2691
Don't ask for address in online sellings
address ecommerce
Avatar
0
mar 22
1629
Add shop and wishlist buttons on new website theme module
ecommerce website_sale
Avatar
0
feb 22
3010
Odoo 12 - How to Add Field at template
ecommerce website_sale
Avatar
Avatar
2
jul 19
7262
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y totalmente integrado.

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