콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
4 답글
2646 화면

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.

아바타
취소
관련 게시물 답글 화면 활동
2
5월 25
6062
1
3월 25
1761
4
3월 25
4633
3
2월 25
5659
2
2월 25
1608