Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
2888 มุมมอง

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 :) 

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
เม.ย. 25
4163
1
เม.ย. 25
3822
0
พ.ค. 24
1013
0
ธ.ค. 22
1234
0
ต.ค. 22
1509