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

Hi everyone


I've been using the CRM for emailing lists of customers how ever one thing that I can't seem to figure out is how to adjust the Dynamic Placeholder in order to pull just the first name from 'Name' field. 


Since Odoo doesn't have a first/last name option but just one field for anme I wonder is there any way to edit the placeholder so that it only pulls the first part in the name field?


Currently using placeholder as ${object.name}


Many thanks

อวตาร
ละทิ้ง

Thank you so much for share this option Ray!

คำตอบที่ดีที่สุด

This seems to work:

Dear ${object.partner_id.name}, Dear ${object.partner_id.name.split()[0]}



Example:




Works even when there is no space in the name:


อวตาร
ละทิ้ง
ผู้เขียน

Works a charm!!

Thanks Ray

Ray, you always have the answers I'm looking for!

I'm curious, can I use any basic data type function (python) with a field of the same type? Seems to work for a few of the string type functions :)

It is not working in my odoo 16. Plz help.

คำตอบที่ดีที่สุด

We found this and it works perfectly: 

Hi ${not object.is_company and object.name and object.name.lower().replace('*', '').replace('(closed)', '').replace('closed', '').title().strip().split()[0] or 'There'},
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

To do this properly, you would need to create a custom field named something like "First Name" or "Mass Mailing Name", then, after adding that to all your contacts, pull the field out into your mail template using the name of the custom field, i.e. "x_first_name".  You would need to modify the contact form view and add a custom data field to the model in developer mode.

Scatch that - someone wrote a free extension - \https://accounts.odoo.com/apps/modules/10.0/partner_firstname/

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มี.ค. 24
2204
2
ก.ค. 22
4676
1
เม.ย. 21
2491
2
มิ.ย. 20
3448
5
ม.ค. 20
5905