تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
20169 أدوات العرض

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
أكتوبر 23
1431
1
يناير 25
2801
2
مايو 22
4014
2
مايو 24
4345
2
ديسمبر 24
21387