跳至内容
菜单
此问题已终结
2 回复
3346 查看

Hi everyone, I'am creating an automated action To send an email when updating a field, pls help me find the correct syntax.

field name : State


name="name">demande d'embauche approuvée           
name="model_id" ref="employee_recruitment_app.model_staff_recruitment"/>           
name="active"eval="True"/>           
name="trigger">on_write           
name="trigger_field_ids">state           
name="state">email           
name="template_id" ref="demande_embauche_approuvee"/>           
name="filter_pre_domain">[('state','=','draft')]           
name="filter_domain">[('state','=','approve')]                    

 


形象
丢弃
最佳答案

You can achieve this by overriding base.automation model using python:

from odoo import api, models

class BaseAutomation(models.Model):
_inherit = 'base.automation'

@api.onchange('field_you_want')
    def _send_email(self):
# email sending code here


形象
丢弃

Or if you want to do it after updating it or based on the value of updated field you can override write method as wel.

编写者 最佳答案

Thank you Arian :) 

形象
丢弃
相关帖文 回复 查看 活动
1
4月 25
4649
1
4月 25
4539
0
5月 24
1453
0
12月 22
1508
0
10月 22
1836