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

Hello.

I am trying to create an automated action that will prevent the creation of the Sales order if there is no contact selected as Customer.

Example:

Company Ltd. --> Not allowed

Company Ltd., Name Username --> Allowed

I tried with an Automated action on creation and a Python code:

x = env['sale.order'].partner_id.parent_id
 if x == false:
    raise Warning("CONTACT IS MISSING")

But it doesn't work, x is always "false". Any suggestions?


Thank you so much!

Nejc

アバター
破棄
最善の回答
if not record.partner_id.parent_id:
  Warning('CONTACT IS MISSING')


アバター
破棄
最善の回答

Hi,

Try this code and see,

x = rec.partner_id.parent_id
if not x:
    raise Warning("CONTACT IS MISSING")


Thanks

アバター
破棄
関連投稿 返信 ビュー 活動
1
11月 22
6476
0
1月 21
2308
1
11月 22
3649
3
2月 25
1846
1
12月 24
2035