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
    • Información
    • 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

How to use widget="url" in tree view

Suscribirse

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

Se marcó esta pregunta
5 Respuestas
26056 Vistas
Avatar
Narayanamurthy

I Have website field in tree view, need to create link onclick of the wesite field...

 widget="url" is working fine in form view, but not in tree view

2
Avatar
Descartar
Sehrish

URL widget in Odoo: https://learnopenerp.blogspot.com/2022/05/how-to-use-phone-email-and-url-widget-in-odoo-15.html

Avatar
Praveen Kumar
Mejor respuesta

Hi narayan

First download and install the Web/URL widget module and use widget="url"

 

2
Avatar
Descartar
Avatar
Vinay
Mejor respuesta

If the email address format doesn't contains "http://", it doesnt work

1
Avatar
Descartar
Avatar
Dr Obx
Mejor respuesta

This is maybe not perfect example but if it doesn't work you can fix it or built something what will work :)

As an example based on existing widget I've built for myself a new widget to create a link to skype so you can run skype straight from Odoo (Customer page or Human resorces :) ) just clicking on link to contact with your customers, also i made vendor support and local support page links based on this widget so it is possible and quiet easy - I'm not a programmer too ;)

So in my case I added at the end of /addons/web/static/js/view_form.js line somwhere around 6400 after "instance.web.form.widgets = new instance.web.Registry({"

this line to create a new instance in registry

" 'skype' : 'instance.web.form.FieldSkype', "

and sowhere around line 2600 before:

"instance.web.form.FieldUrl = instance.web.form.FieldChar.extend({"

this block of code:

"instance.web.form.FieldSkype = instance.web.form.FieldChar.extend({

template: 'FieldUrl',

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://" + this.get('value');

}

var suf = document.getElementById('id');

if (suf = 'skype'){ var suf_x = 'skype:'; tmp = suf_x + this.get('value') + '?call';}

var text = this.get('value') ? this.node.attrs.text || tmp : '';

this.$el.find('a').attr('href', tmp).text(this.get('value'));

}

},

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 = 'skype:'+url+'?call';

window.close(url);

}

}

});"

and in XML file:

<field name="your_field_name" id="skype" widget="skype"/> - it will create a input box where you have to put skype nick.

(of course "your_field_name" needs to be defined in your_module.py)

'skype': fields.char('Skype'), - old API

skype = fields.Char('Skype') - new API

This solution works perfect for me. Same way you can create other useful widget extensions ;)

For example i created a simple connection to ebayshop, product name is automatically pulled from field "name" and added to the link making a search key on ebayshop (http://stores.ebay.co.uk/CharlesComputers/_i.html?_nkw="here is added a product name"). This solution is not the most elegant but it works :)

Example of Instance for ebayshop:

"instance.web.form.FieldEbay = instance.web.form.FieldChar.extend({

template: 'FieldUrl',

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://" + this.get('value'); }

var suf = document.getElementById('id');

if (suf = 'ebay'){ var suf_x = 'http://stores.ebay.co.uk/Your_Ebay_shop_name/_i.html?_nkw='; 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')); } },

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://'+url;

window.open(url);

} } });"

Check this code you may find how it works and try change it for your purpose.

Remember this is just an example.

Same Way you can create url widget for list.

In view_list.js insert this code somwhere around line 2400:

instance.web.list.Url = instance.web.list.Column.extend({

PROTOCOL_REGEX: /^(?!\w+:?\/\/)/,

  _format: function(row_data, options) {

var value = row_data[this.id].value;

if (value) {

return _.template("<a href='<%-href%>' target='_blank'><%-text%></a>", {

href: value.trim().replace(this.PROTOCOL_REGEX, '//'),

text: value  });

}

return this._super(row_data, options);

} });

This definitely work, tested it.

0
Avatar
Descartar
Avatar
Anthony Gardiner
Mejor respuesta

I'm not really a programmer yet I have installed both this module and the WEB module with no success to show the clickable link in the tree view.

Does anyone know where there are examples of the code?

Should I be setting up the custom field or script in a certain way?

How to use widget="url" in tree view
My script is <field name="x_showworkurl2" widget="url"/>

0
Avatar
Descartar
Dr Obx

Check example above, you may find it useful

Dr Obx

Widget directly may not work so maybe you should try with button.

Narayanamurthy
Autor

It works, Install "Web/URL widget" Module, it is different from "web" module

Avatar
Carlos Lopez
Mejor respuesta

Hi,

Check this PR https://github.com/odoo/odoo/pull/3592

 

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