Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
20177 Lượt xem

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)?

 

Ảnh đại diện
Huỷ bỏ

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

Câu trả lời hay nhất

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.


Ảnh đại diện
Huỷ bỏ

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 :)

Tác giả

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>

Bài viết liên quan Trả lời Lượt xem Hoạt động
customer_lead V16 Đã xử lý
1
thg 10 23
1433
1
thg 1 25
2804
2
thg 5 22
4018
2
thg 5 24
4346
2
thg 12 24
21392