There's more...

The Python code is evaluated in a restricted context, where the following objects are available to use:

  • env: This is a reference for the Environment object, just like self.env in a
    class method.
  • model: This is a reference to the model class the server action acts upon. In our example, it is equivalent to self.env['project.task].
  • Warning: This is a reference to openerp.exceptions.Warning, allowing for validations that block unintended actions. It can be used as raise Warning('Message!').
  • record or records: This provides references to the current record or records, allowing you to access their field values and methods.
  • log: This is a function to log messages in the ir.logging model, allowing for database side logging on actions.
  • datetime, dateutil, and time: These provide access to the Python libraries.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.240.222