Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Maximum and Minimum Qty

on 8/2/15, 9:42 PM 955 views

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.

Solanki Shamji
on 8/3/15, 2:23 AM
On 8/3/15, 6:35 AM

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?

Solanki Shamji
on 8/3/15, 6:44 AM

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

on 8/3/15, 7:05 AM

how to set this on simple many2one field?

Solanki Shamji
on 8/3/15, 8:10 AM

'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.

on 8/3/15, 8:15 AM

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

Solanki Shamji
on 8/3/15, 9:07 AM

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?

on 8/3/15, 9:16 AM

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

Solanki Shamji
on 8/3/15, 9:18 AM

ur welcome :)

on 8/3/15, 9:21 AM

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?

on 8/3/15, 12:30 PM

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.

on 8/4/15, 1:12 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 8/2/15, 9:42 PM
Seen: 955 times
Last updated: 8/3/15, 6:35 AM