If you want to create automated action in odoo, you have to go in .xml file and decide the action menu.
1- The first step is to create a model and to create some fields on this model->
class test_demo(models.Model):
_name = 'test.demo'
name = fields.Char(required=True)
numberOfUpdates = fields.Integer('Number of updates', help='The number of times the scheduler has run and updated this field')
lastModified = fields.Date('Last updated')
You have to create a new model named ‘test.demo’ which will contain three fields: a text field for the name, an integer field to keep track of how many times the record was updated and a date field. This is all you need on the database level. You have your fields in the database so you only need to show them to the user now.
2. Creating the views-> In creating the view when you have the database part ready it is time to create your view. For example you will create a simple form view and tree view which shows the fields ‘name’, ‘numberOfUpdates’ and ‘lastModified’ that we just created in our model and class.
<record id="view_scheduler_record_form" model="ir.ui.view">
<field name="name">test.demo.form</field>
<field name="model">test .demo</field>
<field name="arch" type="xml">
<form string=" test record">
<group>
<field name="name"/>
<field name="numberOfUpdates"/>
<field name="lastModified"/>
</group>
</form>
</field>
</record>
<!-- tree (list) view-->
<record id="view_test_tree" model="ir.ui.view">
<field name="name">test .demo.tree</field>
<field name="model">test .demo</field>
<field name="arch" type="xml">
<tree string=" test records">
<field name="name"/>
<field name="numberOfUpdates"/>
<field name="lastModified"/>
</tree>
</field>
</record>
3-Creating the automated action->In automated action, you have to create the models and the views. We need an automated action that will run automatically with a specific interval for model and class.
<openerp>
<data noupdate="1">
<record id="ir_cron_scheduler_demo_action" model="ir.cron">
<field name="name">Demo scheduler</field>
<field name="user_id" ref="base.user_root"/>
<field name="interval_number">2</field>
<field name="interval_type">minutes</field>
<field name="numbercall">-1</field>
<field eval="False" name="doall"/>
<field eval="'scheduler.demo'" name="model"/>
<field eval="'process_demo_scheduler_queue'" name="function"/>
</record>
</data>
</openerp>
Note-When you would install your module this would give the several automated action.
0 Comment(s)