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

Change "Product Type" after a product has been sold.

Suscribirse

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

Se marcó esta pregunta
restrictionwarningoverridev14
5 Respuestas
8680 Vistas
Avatar
Rickard Wallster

I want to change Product Type on a product from "Storable Product" -> "Consumable". However that product has been sold earlier so a warning comes up.


You cannot change the product's type because it is already used in sales orders.

Is there any way to by-pass this restriction? I don't like the idea of creating new duplicate products only because of this minor change.


We are on v14 enterprise.



0
Avatar
Descartar
Thuy Ngoc

Hi Rickard,

I think you should use sql statement to update. For example: self.env.cr.execute("""Update product_template set type = 'consu' where id = 1 """)

Sergio Serrano Lloret

It's a nice shortcut, it works fine for situations where you don't have to be careful.

Moustafa Ebada

So still Inventory Valuation is an issue. It sees the quantity of the consumable product but it doesn't appear in quantity on hand. If you try to do inventory adjustment it dublicates the quantity and eventually the amount.

Avatar
Thuy Ngoc
Mejor respuesta

Hi Rickard,

You can follow these steps to change this data from UI:
Step 1: Go to menu Settings => Technical => Actions => Server Actions (To access this menu you need to enable debug mode by adding the letter "?debug=true" after the word "web" on the address e.g "localhost:8169/web" to "localhost:8169/web?debug=true").
Step 2: Create an action with the following information:
+ Name: Update product type by sql
+ Model: Server Action (or  ir.actions.server)
+ Action To Do: Execute Python Code
+ Python Code: env.cr.execute("""Update product_template set type = 'consu' where id = id_of_product_template """)
Step 3: Click Run button.

P/s: Because I can't edit the comment, I posted an answer so the content is a bit similar.

4
Avatar
Descartar
Rickard Wallster
Autor

Hi Thuy
That worked like a charm. Thanks you very much, you made my day :)

Thuy Ngoc

Hi Rickard,

I'm happy to hear your issue has been resolved.

keredine arif

Hi Thuy
like Rickard but in reverse, I want to change Product Type on a product from "Consumable" -> "Storable Product".
I tried your solution by copying the code but I got an error message.
I'm a beginner in coding, so I followed your steps and copied your line.
I just modified 'consu' by 'product' and put the name of my product in place of id_of_product_template .
did I make a mistake somewhere?

Thuy Ngoc

Hi keredine arif,

If you want to use name property please replace where id = id_of_product_template to where name = 'name_of_product_template'

Adrian Ewizz Dev

Thuy, would this still be the same process for v.17?

Myat Thet Htwe

Thanks you for your help and you make me happy bro

Avatar
fz
Mejor respuesta

Thank you Thuy for guiding in the right direction. I'm on v18 and I had to use "set is_storable=FALSE"

0
Avatar
Descartar
Avatar
Michael Murray
Mejor respuesta

Hi good people, I have the same query but need to change from Consumable --> Storable - could you please let me know what they python code line should now look like?

eg. 

+ Python Code: env.cr.execute("""Update product_template set type = 'storable' where id = id_of_product_template """)

My confusion is exactly what value to set the type to.

Thank you very much.

0
Avatar
Descartar
Michael Murray

Ahh - sorted it out - I now know that I need to set type = 'product'.
Used and it works well.

Avatar
Rickard Wallster
Autor Mejor respuesta

Thanks for your help Thuy.

Unfortunately  I do not have access to the database so I can't try that out. I was hoping there was a way to change this data from UI or studio.

I can't understand why there is such a restriction on this field. In my experience this is a field that is quite often changed on products over time.

0
Avatar
Descartar
Thuy Ngoc

Hi Rickard,

You can follow these steps to change this data from UI:
Step 1: Go to menu Settings => Technical => Actions => Server Actions.
Step 2: Create an action with the following information:
+ Name: Update product type
+ Model: Server Action
+ Action To Do: Execute Python Code
+ Python Code: env.cr.execute("""Update product_template set type = 'consu' where id = id_of_product_template """)
Step 3: Click Run.

Avatar
Dr. Thomas Koliwer
Mejor respuesta

I'd buy you a beer if you had a solution.

I've had this case several times and each time I've created a duplicate - corrected it and archived the old one. Terribly tedious. The same thing happens with the product category, by the way. I understand the reason why this is not easy to do (e.g. valuation of stock), but it's still stupid.


@Thuy: What beer you prefer? Many thanks, will test it.

0
Avatar
Descartar
Rickard Wallster
Autor

Hi Thomas
You can send a beer to Mr Thuy, he solved it for us ;)

Thuy Ngoc

Hi Thomas,
I'm in Vietnam so it's hard to receive beer from you. I'm glad it was of help to you.

¿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
odoo 14: override controller to add more fields in Odoo SignUp form Resuelto
override controllers v14
Avatar
Avatar
Avatar
2
may 24
6018
Warning on Odoo 14 with track_visibility Resuelto
code models warning v14
Avatar
Avatar
1
oct 24
23345
How to override "_title_changed" function in Web?
webclient javascript override v14
Avatar
Avatar
2
may 22
3101
Odoo method override order explained
sale.order stock.move override v14
Avatar
0
ene 22
4794
override onchange function Resuelto
onchange override Odoo13.0 v14
Avatar
1
oct 21
342
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