How To Create a Transient Model in Odoo 17

CelineGeorge1 948 views 9 slides Jul 08, 2024
Slide 1
Slide 1 of 9
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9

About This Presentation

Models are the basic building block of Odoo. Generally we use models to store the data in the database in the form of table. Transient models are particularly used for handling data that needs to be stored temporarily.


Slide Content

How To Create a Transient Model in Odoo 17 Enterprise

Introduction Enterpr ise Models are the basic building block of Odoo. Generally we use models to store the data in the database in the form of table. Transient models are particularly used for handling data that needs to be stored temporarily.

Enterprise Transient Model Model which handle temporary data . Transient model record do not persistent between servers. Transient models are commonly used as wizards which act as interface to collect data from specific action.

Enterprise How to define Transient model Using the ‘ TransientModel ’ class which is a subclass of the Model, We can define a transient model from odoo import models class CancelWizard(models.TransientModel): _name = 'cancel.wizard' partner_id = fields.Many2one( 'res.partner' , string = 'Customer')

Enterprise Add security file Create security ir.model.access.csv inside security directory . Add security for the model. access_cancel,access_cancel,model_cancel_wizard,base.group_user,1,1,1,1

Enterprise Create Window Action. Create Window action for the transient model. Add the action to menu where it should display. <record id ="cancel_wizard_action" model ="ir.actions.act_window" > <field name ="name" > Cancel Wizard </field> <field name ="res_model" > cancel.wizard </field> <field name ="view_mode" > form </field> <field name ="target" > new </field> <field name ="help" type ="html"/ > </record> <menuitem id ="cancel_wizard_menu" name ="Cancel Wizard" parent ="sale.menu_sale_order" sequence ="5" action ="cancel_wizard_action" />

Enterprise Open wizard . By clicking the corresponding menu you can view the wizard.

Enterprise Open wizard. By clicking the corresponding menu you can view the wizard.

For More Info. Check our company website for related blogs and Odoo book. Check our YouTube channel for functional and technical videos in Odoo. Enterprise www.cybrosys.com