Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Real Estate
    • Real Estate Agency
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consulting
    • Accounting Firm
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Solar Energy Systems
    • Shoe Maker
    • Serveis de neteja
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

How to update Product Type from consumable to tracked after a sale has already been completed

Subscriure's

Get notified when there's activity on this post

This question has been flagged
errorinventoryconsumableproductsv18
5 Respostes
4749 Vistes
Avatar
Stefan Etter

Hey Team

I'm just wondering if it is possible to update a product to track inventory after it has been previously sold as a consumable item.

We just done our stock take so we now have up-to-date numbers on all the items we have in stock.

But since we have already sold some of these products when we want to change a consumable product to a tracked product that comes up with the error that we cannot change it after a sale has been completed.

Invalid Operation

You can not change the inventory tracking of a product that was already used.

I assume the most tidy/simple method here is to duplicate the product and then archive the old one?


Thanks



0
Avatar
Descartar
Haim Katzav

i am encountering the same can someone reply please thanks


Avatar
Rakesh Patel (patr)
Best Answer

hello Etter 

my suggestion is to Duplicate the Product Archive of the Old One and change the product type from Consumable to Storable Product.

1
Avatar
Descartar
Avatar
Rickard Wallster
Best Answer

Hi

This is a process you can use to change product type. I got it from Thuy Ngoc, so all credits to him.

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 detailed_type = 'consu' where id = id_of_product_template """)
Step 3: Click Run

To get the ID of your product, make an export with that field. Replace "id_of_product_template" in the code with your specific number.

If you want the change product type to storable product, replace "consu" with "product".

0
Avatar
Descartar
Nourhan

kindly suggest the exact way to write the code.

Rickard Wallster

Hi Nourhan
I think you didn't read my post well enough :)

Here is the code again:

env.cr.execute("""Update product_template set detailed_type = 'consu' where id = id_of_product_template """)

Replace "id_of_product_template" in the code with the ID of your specific product.

Avatar
Dario Cucchiar
Best Answer

hi Stefan,

the answer you received from Rakesh is good and easy.
I f you also need to sum the sell statistics, you can try to manage them by labels on that products. Another possibility is to export all data of consumabile item, and import them in the storable one, but export/import is always more complicated option

0
Avatar
Descartar
Avatar
nickchacha@gmail.com
Best Answer
Below is a refined code for the above. Execute it as server action. Remember the product need to be of type 'consu' if you're in odoo18 
# Update both type and is_storable
env.cr.execute("""
    UPDATE product_template
    SET is_storable = true
    WHERE type = 'consu'
""")

updated_count = env.cr.rowcount
env.cr.commit()

# Show notification
action = {
    'type': 'ir.actions.client',
    'tag': 'display_notification',
    'params': {
        'title': 'Update Complete',
        'message': f'Updated {updated_count} products type and storable status',
        'type': 'success',
        'sticky': False,
    }
}
-1
Avatar
Descartar
Avatar
AloneMaker
Best Answer

From database edit tables product template field type

-2
Avatar
Descartar
Enjoying the discussion? Don't just read, join in!

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

Registrar-se
Related Posts Respostes Vistes Activitat
Slow moving inventory
inventory products
Avatar
Avatar
Avatar
2
de juny 25
2792
Bulk Product CSV import error: "Quants cannot be created for consumables or services. at multiple rows Resolve other errors first" Solved
error inventory
Avatar
Avatar
Avatar
Avatar
3
de set. 25
5781
Actualizar inventario por uso de producto en bar o cocina
inventory products
Avatar
0
de nov. 24
1396
Inventory "on hand" button not working? Solved
inventory products
Avatar
Avatar
Avatar
2
de nov. 23
3289
Create a combo product Solved
inventory products
Avatar
Avatar
7
de jul. 24
8873
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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