search: Usage self.env['model_name'].search([('name', '=', 'example')])

search_read: Usage: search_read([domain], [field names]), aggregates into a list, includes id value, optional parameters: order (sorting), limit (number of records). Convenient for data transfer between interfaces and databases.
mapped: Usage records.mapped('name'), aggregates into a list, can also be used with search, or with relationship fields .mapped(). The latter satisfies most common use cases. browse: Usage search([]).browse(value), can be an id or ids, reads specified records from the database, generates and returns objects. Unlike read and mapped methods, the returned objects can use . to access object fields and methods, and can also access related objects through relationship fields, similar to self records.
read: Usage self.env.ref('view_id').read()[0], returns a list of view dictionaries
super: used for inheriting methods,
@api.model def create(self, vals):
res = super(model_name, self).create(vals)
return res
@api.multi: Get record set
@api.onchange('monitored_field_name'): When the monitored field value changes, execute the method under onchange def _onchange_changed_field_name
@api.depends('dependency field'): Used for computed fields, similar to onchange, depends is executed at all times
def _compute_changed_field_name
Reverse write inverser = "method name", added to the field attribute, executes the reverse write method when saving.
@api.constrains('monitor_field_name'):
Constraint method, executed when creating or saving a document.
def _constrains_restrict_field_name
strftime: can be used to customize time format. today = datetime.today().strftime(' %Y year % m month %d day %H hour %M minute %S second') can meet the needs of daily time format conversion. This function also works on time format strings like '2020-12-12 20:20:20'.
strftime(' %Y year %m month %d day %H hour %M minute %S second') > December 12, 2020, 20:20:20
Timezone change: The time zone of the Odoo deployment differs from China's time zone by eight hours. Sometimes it is necessary to adjust the time zone, but you cannot simply add or subtract 8 hours; the date must also be modified accordingly.
from datetime import datetime
from datetime import timezone
from datetime import timedelta
today = utc_time.astimezone(timezone(timedelta(hours=+8))).strftime("%Y年%m月%d日 %H時%M分%S秒") 會用,
I haven't explored the specific meaning of each function; I'll look into them when I need them later. For now, I can only think of these typical ones. I won't describe the trivial basics; I'll add more when I gain new knowledge in the future.
