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

Is there any way to set a maximum or minimum quantity allowed per product in a sales order, or to be able to set this limit from the customer (also on the website)?

 

아바타
취소

You can use either constraint or onchange method to set this kind of limit.

베스트 답변

In my module i set this functionality by giving limit to <input/> tag in xml template.

<input type="number" name="quantity" min="1" max="5">

if you are creating or overriting view then you simpaly set this attribute this will help u too.


아바타
취소

This is for website only? How can we set on float or integer field?

Many2one field store id of other model so it is integer only. This is many2one field not simple integer field so it store integer.

how to set this on simple many2one field?

'simple': fields.integer('Simple integer field'), 'many2one_field': fields.many2one('other model object', 'Many2one field'), here you can see first one is integer field and second one is many2one field and both are integer field. many2one field store only integer type value not float type.

I mean how to set limit(min and max) on integer/float field?

As i above mention. in xml template. tag input type="number" min="0" max="5" t-att-value="object.many2one_field.qty". above code i set value dynamically and also give limit min and max. got it or not?

t-att-value="object.many2one_field.qty. ok now got it. Thanks

ur welcome :)

작성자

How would this work if I need to set this on a per product/customer basis? Different groups of customers would have different limits. This will only work for the website, how would I do this for inside the sales process?

As per my knowledge you can take min and max field in model so you can easily access and set max and min limit with per customer/product.

can anyone help? i want 0 not accept on cost
<?xml version="1.0"?>
<xpath expr="//field[@name='order_line']/tree//field[@name='price_unit']" position="after">
<field name="purchase_price" groups="base.group_user" required="1" type="number" min="1"/>
</xpath>

관련 게시물 답글 화면 활동
customer_lead V16 해결 완료
1
10월 23
1528
1
1월 25
2947
2
5월 22
4150
2
5월 24
4507
2
12월 24
21674