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

I'm working on a tree view and would like to limit the total possible characters returned on <field name="origin"/>.

Is there a very simple way to accomplish this? Due to automatic procurement rules, some of my fields have become very long and mess up the tree views.

아바타
취소
베스트 답변

You could create a computed display_origin and then use this field in your tree, using something like the following (obviously change the numbers to whatever length you want):

display_origin = fields.Char(string='Origin', compute='_compute_display_origin')
@api.depends('origin')
@api.onchange('origin')
def _compute_display_origin(self):
     for rec in self:
         rec.display_origin = (rec.origin[:48] + '..') if len(rec.origin) > 50 else rec.origin
아바타
취소
베스트 답변

Hi,

There are multiple ways to achieve that but I would prefer if you can overwrite read method & then you can restrict no. of characters then it would be good & it will work.

아바타
취소
관련 게시물 답글 화면 활동
1
1월 21
4413
3
4월 19
7059
1
1월 24
13895
2
8월 22
20633
5
7월 15
7968