Summer Sun
Summer Sun

Reputation: 1026

How to add parameter to hyperlink in view.xml in Odoo

I have created an odoo module, this is one of my view record that displaying the information of a doctor correctly:

<record id="medinfo_doctor_form" model="ir.ui.view">
<field name="name">Medinfo doctors: form</field>
<field name="model">medinfo.doctors</field>
<field name="arch" type="xml">
  <form string="Doctors">
    <header>
      <!-- further functions / configurations required -->
    </header>
    <sheet>
      <h1>Doctors Information</h1>
      <div>
        <group>
          <group>
            <field name="name"/>
            <field name="gender"/>
            <field name="birthday"/>
            <field name="mobile"/>
            <field name="idcard"/>
            <field name="email"/>
          </group>
          <group>
            <field name="create_date"/>
            <field name="password"/>
            <field name="status"/>
            <field name="permission"/>
            <field name="level"/>
          </group>
        </group>
        <group>
          <field name="address"/>
          <field name="product_address"/>
        </group>
      </div>
      <!--this div is to be moved to a correct place-->
      <div>
        <!--My problem is here!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
        <a target="_blank" href="diagnoses_upload/">Upload</a>
      </div>
    </sheet>
  </form>
</field>
</record>

Now I want to add a hyper link to point to another url, the hyper link is commented in the code block above.

What I want is to add the name of current doctor record into the href, So that I could get the name parameter in other page and process it accordingly. Can anyone told me how can I implement this?

Or, is there any other solution that could pass the name here to another page through whatever method so that I could get the name parameter in another page?

Many thanks!

Update: I have found that context seems to be able to store session info, but how can i get that from controller.py? Is this a correct direction?

Upvotes: 0

Views: 3129

Answers (1)

Motez
Motez

Reputation: 91

You have to implement a custom widget to be able to add this. you can find more here

Upvotes: 1

Related Questions