Odoo 模型定义详解 - Oejia 技术栈,企业方案分享、Odoo顾问
Oejia 技术栈
主页
分享
微信模块
索引
关于
订阅
编辑器
登录
Odoo 模型定义详解
admin
on 2016-08-01 16:56:55
Odoo 模型内置配置项 ``` # 模型关键字名称 _name = None _description = None _order = 'id' _rec_name = None # 是否自动创建表 _auto = True # create database backend _register = False # Set to false if the model shouldn't be automatically discovered. _columns = {} _constraints = [] _custom = False _defaults = {} _parent_name = 'parent_id' _parent_store = False _parent_order = False _date_name = 'date' _sequence = None _needaction = False _translate = True # set to False to disable translations export for this model # dict of {field:method}, with method returning the (name_get of records, {id: fold}) # to include in the _read_group, if grouped on this field _group_by_full = {} # Transience _transient = False # True in a TransientModel # structure: # { 'parent_model': 'm2o_field', ... } _inherits = {} eg: _inherits = {'resource.resource': "resource_id"} # Mapping from inherits'd field name to triple (m, r, f, n) where m is the # model from which it is inherits'd, r is the (local) field towards m, f # is the _column object itself, and n is the original (i.e. top-most) # parent model. # Example: # { 'field_name': ('parent_model', 'm2o_field_to_reach_parent', # field_column_obj, origina_parent_model), ... } _inherit_fields = {} _table = None _sql_constraints = [] # model dependencies, for models backed up by sql views: # {model_name: field_names, ...} _depends = {} ``` ## API ``` '_abstract', '_actions_window_ids', '_add_fake_fields', '_add_field', '_add_inherited_fields', '_add_magic_fields', '_add_manual_fields', '_add_missing_default_values', '_add_sql_constraints', '_apply_ir_rules', '_auto', '_auto_end', '_auto_init', '_browse', '_build_model', '_build_model_attributes', '_build_model_check_base', '_build_model_check_parent', '_cache', '_check_concurrency', '_check_m2m_recursion', '_check_model_name', '_check_qorder', '_check_record_rules_result_count', '_check_recursion', '_check_removed_columns', '_check_selection_field_value', '_compute_display_name', '_constraint_methods', '_constraints', '_context', '_convert_records', '_convert_to_cache', '_convert_to_record', '_convert_to_write', '_cr', '_create', '_create_parent_columns', '_create_table', '_custom', '_date_name', '_depends', '_description', '_drop_constraint', '_drop_table', '_execute_sql', '_export_rows', '_extract_records', '_field_computed', '_field_create', '_field_inverses', '_field_triggers', '_fields', '_fold_name', '_generate_m2o_order_by', '_generate_order_by', '_generate_order_by_inner', '_generate_translated_field', '_get_default_calendar_view', '_get_default_form_view', '_get_default_graph_view', '_get_default_kanban_view', '_get_default_pivot_view', '_get_default_search_view', '_get_default_tree_view', '_get_dirty', '_get_external_ids', '_get_xml_ids', '_has_onchange', '_ids', '_in_cache_without', '_in_modules', '_inherit', '_inherit_children', '_inherited_models', '_inherits', '_inherits_check', '_inherits_children', '_inherits_join_add', '_inherits_join_calc', '_init_column', '_init_constraints_onchanges', '_instanciate', '_is_an_ordinary_table', '_is_dirty', '_local_constraints', '_local_sql_constraints', '_log_access', '_m2o_add_foreign_key_checked', '_m2o_add_foreign_key_unchecked', '_m2o_fix_foreign_key', '_mapped_cache', '_mapped_func', '_menu_ids', '_model_cache_key', '_module', '_name', '_name_search', '_needaction', '_onchange_eval', '_onchange_methods', '_onchange_spec', '_order', '_original_module', '_parent_columns_exist', '_parent_name', '_parent_order', '_parent_store', '_parent_store_compute', '_patch_method', '_pop_field', '_prefetch', '_prefetch_field', '_prepare_setup', '_proper_fields', '_read_from_database', '_read_group_fill_results', '_read_group_format_result', '_read_group_prepare', '_read_group_prepare_data', '_read_group_process_groupby', '_read_group_raw', '_rec_name', '_rec_name_fallback', '_recompute_check', '_recompute_done', '_recompute_todo', '_register', '_register_hook', '_report_ids', '_revert_method', '_save_constraint', '_save_relation_table', '_search', '_select_column_data', '_sequence', '_set_dirty', '_setup_base', '_setup_complete', '_setup_done', '_setup_fields', '_sql_constraints', '_table', '_table_exist', '_transient', '_transient_check_count', '_transient_clean_old_rows', '_transient_clean_rows_older_than', '_transient_max_count', '_transient_max_hours', '_transient_vacuum', '_translate', '_uid', '_validate_fields', '_view_ids', '_where_calc', '_write', 'access_ids', 'actions_server_ids', 'actions_window_ids', 'browse', 'check_access_rights', 'check_access_rule', 'check_field_access_rights', 'clear_caches', 'compute_concurrency_field', 'compute_concurrency_field_with_access', 'concat', 'copy', 'copy_data', 'copy_translations', 'create', 'create_date', 'create_uid', 'create_view', 'create_workflow', 'default_get', 'delete_workflow', 'display_name', 'ensure_one', 'env', 'exists', 'export_data', 'field_id', 'fields_get', 'fields_get_keys', 'fields_view_get', 'filtered', 'generate_xml', 'get_access_action', 'get_empty_list_help', 'get_external_id', 'get_formview_action', 'get_formview_id', 'get_metadata', 'get_xml_id', 'id', 'ids', 'info', 'inherited_model_ids', 'init', 'invalidate_cache', 'is_transient', 'load', 'load_views', 'mapped', 'menu_ids', 'model', 'modified', 'modules', 'name', 'name_create', 'name_get', 'name_search', 'new', 'onchange', 'pool', 'print_report', 'read', 'read_group', 'recompute', 'redirect_workflow', 'refresh', 'report_ids', 'resolve_2many_commands', 'resolve_o2m_commands_to_record_dicts', 'search', 'search_count', 'search_read', 'signal_workflow', 'sorted', 'state', 'step_workflow', 'sudo', 'toggle_active', 'transient', 'union', 'unlink', 'update', 'user_has_groups', 'view_header_get', 'view_ids', 'view_init', 'with_context', 'with_env', 'with_prefetch', 'write', 'write_date', 'write_uid' ```
Information
Odoo 模型定义详解
http://www.oejia.net/blog/2016/08/01/odoo_model_conf.html
http://www.oejia.net/raw/2016/08/01/odoo_model_conf.md
admin
on 2016-08-01 16:56:55
Category
Odoo
Tag
Related
2020-09-30 :
微信模块 Oejia_wx v0.6.3 发布,多项兼容优化,即将全面适配 Odoo14
2020-03-30 :
微信模块 Oejia_wx v0.6.2 发布,统一SDK,缓存对象配置模型等多项优化
2020-03-15 :
Odoo 扫码及授权免密登录模块使用说明
2019-12-09 :
YouPBX 基本使用说明
2019-12-02 :
小程序商城分销模块的使用说明
2019-03-25 :
Odoo 基于企业微信实现的通用审批流功能的自助配置及使用说明
2019-01-30 :
Odoo后端性能优化之—取消当访问页面404时对ir.attachment表的查询
2018-11-13 :
微信模块 Oejia_wx v0.5.5 发布,优化菜单配置及会话管理增加素材支持
2018-01-31 :
Odoo 微信模块文档
2015-01-07 :
RQ异步任务队列介绍
官方公众号
关注公众号实时咨询我们
分类
Odoo (87)
DjangoX (11)
后端HTTP (7)
YouMd (4)
移动开发 (4)
Django (4)
公告说明 (2)
JS (2)
Python (1)
前端 (1)
Nginx (1)
桌面UI (1)
February 2021
Sun
Mon
Tue
Wed
Thu
Fri
Sat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
About This Entry
Nginx upstream 配置示例
Odoo 微信模块的企业号(企业微信)使用说明
About This Blog
main index
to find recently
archives
to find all
标签
微信模块
小程序商城
Python
Web
Http
Cordova
客服系统
微信客服系统
HTML5
微信客服
Markdown
解析
DjangoX
微信模块发布记录
客服工单系统
ExtJS
示例
Excel
JS
新年
PyQT
扩展开发
YouPBX
服系统
最近发布
Odoo 字段定义详解
Linux 软件源推荐
如何实现 Odoo 数据每天备份到Amazon S3存储
Odoo 如何用命令行备份还原数据
如何实现 Odoo 数据每天备份到本地存储
微信模块 Oejia_wx v0.6.3 发布,多项兼容优化,即将全面适配 Odoo14
Odoo 小程序商城模块 Oejia_weshop v0.2.2 发布,全面支持多公司销售机制
OE商城积分模块
Odoo14 相对 Odoo13 依赖库的变化
Oejia 七月模块产品动态之OE商城
Friend Links
Oejia技术梦博客分享
YouMd,爱上MarkDown
Mole轻量级wsgi架子