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

I have this 'on_change' function:


remaining_days = fields.Integer(string='Remaining Days', store=True)


@api.onchange('current_date', 'payment_due_date', 'remaining_days')
def calculate_remaining_days(self):
    if self.current_date and self.payment_due_date:
        start_date = self.current_date
        end_date = self.payment_due_date
        days = (end_date - start_date).days
        self.remaining_days = days


Upon saving the record, the value of remaing_days is automatically converted to zero (0)

What could be possibly wrong?



아바타
취소
작성자

@Bella James, thanks, it works.

베스트 답변

Hi 

use attribute force_save="1" in view to save the value.


<field name="remaining_days"  force_save="1"/>

Regards


아바타
취소
관련 게시물 답글 화면 활동
6
3월 24
21348
4
7월 25
34893
0
11월 16
2371
1
5월 18
5919
0
12월 24
847