Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
1073 Lượt xem

How to create an automated action for contacts app for the following action? 

When an individual contact card is created with a company linked, it should automatically populate certain fields of that individual's company with existing company field data. 

For e.g., the values of country, city, phone no. should automatically be updated with that of the company data. 

I have created an automated action for the model Contact, under Action To Do: Update the Record, Trigger On Creation & Update and  added the following to Data to Write: 

Field: Country (res.partner) 

Evaluation Type: Python Expression 

Record:  

Value: record.x_studio_country 
For the values, I have tried out different formats: 

1. record.x_studio_country 

2. record.partner_id.x_studio_country 

3. partner_id.x_studio_phone_no_1 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

I'm not sure I fully understand, but if you want the country for the linked company, it should be:

 parent_id.country_id

So the Python code would be:

record['country_id'] = record.parent_id.country_id.id


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 4 25
1430
Odoo App Đã xử lý
1
thg 11 23
2017
0
thg 5 24
1734
0
thg 9 23
2676
0
thg 9 23
2302