Base Automation: test rule on create
code
on_create
[('state', '=', 'draft')]
Base Automation: test rule on write
code
on_write
[('state', '=', 'done')]
[('state', '=', 'open')]
Base Automation: test rule on recompute
code
on_write
[('customer', '=', True)]
Base Automation: test recursive rule
on_write
code
record = model.browse(env.context['active_id'])
if 'partner_id' in env.context['old_values'][record.id]:
record.write({'state': 'draft'})
Base Automation: test rule on secondary model
code
on_create
Base Automation: test rule on write check context
on_write
code
record = model.browse(env.context['active_id'])
if 'user_id' in env.context['old_values'][record.id]:
record.write({'is_assigned_to_admin': (record.user_id.id == 1)})