Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Food & Hospitality
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Guest House
    • Distributor nápojů
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Trades
    • Údržbář
    • IT hardware a podpora
    • Solar Energy Systems
    • Výrobce obuvi
    • Úklidové služby
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Browse all Industries
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Services for Partners
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Best Practice to convert an existing Product Variant to a Standalone Product

Odebírat

Get notified when there's activity on this post

This question has been flagged
product.productvariantsproduct.template
1 Odpovědět
1562 Zobrazení
Avatar
Eliot Rayner

Hi odooers


I have several products which all have variants. I wish to convert these product.product variants into standalone products (product.template).

What is the best practice for this process, whilst retaining the values of the original product.template into each new standalone product and retain their product.product variant data ?


regards

Eliot

0
Avatar
Zrušit
Avatar
D Enterprise
Nejlepší odpověď

Backup your database

Always first! This is a destructive operation if done wrong.

Identify products to convert

Only proceed if the template has more than one variant.
templates_to_convert = env['product.template'].search([('product_variant_count', '>', 1)])

Iterate over each variant

Write a script to process each product.product variant and create a standalone product.template.
Example Logic (Python or Server Action):

for product in templates_to_convert.mapped('product_variant_ids'):

    old_template = product.product_tmpl_id


    # Copy fields from the template

    new_template_vals = {

        'name': f"{old_template.name} - {product.display_name}",  # or custom naming

        'type': old_template.type,

        'categ_id': old_template.uom_po_id.id,

        'taxes_id': [(6, 0, old_template.taxes_id.ids)],

        'supplier_taxes_id': [(6, 0, old_template.supplier_taxes_id.ids)],

        'description': product.description or old_template.description,

        'default_code': product.default_code,

        'barcode': product.barcode,

        'image_1920': product.image_1920,

        # add other fields you want to preserve

    }


    # Create new template

    new_template = env['product.template'].create(new_template_vals)


    # You can also update the product.product record if needed

    new_product = new_template.product_variant_id


    # Optional: Copy stock quantities, routes, BOMs, etc.

    # Optional: deactivate old product or mark it for review

Copy extra info if needed

  • Stock Quantities: Transfer from old variant to new product.
  • BOMs: Reassign to the new product.template.
  • Sales/Purchase history: Keep using the old product if traceability is important.
  • Custom Fields: If you've added custom fields, map them accordingly.



-1
Avatar
Zrušit
Eliot Rayner
Autor

Thanks, I will try this

Enjoying the discussion? Don't just read, join in!

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
What is the way that product.product and product.template synchronize data? Vyřešeno
product.product product.template
Avatar
Avatar
Avatar
2
srp 23
5954
Making a variantproduct from existing product templates
product.product product.template
Avatar
0
říj 21
2324
how to update field in product.product model Vyřešeno
product.product product.template
Avatar
Avatar
1
zář 19
5951
Returning to a single attribute on a product template
variant product.product variants attributes product.template
Avatar
0
srp 24
1916
Importing products with & without product variants Vyřešeno
import inventory product.product variants product.template
Avatar
Avatar
Avatar
Avatar
Avatar
5
říj 21
18156
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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