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
    • eLearning
    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

URL widget

Suscribirse

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

Se marcó esta pregunta
widgetmodificationlinkurlodooV8
6 Respuestas
12072 Vistas
Avatar
Dr Obx

Hello there,

Apparently it is a serious problem and nobody know how to do it  so I need help, I'm new in Odoo, it's still a mistery for me how to build something in this system.

How can I create and how should it look like a function which will create a link. For example I have a field "ebay_number" which contain 12 digits long number of product and I would like to create a link to the item based on constant element like "www.ebay.com/itm/ + <item number>"  but on screen I want only see this number. Hope you understand guys what I'm talking about.

Can anyone help me with it please?

Too complicated ?

Can anyone show me how to do it ?

1
Avatar
Descartar
Jérémy Kersten (jke)

Take a look here : https://www.odoo.com/documentation/8.0/howtos/web.html#the-form-view-fields...

Dr Obx
Autor

Thank you Jeremy, it might be useful but like i said, I'm new in Odoo so even if i know something about JS HTML and other stuff I don't really know how to combine it together. In PHP is piece of cake but modyfying existing js code is completely different thing.

Dr Obx
Autor

By the way, do you know where should i search for js files containing widgets ?

Dr Obx
Autor

GREAT thanx, you saved a lot of my precious time Jeremy :)

Dr Obx
Autor

//============================================================= instance.web.form.FieldLink = instance.web.form.FieldChar.extend({ template: 'FieldLink', initialize_content: function() { this._super(); var $button = this.$el.find('button'); $button.click(this.on_button_clicked); this.setupFocus($button); }, render_value: function() { if (!this.get("effective_readonly")) { this._super(); } else { var tmp = this.get('value'); var s = /(\w+):(.+)|^\.{0,2}\//.exec(tmp); if (!s) { tmp = "http://www.ebay.co.uk/itm/" + this.get('value'); } var text = this.get('value') ? this.node.attrs.text || tmp : ''; this.$el.find('a').attr('href', tmp).text(text); } }, on_button_clicked: function() { if (!this.get('value')) { this.do_warn(_t("Resource Error"), _t("This resource is empty")); } else { var url = $.trim(this.get('value')); if(/^www\./i.test(url)) url = 'http://www.ebay.co.uk/itm/'+ this.get('value'); window.open(url); } } }); What do you think ? Will it work ?

Dr Obx
Autor

Finally i did it. But i made one step further to keep old widget untouched I created a separate widget for this purpose. Now i have a special widget for Ebay :) and finally i know how i can make some more depending on what I will need. And this is the best option.

Dr Obx
Autor

Now i got it even better because whole address is hidden and only product name is displayed as a link :):)

Dr Obx
Autor

I just created a new widget and the code you suggested in my widget looks like: this.$el.find('a').attr('href', tmp).text(this.get('value')); and works perfectly fine ;) Thanx

Dr Obx
Autor

By the way Jeremy, string you asked me to change doesn't exist in Odoo8.0 or I can't find (blindness ?) I've found only this.$el.find('a').attr('href', tmp).text(text); is this the string you've had in mind ? What i've done: var suf = document.getElementById('id'); if (suf = 'ebay'){ var suf_x = 'http://

'; tmp = suf_x + this.get('value');} var text = this.get('value') ? this.node.attrs.text || tmp : ''; this.$el.find('a').attr('href', tmp).text(this.get('value')); At the end getting only a name on screen but link is generated correctly so that's what i wanted.
Avatar
Jérémy Kersten (jke)
Mejor respuesta

in view_form.js you have all basic widget... If you need module which add a widget, you can grep 'instance.web.form.widgets = '...

But your widget is really basic, you can copy past the widget Field2 from documentation...

replace the

this.$el.text(this.get("value")); 

by 

this.$el.html("<a href='<your_url>/'>"+ this.get("value") + "</a>");

and it will works !

0
Avatar
Descartar
¿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
How to add Tables into HTML widget
widget modification jquery odooV8
Avatar
0
jul 15
5425
Sort products by quantity
modification odooV8
Avatar
0
ago 15
3243
how to protect the manager database url? Resuelto
url odooV8 ManageDatabases
Avatar
Avatar
Avatar
Avatar
Avatar
5
ago 25
17052
Create URL link in form view Resuelto
link model url formview
Avatar
Avatar
Avatar
3
dic 24
21526
How to apply widget="URL" based on a condition?
widget v7 url condition
Avatar
Avatar
1
mar 15
10698
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