odoo development: difference between search() and search_read()

Summary of Common Odoo Functions and Attributes

I. Odoo Functions

1 Query Method

search(): Called in the search view


search_count(): Called when counting records in the view


name_search(): called when searching many2one fields


search_read(): Called when clicking "Search More" on a many2one field


read_group(): Called when grouping search views


2 Odoo-Context-key:value

Functions corresponding to 1 context

Get the value corresponding to the key in the context

self._context.get(fieldname)

Set the value corresponding to the key in the context

self.with_context({'filed_1':'new_value_1','field_2':'new_value_2'})


2 context corresponding key

country_id: The context parameter can be added to a many-to-one field, for example: append the corresponding country field after the state address.

<field name="state_id" context="{'country_id':country_id}">

1

currency_id: Display currency

search_default_fieldname: Default search field, introduced in the action XML.

group_by: Grouping.

default_fieldname: Set default values for fields in the record.

tree_view_ref/form_view_ref: Specifies the view opened when clicking a many2one field

关于我们

​我们致力于帮助中小企业实现数字化转型,我们的团队由一群充满激情和创新思维的专业人士组成,他们具备丰富的行业经验和技术专长。

扫一扫获取顾问以及手册

归档
Sign in to leave a comment
Analysis of Odoo Permission Groups (groups_id) and Detailed Explanation of Master-Slave Link Relationships Involved in eval