Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

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

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

How to format a field as URL link (href)?

Subscribe

Get notified when there's activity on this post

This question has been flagged
1 Reply
32310 Views
Avatar
Anuradha

How to format a field as URL link (href)?

My code is

        <record id="voipdata_tree_view" model="ir.ui.view">
           <field name="name">File Details</field>
            <field name="model">filedata</field>
            <field name="priority" eval="1"/>
             <field name="type">tree</field>
                  <field name="arch" type="xml">
                          <tree string="File Names" create="false" edit="false">
                             <field name="file_name" widget="url" placeholder="www.openerp.com"/>
                             <field name="time_created" string="Time Created"/>
                              <field name="size" string="Size"/>
                             </tree>
                   </field>
    </record>

My fields are

 class filedata(osv.osv):
         _name = 'filedata'
       _log_access = False
       _columns = {
                            'file_name'     :   fields.char('Name'),
                            'time_created'  :   fields.datetime('Date Time'),
                            'size'          :   fields.char('Size')
                        }

I insert values to this fields from function "get_filenames" during button click from another form which is given below

 <form string="voip" version="7.0">
      <style>.openerp .oe_application .oe_breadcrumb_title  {display:none }</style>
      <style>.openerp .oe_view_manager table.oe_view_manager_header .oe_view_manager_buttons{display:none } </style>
      <header>
               <button name="get_filenames" type="object" string="List Files" onclick="display_change()" class="oe_highlight"/>
      </header>
 </form>

But its not working by giving widget="url" . please help!!

1
Avatar
Discard
Avatar
Jagdish Panchal
Best Answer

Hi,

You can try this

'file_name' : fields.char('Name'),

use this

'file_name' : fields.binary(string='Name'), thanks

1
Avatar
Discard
Anuradha
Author

@jack I changed my code but its not working . I will add code in my question. please check

Jagdish Panchal

@anuradha: give more details regarding your field..

Anuradha
Author

@jack ok .i update the question

Jagdish Panchal

@anuradha; You want attached any file using this field ??

Anuradha
Author

@jack i didnt get you :(. I want to attach a link to download mp3 file

Jagdish Panchal

I have update answer

Anuradha
Author

@jack i changed code now it shows links eg:- "Download (21.00 bytes)" in my tree view .But I want to show my file names in each field and play my mp3 in browser on clicking that link. I also want an option to download file to users computer. Can you please help me to achieve this

Anuradha
Author

@jack Using binary field help me to download file. Thank alot jack :). Do you help me on playing this mp3 file on clicking play buttton

Jagdish Panchal

@anuradha: I didnt get ? (Do you help me on playing this mp3 file on clicking play buttton)

Anuradha
Author

@jack My files are mp3 files. Now i implimented "download" option for them, and i want a "Play" button/link which will play the file !! got me?

Jagdish Panchal

@anuradha: I think you have do python code for that create method and execute this method on button click

Anuradha
Author

What should i do in create method? decode binary and return to form?

Jagdish Panchal

@anuradha: have finish download mp3 file and play it ..??

Jagdish Panchal

How's u download file in url ?

Anuradha
Author

http://help.openerp.com/question/31568/how-to-display-field-as-hyperlink/

Anuradha
Author

@ jack By giving ftp url

Jagdish Panchal

I have same problem, i have create one button export wizard "download zip" , when i click on button it download zip file of exported data , but i am not able downlaod file

Jagdish Panchal

I have same problem, i have create one button export wizard "download zip" , when i click on button it download zip file of exported data , but i am not able downlaod file

Anuradha
Author

@jack sorry i will update tomorrow.my work time over

Jagdish Panchal

ok but its xml side wht from python side

Anuradha
Author

@jack if you are using binary field no need to use python code .Just add that field in xml and you can download by clicking link.

Anuradha
Author

@jack My py function returns a action url after that my button disables.Open erp adds an attribute disable="disable" to my button . I dnt want to disable button.Please help? My code is <button name="play_file" type="object" string="Play or download" />

def play_file(self, cr, uid, ids, context=None): res = self.read(cr, uid, ids, ['file_name'], context=context) file_name = res[0]['file_name'] return{ 'type': 'ir.actions.act_url', 'url':'ftp://test.claudion.com:123/'+file_name,

'target': 'new',}

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

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

Sign up
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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