コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
3165 ビュー

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
3月 15
2260
6
12月 20
6775
2
2月 18
4686
1
8月 16
3807
0
4月 25
1547