Passa al contenuto
Odoo Menu
  • Accedi
  • Provalo gratis
  • App
    Finanze
    • Contabilità
    • Fatturazione
    • Note spese
    • Fogli di calcolo (BI)
    • Documenti
    • Firma
    Vendite
    • CRM
    • Vendite
    • Punto vendita Negozio
    • Punto vendita Ristorante
    • Abbonamenti
    • Noleggi
    Siti web
    • Configuratore sito web
    • E-commerce
    • Blog
    • Forum
    • Live chat
    • E-learning
    Supply chain
    • Magazzino
    • Produzione
    • PLM
    • Acquisti
    • Manutenzione
    • Qualità
    Risorse umane
    • Dipendenti
    • Assunzioni
    • Ferie
    • Valutazioni
    • Referral dipendenti
    • Parco veicoli
    Marketing
    • Social marketing
    • E-mail marketing
    • SMS marketing
    • Eventi
    • Marketing automation
    • Sondaggi
    Servizi
    • Progetti
    • Fogli ore
    • Assistenza sul campo
    • Helpdesk
    • Pianificazione
    • Appuntamenti
    Produttività
    • Comunicazioni
    • Approvazioni
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    App di terze parti Odoo Studio Piattaforma cloud Odoo
  • Settori
    Retail
    • Libreria
    • Negozio di abbigliamento
    • Negozio di arredamento
    • Alimentari
    • Ferramenta
    • Negozio di giocattoli
    Cibo e ospitalità
    • Bar e pub
    • Ristorante
    • Fast food
    • Pensione
    • Grossista di bevande
    • Hotel
    Agenzia immobiliare
    • Agenzia immobiliare
    • Studio di architettura
    • Edilizia
    • Gestione immobiliare
    • Impresa di giardinaggio
    • Associazione di proprietari immobiliari
    Consulenza
    • Società di contabilità
    • Partner Odoo
    • Agenzia di marketing
    • Studio legale
    • Selezione del personale
    • Audit e certificazione
    Produzione
    • Tessile
    • Metallo
    • Arredamenti
    • Alimentare
    • Birrificio
    • Ditta di regalistica aziendale
    Benessere e sport
    • Club sportivo
    • Negozio di ottica
    • Centro fitness
    • Centro benessere
    • Farmacia
    • Parrucchiere
    Commercio
    • Tuttofare
    • Hardware e assistenza IT
    • Ditta di installazione di pannelli solari
    • Calzolaio
    • Servizi di pulizia
    • Servizi di climatizzazione
    Altro
    • Organizzazione non profit
    • Ente per la tutela ambientale
    • Agenzia di cartellonistica pubblicitaria
    • Studio fotografico
    • Punto noleggio di biciclette
    • Rivenditore di software
    Carica tutti i settori
  • Community
    Apprendimento
    • Tutorial
    • Documentazione
    • Certificazioni 
    • Formazione
    • Blog
    • Podcast
    Potenzia la tua formazione
    • Programma educativo
    • Scale Up! Business Game
    • Visita Odoo
    Ottieni il software
    • Scarica
    • Versioni a confronto
    • Note di versione
    Collabora
    • Github
    • Forum
    • Eventi
    • Traduzioni
    • Diventa nostro partner
    • Servizi per partner
    • Registra la tua società di contabilità
    Ottieni servizi
    • Trova un partner
    • Trova un contabile
    • Incontra un esperto
    • Servizi di implementazione
    • Testimonianze dei clienti
    • Supporto
    • Aggiornamenti
    GitHub Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Richiedi una demo
  • Prezzi
  • Aiuto

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

  • CRM
  • e-Commerce
  • Contabilità
  • Magazzino
  • PoS
  • Progetti
  • MRP
All apps
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
Assistenza

QWeb conditional in website_sale.address

Iscriviti

Ricevi una notifica quando c'è un'attività per questo post

La domanda è stata contrassegnata
addressqwebecommerceB2Bwebsite_sale
6501 Visualizzazioni
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
Abbandona
Rupesh Dalvi

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

Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!

Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!

Registrati
Post correlati Risposte Visualizzazioni Attività
Qweb foreign currency printing problem Risolto
qweb currency ecommerce website_sale
Avatar
Avatar
Avatar
3
ott 25
5591
B2B Product Access Restricted by Company
ecommerce B2B
Avatar
Avatar
Avatar
Avatar
4
dic 24
2685
Don't ask for address in online sellings
address ecommerce
Avatar
0
mar 22
1627
Add shop and wishlist buttons on new website theme module
ecommerce website_sale
Avatar
0
feb 22
3008
Odoo 12 - How to Add Field at template
ecommerce website_sale
Avatar
Avatar
2
lug 19
7256
Community
  • Tutorial
  • Documentazione
  • Forum
Open source
  • Scarica
  • Github
  • Runbot
  • Traduzioni
Servizi
  • Hosting Odoo.sh
  • Supporto
  • Aggiornamenti
  • Sviluppi personalizzati
  • Formazione
  • Trova un contabile
  • Trova un partner
  • Diventa nostro partner
Chi siamo
  • La nostra azienda
  • Branding
  • Contattaci
  • Lavora con noi
  • Eventi
  • Podcast
  • Blog
  • Clienti
  • Note legali • Privacy
  • Sicurezza
الْعَرَبيّة 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 è un gestionale di applicazioni aziendali open source pensato per coprire tutte le esigenze della tua azienda: CRM, Vendite, E-commerce, Magazzino, Produzione, Fatturazione elettronica, Project Management e molto altro.

Il punto di forza di Odoo è quello di offrire un ecosistema unico di app facili da usare, intuitive e completamente integrate tra loro.

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