Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

How do I dump all the fields and values in a model (ideally including those from relationships)?

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
developmentormmodel
1 Odpowiedz
13851 Widoki
Awatar
Darrel

Specifically, I am trying to see all of the data included in a product record, and I'm doing it from the create() method of a stock.move child class I have created.

If I use: _logger.info(', '.join(dir(product)))

I get (exhibit A). It does have the fields, but it also has all of the models helper functions and properties, and there is so much there that it is very hard to see just the actual fields from the database that have to do with products (like weight, SKU, etc).

I found a function called get_fields() in the model source, but it seems to dump all available schema and metadata surrounding products, way more than I need, and does not provide the actual values in the record.

I just want a dictionary of key value pairs for product and it's related models that I have loaded using browse(). Does something like that exist?

 

Exhibit A:

CONCURRENCY_CHECK_FIELD, _BaseModel__export_rows, _BaseModel__export_xml_id, __add__, __and__, __class__, __contains__, __delattr__, __dict__, __doc__, __eq__, __format__, __ge__, __getattribute__, __getitem__, __gt__, __hash__, __init__, __int__, __iter__, __last_update, __le__, __len__, __lt__, __metaclass__, __module__, __ne__, __new__, __nonzero__, __or__, __reduce__, __reduce_ex__, __repr__, __setattr__, __setitem__, __sizeof__, __str__, __sub__, __subclasshook__, __unicode__, __weakref__, _add_field, _add_magic_fields, _add_missing_default_values, _add_sql_constraints, _all_columns, _apply_ir_rules, _auto, _auto_end, _auto_init, _browse, _build_model, _cache, _check_concurrency, _check_ean_key, _check_m2m_recursion, _check_qorder, _check_record_rules_result_count, _check_recursion, _check_removed_columns, _check_selection_field_value, _columns, _compute_display_name, _compute_uos_qty, _constraint_methods, _constraints, _context, _convert_records, _convert_to_cache, _convert_to_write, _cr, _create, _create_parent_columns, _create_table, _custom, _date_name, _defaults, _depends, _description, _dirty, _drop_constraint, _execute_sql, _extract_records, _field_create, _fields, _find_partner_from_emails, _garbage_collect_attachments, _generate_m2o_order_by, _generate_order_by, _get_access_link, _get_column_infos, _get_default_calendar_view, _get_default_form_view, _get_default_search_view, _get_default_tree_view, _get_domain_dates, _get_domain_locations, _get_external_ids, _get_followers, _get_image_variant, _get_inbox_action_xml_id, _get_message_data, _get_name_template_ids, _get_partner_code_name, _get_price_extra, _get_subscription_data, _get_tracked_fields, _get_user_chatter_options, _get_xml_ids, _group_by_full, _has_onchange, _ids, _in_cache_without, _inherit, _inherit_fields, _inherits, _inherits_check, _inherits_join_add, _inherits_join_calc, _inherits_reload, _inherits_reload_src, _init_constraints_onchanges, _init_function_fields, _init_manual_fields, _is_an_ordinary_table, _is_product_variant_impl, _local_constraints, _local_sql_constraints, _log_access, _log_create, _m2m_raise_or_create_relation, _m2o_add_foreign_key_checked, _m2o_add_foreign_key_unchecked, _m2o_fix_foreign_key, _mail_flat_thread, _mail_mass_mailing, _mail_post_access, _mapped_cache, _mapped_func, _message_add_suggested_recipient, _message_extract_payload, _message_find_partners, _message_get_auto_subscribe_fields, _message_preprocess_attachments, _model, _module, _name, _name_search, _needaction, _needaction_domain_get, _o2m_raise_on_missing_reference, _onchange_eval, _onchange_methods, _onchange_spec, _order, _original_module, _ormcache, _parent_columns_exist, _parent_name, _parent_order, _parent_store, _parent_store_compute, _patch_method, _pop_field, _prefetch_field, _prepare_setup_fields, _product_available, _product_available_text, _product_code, _product_lst_price, _product_partner_ref, _product_price, _purchase_count, _read_from_database, _read_group_fill_results, _read_group_format_result, _read_group_get_domain, _read_group_prepare, _read_group_prepare_data, _read_group_process_groupby, _rec_name, _rec_name_fallback, _recompute_check, _recompute_done, _recompute_todo, _register, _register_hook, _revert_method, _sales_count, _save_constraint, _save_relation_table, _search, _search_followers, _search_is_follower, _search_message_unread, _search_product_quantity, _select_column_data, _sequence, _set_default_value_on_column, _set_followers, _set_image_variant, _set_product_lst_price, _setup_fields, _sql_constraints, _stock_move_count, _store_get_values, _store_set_values, _table, _table_exist, _track, _transient, _transient_clean_old_rows, _transient_clean_rows_older_than, _transient_vacuum, _translate, _uid, _update_store, _validate_fields, _view_look_dom_arch, _website_url, _where_calc, _write, accessory_product_ids, action_view_routes, active, alternative_product_ids, attribute_line_ids, attribute_value_ids, browse, categ_id, check_access_rights, check_access_rule, check_field_access_rights, check_mail_message_access, check_recursion, clear_caches, code, color, company_id, compute_concurrency_field, compute_concurrency_field_with_access, copy, copy_data, copy_translations, cost_method, create, create_date, create_uid, create_workflow, default_code, default_get, delete_workflow, delivery_count, description, description_purchase, description_sale, display_name, distinct_field_get, ean13, ensure_one, env, exists, export_data, fields_get, fields_get_keys, fields_view_get, filtered, get_access_action, get_empty_list_help, get_external_id, get_formview_action, get_formview_id, get_metadata, get_suggested_thread, get_xml_id, id, ids, image, image_medium, image_small, image_variant, import_data, incoming_qty, invalidate_cache, is_product_variant, is_transient, list_price, load, loc_case, loc_rack, loc_row, location_id, log, lst_price, mapped, mes_type, message_auto_subscribe, message_capable_models, message_change_thread, message_follower_ids, message_get_default_recipients, message_get_email_values, message_get_reply_to, message_get_subscription_data, message_get_suggested_recipients, message_ids, message_is_follower, message_last_post, message_mark_as_read, message_mark_as_unread, message_new, message_parse, message_partner_info_from_emails, message_post, message_process, message_redirect_action, message_route, message_route_process, message_route_verify, message_subscribe, message_subscribe_users, message_summary, message_track, message_unread, message_unsubscribe, message_unsubscribe_users, message_update, modified, name, name_create, name_get, name_search, name_template, need_procurement, new, on_order, onchange, onchange_uom, open_product_template, optional_product_ids, orderpoint_ids, outgoing_qty, packaging_ids, partner_ref, pool, price, price_extra, price_get, pricelist_id, print_report, product_manager, product_tmpl_id, product_type_id, product_variant_count, product_variant_ids, property_account_creditor_price_difference, property_account_expense, property_account_income, property_stock_account_input, property_stock_account_output, property_stock_inventory, property_stock_procurement, property_stock_production, public_categ_ids, purchase_count, purchase_ok, qty_available, qty_available_text, read, read_followers_data, read_group, read_string, reception_count, recompute, redirect_workflow, refresh, rental, resolve_2many_commands, resolve_o2m_commands_to_record_dicts, route_ids, sale_delay, sale_ok, sales_count, search, search_count, search_read, seller_delay, seller_id, seller_ids, seller_qty, signal_workflow, sorted, standard_price, state, step_workflow, sudo, supplier_taxes_id, taxes_id, track_all, track_incoming, track_outgoing, type, unlink, uom_id, uom_po_id, uos_coeff, uos_id, update, user_has_groups, user_review, valuation, view_header_get, view_init, virtual_available, volume, warehouse_id, warranty, website_description, website_message_ids, website_meta_description, website_meta_keywords, website_meta_title, website_published, website_sequence, website_size_x, website_size_y, website_style_ids, website_url, weight, weight_net, with_context, with_env, write, write_date, write_string, write_uid

1
Awatar
Odrzuć
Awatar
Darrel
Autor Najlepsza odpowiedź

I eventually wrote a little function for this. Not sure if there is anything for this built into odoo.

        import pprint
        def model_data(obj):
            fields_dict = {}
            for key in obj.fields_get():
                fields_dict[key] = obj[key]
            return fields_dict

 

1
Awatar
Odrzuć
Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
How i can verify record then save in Odoo 12?
orm model
Awatar
0
wrz 19
4172
Why pool.get(model) is used to get a model instance instead of pool[model]?
development orm
Awatar
Awatar
Awatar
2
lut 17
11744
Get model data in a controller Rozwiązane
orm model controller
Awatar
Awatar
Awatar
Awatar
4
paź 21
38515
Usage of ORM methods and ORM API documentation?
database orm model
Awatar
Awatar
1
mar 15
6031
why res.config model in odoo is TransientModel not Model ?
wizard orm model TransientModel
Awatar
Awatar
1
sie 25
4698
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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