Create Records
For creating the record of model , create a
field_data
My first product
Modify Records
In some cases, we need to update the previously created records by other modules.
To do this, create the record with id (module_name.record_id) in your module like:
Example:some_data
My modified Product
Delete Records
In case you want to delete the record , use
Example:
Calling methods from XML data
Calling method without parameters
1- Create a method in model
from odoo import api, fields, models class product(models.Model): _inherit = "product.product" @api.model def my_method_without_params(self): ...
2- Call this method
In order to call this method, create a
Example:
Once module is installed this method(oe_method_without_params) will be called.
Calling method with parameters
1- Create a method in model
from odoo import api, fields, models class product(models.Model): _inherit = "product.product" @api.model def my_method_with_params(self, param1, param2): ...
2- Call this method
In order to call this method, create a
Example:param1 param2 ....
My value 1 My value 1