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

I am trying to create an automation rule to copy sales order tags (tag_ids) to invoices upon invoice creation / save.  I have a custom field in my invoice model called account.move.x_invoice_tags.  This is working as expected.  However, I noticed that the logs of the invoice does not indicate anything about the custom field (tag) being populated despite being populated successfully.


Is there any way that the history can be updated with this action as well?



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

Do you have 'enabled ordered tracking' on, on your new field?
Then it should log (i'm assuming you mean the chatter box) al changes.

second option would be to update your automated action with the function 

record.message_post(body=(tags_ids))



Ảnh đại diện
Huỷ bỏ
Tác giả

by using `body=(tags_ids)`, it showed the ID (the number found in crm.tag.id) in the chatter, instead of the text. To overcome this, I had to collect the display_name and write the display name in the message_post, like so:
```
for rec in sale_order.tag_ids:
tags_list.append(rec.id)
tag_names.append(rec.display_name)
```

then write it as:
```
tag_names_str = ', '.join(tag_names)
invoice.message_post(body=f"Invoice Tags: {tag_names_str}")
```

This works perfectly for my requirements. But I wonder if there is a way for the tag to appear as badge (chip) in the chatter instead of plain text?

Câu trả lời hay nhất

x_invoice_tags fields need to have tracking=True i guess

Ảnh đại diện
Huỷ bỏ
Tác giả

I tried to set the x_invoice_tags to tracking = True but it seems not to make any difference.

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 11 24
1685
0
thg 9 24
1382
0
thg 5 24
26
1
thg 4 24
4788
0
thg 3 24
1692