Skip to Content
Odoo Menu
  • Log ind
  • Prøv gratis
  • Apps
    Økonomi
    • Bogføring
    • Fakturering
    • Udgifter
    • Regneark (BI)
    • Dokumenter
    • e-Signatur
    Salg
    • CRM
    • Salg
    • POS Butik
    • POS Restaurant
    • Abonnementer
    • Udlejning
    Hjemmeside
    • Hjemmesidebygger
    • e-Handel
    • Blog
    • Forum
    • LiveChat
    • e-Læring
    Forsyningskæde
    • Lagerbeholdning
    • Produktion
    • PLM
    • Indkøb
    • Vedligeholdelse
    • Kvalitet
    HR
    • Medarbejdere
    • Rekruttering
    • Fravær
    • Medarbejdersamtaler
    • Anbefalinger
    • Flåde
    Marketing
    • Markedsføring på sociale medier
    • E-mailmarketing
    • SMS-marketing
    • Arrangementer
    • Automatiseret marketing
    • Spørgeundersøgelser
    Tjenester
    • Projekt
    • Timesedler
    • Udkørende Service
    • Kundeservice
    • Planlægning
    • Aftaler
    Produktivitet
    • Dialog
    • Godkendelser
    • IoT
    • VoIP
    • Vidensdeling
    • WhatsApp
    Tredjepartsapps Odoo Studio Odoo Cloud-platform
  • Brancher
    Detailhandel
    • Boghandel
    • Tøjforretning
    • Møbelforretning
    • Dagligvarebutik
    • Byggemarked
    • Legetøjsforretning
    Mad og værtsskab
    • Bar og pub
    • Restaurant
    • Fastfood
    • Gæstehus
    • Drikkevareforhandler
    • Hotel
    Ejendom
    • Ejendomsmægler
    • Arkitektfirma
    • Byggeri
    • Ejendomsadministration
    • Havearbejde
    • Boligejerforening
    Rådgivning
    • Regnskabsfirma
    • Odoo-partner
    • Marketingbureau
    • Advokatfirma
    • Rekruttering
    • Audit & certificering
    Produktion
    • Tekstil
    • Metal
    • Møbler
    • Fødevareproduktion
    • Bryggeri
    • Firmagave
    Heldbred & Fitness
    • Sportsklub
    • Optiker
    • Fitnesscenter
    • Kosmetolog
    • Apotek
    • Frisør
    Håndværk
    • Handyman
    • IT-hardware og support
    • Solenergisystemer
    • Skomager
    • Rengøringsservicer
    • VVS- og ventilationsservice
    Andet
    • Nonprofitorganisation
    • Miljøagentur
    • Udlejning af billboards
    • Fotografi
    • Cykeludlejning
    • Softwareforhandler
    Gennemse alle brancher
  • Community
    Få mere at vide
    • Tutorials
    • Dokumentation
    • Certificeringer
    • Oplæring
    • Blog
    • Podcast
    Bliv klogere
    • Udannelselsesprogram
    • Scale Up!-virksomhedsspillet
    • Besøg Odoo
    Få softwaren
    • Download
    • Sammenlign versioner
    • Udgaver
    Samarbejde
    • Github
    • Forum
    • Arrangementer
    • Oversættelser
    • Bliv partner
    • Tjenester til partnere
    • Registrér dit regnskabsfirma
    Modtag tjenester
    • Find en partner
    • Find en bogholder
    • Kontakt en rådgiver
    • Implementeringstjenester
    • Kundereferencer
    • Support
    • Opgraderinger
    Github Youtube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Få en demo
  • Prissætning
  • Hjælp

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

  • CRM
  • e-Commerce
  • Bogføring
  • Lager
  • PoS
  • Projekt
  • MRP
All apps
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Hjælp

Hide/show urls in form view

Tilmeld

Få besked, når der er aktivitet på dette indlæg

Dette spørgsmål er blevet anmeldt
v7hyperlinkcontroller
1 Svar
8949 Visninger
Avatar
Ramy Wafa

I am trying to put a link to download docs files in form view. I already have the links and I made a custom web controller that actually does the download but the problem is that they present in every part of the view. I want it to appear based on specific condition where the state field of an applicant is set to a specific value similar to buttons in form view.

Bellow is an example of a button that appears based on the state condition:

<button name="action_open_agreement_form" type="object" string="P020 Declaration and undertaking" attrs="{'invisible':[('state','!=','done')]}"/>

this allows me to show a button if the state of the applicant is not done.

The link I have is as bellow in the xml

<record model="ir.ui.view" id="view_sefarer_applicant_form">
    <field name="name">Jobs - Recruitment Form</field>
<field name="model">seafarer.applicant</field>
<field name="arch" type="xml">
    <form string="Jobs - Recruitment Form" version="7.0">
        ...
        <sheet>
            ......
    <div class="oe_right oe_button_box">
                ....
                <a href="#" onclick="window.open('/sc/some_html?id=P014-'+$('.seafarer_id span').text(), '_blank')" class="applicant_docs_forms"  id="P014">P014 Drug/Alcohol Delcaration</a>
                .....
            </div>
        </sheet>
     .....

I need to use something like attrs but it is not working, I also tried to use javascript with on window load or document ready but that's not working too. I also tried desperate things like having a button with attrs with the condition and having a onclick action on it that clicks the link and having the link hidden but that didn't work as well.

I am pretty desperate and any help would be appreciated.

0
Avatar
Kassér
Avatar
Prakash
Bedste svar

please check in the xml file state field is available before the button. If not add the same.

Example attrs tag in button:-

<field name="state" invisible="1"/>
<button name="action_open_agreement_form" type="object" string="P020 Declaration and undertaking" attrs="{'invisible':[('state','!=','done')]}"/>

Example attrs tag in link:

<group  attrs="{'invisible':[('state','!=','done')]}">
 <a href="#" onclick="window.open('/sc/some_html?id=P014-'+$('.seafarer_id span').text(), '_blank')" class="applicant_docs_forms" id="P014">P014 Drug/Alcohol Delcaration</a>
</group>
1
Avatar
Kassér
Ramy Wafa
Forfatter

thank you but I want the attrs attribute on the link not on the button itself, so I need sth like: <a href="#" onclick="window.open('/sc/some_html?id=P014-'+$('.seafarer_id span').text(), '_blank')" class="applicant_docs_forms" id="P014" attrs="{'invisible':[('state','!=','done')]}">P014 Drug/Alcohol Delcaration</a>

Prakash

I updated the answer try attrs tag to add in the group.

Ramy Wafa
Forfatter

Thank you very much really great help

Enjoying the discussion? Don't just read, join in!

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

Tilmeld dig
Related Posts Besvarelser Visninger Aktivitet
change name in hyperlink
v7 hyperlink change
Avatar
0
mar. 15
4743
change name in hyperlink
v7 hyperlink change
Avatar
0
mar. 15
4115
Link to an custom web url
form view v7 controller
Avatar
0
jul. 15
8480
Link to an custom web url
form view v7 controller
Avatar
0
mar. 15
4932
Controller Import Error V7
import v7 http controller
Avatar
Avatar
1
mar. 15
272
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Oversættelser
Tjenester
  • Odoo.sh-hosting
  • Support
  • Opgradere
  • Individuelt tilpasset udvikling
  • Uddannelse
  • Find en bogholder
  • Find en partner
  • Bliv partner
Om os
  • Vores virksomhed
  • Brandaktiver
  • Kontakt os
  • Stillinger
  • Arrangementer
  • Podcast
  • Blog
  • Kunder
  • Juridiske dokumenter • Privatlivspolitik
  • Sikkerhedspolitik
الْعَرَبيّة 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 er en samling open source-forretningsapps, der dækker alle dine virksomhedsbehov – lige fra CRM, e-handel og bogføring til lagerstyring, POS, projektledelse og meget mere.

Det unikke ved Odoo er, at systemet både er brugervenligt og fuldt integreret.

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