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

Hi,

I need to make a float field(which have a compute function) editable.I have tried writing an inverse function for but cant get a clear idea about writing it.

demo_cost = fields.Float(string='Construction Cost', compute='_compute_demo_cost')
@api.depends('field_a', 'field_b')
def _compute_demo_cost(self):
for line in self:
line.demo_cost = line.field_a * line.field_b

Can anyone suggest me a better method or correct inverse function for making this field editable.

Thanks

아바타
취소
베스트 답변

Use the inverse function in the field definition - see documentation

demo_cost = fields.Float(string='Construction Cost ', compute='_compute_demo_cost', inverse='_set_demo_cost')

아바타
취소
베스트 답변

Hello, 

Can you please check this link :  https://www.holdenrehg.com/blog/2021-03-01_odoo-inverse-field-guide/ to help out your compute field editable issue.

아바타
취소
관련 게시물 답글 화면 활동
3
8월 24
13702
1
6월 25
15515
3
4월 25
5721
Compute Fields 해결 완료
2
7월 24
3502
1
1월 24
1878