* Methods and modifiers
API is a named decorator that identifies Cr,cursor, UID, user, user_id, id, IDS, context
# @api. Returns
Returns the recordset for the specified model
@api. Returns (' Res.partner ')
def afun (self):
...
Return x # a RecordSet
This returns the partner record set
# @api. One
Returns the current record
@api. One
def afun (self):
Self.name = ' Toto '
# @api. Multi
Back to record set
@api. Multi
def afun (self):
Len (self)
# @api. Model
Guaranteed compatible version
@api. Model
def afun (self):
Pass
# @api. Constrains
Constraints when guaranteeing a relationship
# @api. Depends
Given good dependencies
@api. Depends (' name ', ' An_other_field ')
def afun (self):
Pass
# @api. onchange
Monitor the change of the field and then manipulate the response
@api. onchange (' FIELDX ')
def do_stuff (self):
If self.fieldx = = x:
Self.fieldy = ' Toto '
(17) Methods and modifiers