Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkostennota's
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • E-learning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Sociale media-marketing
    • E-mailmarketing
    • Sms-marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Artificiële Intelligentie
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelwinkel
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Horeca & Hospitality
    • Bar en café
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van mede-eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brouwerij
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Diensten
    • Klusjesman
    • IT-hardware & ondersteuning
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Alle bedrijfstakken bekijken
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijsprogramma
    • Scale Up! Business Game
    • Odoo bezoeken
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Partner worden
    • Diensten voor partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

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

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
restrictionwarningoverridev14
5 Antwoorden
10397 Weergaven
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
Annuleer
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 - SPOC

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

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
Annuleer
Rickard Wallster
Auteur

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'

Ewizz DevA, 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
Beste antwoord

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

0
Avatar
Annuleer
Avatar
Michael Murray
Beste antwoord

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
Annuleer
Michael Murray

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

Avatar
Rickard Wallster
Auteur Beste antwoord

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
Annuleer
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
Beste antwoord

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
Annuleer
Rickard Wallster
Auteur

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.

Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
odoo 14: override controller to add more fields in Odoo SignUp form Opgelost
override controllers v14
Avatar
Avatar
Avatar
2
mei 24
7255
Warning on Odoo 14 with track_visibility Opgelost
code models warning v14
Avatar
Avatar
1
okt. 24
25000
How to override "_title_changed" function in Web?
webclient javascript override v14
Avatar
Avatar
2
mei 22
4156
Odoo method override order explained
sale.order stock.move override v14
Avatar
0
jan. 22
5904
override onchange function Opgelost
onchange override Odoo13.0 v14
Avatar
1
okt. 21
342
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Partner worden
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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