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

My goal is to change the label/string of the field dynamically using get_view function. but i cant get the active_id of my custom model to

i tried self._context.get('active_ids') or active_id but any of this return a blank value. The goal of this is to browse the record and change the string based on the vendor name


Ex. Vendor Name: Unit Price


Azure Interior: Unit Price

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi John Lorenz,

Try using this fields_view_get function.

Hopes this helps.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi John Lorenz,

I hope you're doing well.

You can try the compute method without using @api.depends as I’ve mentioned below. This method will be called every time when the records are opened, refreshed, updated, and saved.

// Code is in Comment

Hope this Helps,

If you need any help in customization feel free to contact us.

Thanks & Regards,

Email:  odoo@aktivsoftware.com           

Skype: kalpeshmaheshwari

อวตาร
ละทิ้ง

// Code:

dynamic_label(your field) = fields.Char(string='Dynamic Label', compute='_compute_dynamic_label')

def _compute_dynamic_label(self):
for rec in self:
# Add your custom code here

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

John Lorenz Labitoria Deyparine

Beacuse active_ids,active_id key not available in context.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
พ.ค. 25
5791
1
มี.ค. 25
1630
4
มี.ค. 25
4423
3
ก.พ. 25
5403
2
ก.พ. 25
1474