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í
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • 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
    • Služby pro partnery
    • 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

ver.14: strange behaviour of Boolean type field.

Odebírat

Get notified when there's activity on this post

This question has been flagged
booleanv14
1 Odpovědět
3653 Zobrazení
Avatar
SmithJohn45

hi all,

below are both Model (.py) and View (xml) files, when I run it from custom Menu and toggle off, instead of Update and set it to False it Deletes record... what I made mistake? is it due to  widget i used? or anythig else? please guide.


Python file:

from odoo import models, fields

class ServiceTypes(models.Model):
    _name = 'tests.servicetypes'
    _rec_name = 'name'
    _description = "Tests Service Types and Services"
    name = fields.Char(string="Services Types", required=True)
    active = fields.Boolean(string="Active?", default=True)
    service_type_ids = fields.One2many('tests.services', 'service_type_id')

class Services(models.Model):
    _name = 'tests.services'
    _rec_name = 'name'
    _description = "Tests Services"
    name = fields.Char(string="Service Name", required=True)
    service_type_id = fields.Many2one('tests.servicetypes', string="Service Type", required=True)
    active = fields.Boolean(string="Active?", default=True)


XML file:
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
    <!-- Services Master Detail Form -->
    <record model="ir.ui.view" id="testsservicetypes_form_view">
        <field name="name">testsservicetypes.form</field>
        <field name="model">tests.servicetypes</field>
        <field name="arch" type="xml">
            <form string="Service Type">
                <sheet>
                    <group>
                        <field name="name"/>
                        <field name="active" widget="boolean_toggle"/>
                    </group>
                    <notebook>
                        <page string="Services">
                            <field name="service_type_ids">
                                <tree editable="bottom" string="Services">
                                    <field name="name"/>
                                    <field name="active" widget="boolean_toggle"/>
                                </tree>
                            </field>
                        </page>
                    </notebook>
                </sheet>
            </form>
        </field>
    </record>

    <record model="ir.ui.view" id="testsservicetypes_tree_view">
        <field name="name">testsservicetypes.tree</field>
        <field name="model">tests.servicetypes</field>
        <field name="arch" type="xml">
            <tree string="Service Types">
                <field name="name"/>
                <field name="active" widget="boolean_toggle"/>
            </tree>
        </field>
    </record>
</odoo>

regards

0
Avatar
Zrušit
Avatar
Kiran K
Nejlepší odpověď

Hi ,

Odoo provides inbuilt features to enable archive and unarchive options for records 

if the model has a Boolean field named active , Odoo will archive the record when you toggle off . 

Rename field name active to any other name , it will work as you expected .


Hope it Helps ,

Kiran K 


3
Avatar
Zrušit
SmithJohn45
Autor

thanks, it means my lack of knowledge... again, and I have to change name "active" to "status" ?? please advice.

Kiran K

Just change field name active to something else , it will work as you expected . :)

SmithJohn45
Autor

ok, i renamed it to "active_status" ... thanks again for your help :)

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
Odoo14 alternative for Automated Translations through Gengo API module
v14
Avatar
Avatar
Avatar
Avatar
3
zář 25
3640
Odoo Community v14 Slow on High-End Servers, Fast on i5/i7 PCs
v14
Avatar
0
srp 25
1066
How to Managing Birthdate and Age in Odoo
v14
Avatar
Avatar
1
srp 25
3417
Update Initial Stock of Product using XMLRPC API [Odoo14] Vyřešeno
v14
Avatar
Avatar
Avatar
2
čvc 25
8999
"AttributeError: 'NoneType' object has no attribute 'CompileError'" configuring document Layout - Odoo 14
v14
Avatar
Avatar
Avatar
2
čvc 25
5348
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