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

I want to Restrict the keyboard to input float (1.00) values, Characters, and special characters in  the Sale order line Quantity field ( only allowing the input of Integer values) by using python


@api.onchange('product_uom_qty')
def _check_integer_so(self):
for rec in self:
if rec.product_uom.is_integer_qty:
x = (rec.product_uom_qty % 1)
if x != 0:
                raise ValidationError("Please Enter Integer values Quantity Field")



for restrict decimal number, I put a boolean field in uom.uom model, if the boolean is true then restric to put float or charector in quantity field

아바타
취소

Hi,
Seems like this function will solve your issue. Can you explain what's the issue that you are facing using your function?

작성자

I want to restrict to entering decimal and characters values in the quantity field. only allow integer values

In sale order line
Currently Quantity field shows as 1.00 , I want to change it into 1 (No decimal values)

베스트 답변

Hello,

You have to write the onchange method on quantity field so you can put the restrictions to enter the character or decimal numbers.

shivoham.odoo@gmail.com

아바타
취소
작성자

Can You Please explain I try this method and failed

You can use rounding or ceil function for that.

관련 게시물 답글 화면 활동
1
6월 23
5378
1
3월 23
2562
0
4월 22
3615
1
7월 21
2443
0
10월 15
4839