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

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?


-----EDIT SOLUTION----

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,


Selverine



الصورة الرمزية
إهمال
أفضل إجابة

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

الصورة الرمزية
إهمال
الكاتب أفضل إجابة

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,


Selverine

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
مارس 15
2849
6
ديسمبر 20
7333
2
فبراير 18
5034
1
أغسطس 16
4307
1
أغسطس 25
292