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

I want users to find record without an External ID, and to be able to see the External ID of all records.

อวตาร
ละทิ้ง

Carlos, thank you for your help. Actually you were right I was looking for a solution for Studio. This worked really well, I was able to create the field without any problems.

Thank you for your help!


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

The External ID is not normally exposed on records.

You need to create a field to store this value, then add it to the View you want to see it (and search for it).



What you will see:



Code:

res = self.get_external_id()
for record in self:
record['x_xml_id'] = res.get(record.id)
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Using the answer from Ray this code works for me in Odoo 13:

product_id = fields.Many2one('product.product', 'Product')
prod_ext_id = fields.Char('ID Ext Product', compute='compute_ext_id_prod')

def compute_ext_id_prod(self):
for record in self:
res = record.product_id.get_external_id()
record.prod_ext_id = False
if res.get(record.product_id.id):
record.prod_ext_id = res.get(record.product_id.id)
I hope it helps!
อวตาร
ละทิ้ง

Hi Carlos,

When I tried to use you code:

On the Advanced Section Odoo is requesting a Dependency, without it I can't save it. What should I write there?

Thank you!

Hello Carlos Lopez,

For use this example in Odoo Studio is a little different:

Check readonly option, uncheck stored

Dependency (required but no used in this code): name

Compute:
for record in self:
res = record.get_external_id()
record['x_studio_ext_id'] = False
if res.get(record.id):
record['x_studio_ext_id'] = res.get(record.id)

I hope it help you.

Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.ย. 21
4778
0
มี.ค. 25
2868
0
เม.ย. 24
1710
1
ส.ค. 25
491
1
มิ.ย. 25
24972