While installing a module I want to call function automatically for creating records like demo data. How can we do that?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
Hi,
There are 3 methods, the pre init hook helps to execute some python code before calling the init methods, the post init hook helps to execute a function immediately after completing the installation.The 3rd option is overriding the init method of any class so that it will be executed while the class is being initialised.
And you can also use the function tag for this purpose.
For example:
<odoo>
<data noupdate="1">
<function
id="id"
model="your.model"
name="your_function_name"/>
</data>
</odoo>
Update this as a data file.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up