Odoo Help


[RESOLVED] Force the customer to have at least one product inside quotations

on 1/25/16, 12:54 PM 826 views

Hi all,

I would like to know how to force the customer to have at least one product inside quotations.

With this, they will not be able to save the quotation ( so create a new line in the database) if there is no product.

I was thinking to add only required=true for the order_line but it is not working.

Someone has an idea?


It is working with this solution inside the create function:

def create(self, cr, uid, vals, context=None):

context = context or {}

if not vals['order_line']:

raise osv.except_osv(_('Error!'),_('You cannot confirm a Quotation which has no line.'))

Many thanks,


Axel Mendoza
On 1/25/16, 1:53 PM

One way is using a python constraint in the model to check the number of order lines in the sale.order

On 1/26/16, 6:58 AM

Ok, but where and how to do it?

And why required=true is not working for this field? It's because it is a OnetoMany?

Many thanks,


About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 1/25/16, 12:54 PM
Seen: 826 times
Last updated: 1/26/16, 9:32 AM