跳至內容
選單
此問題已被標幟
2 回覆
2695 瀏覽次數

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
6460
0
1月 21
2300
1
11月 22
3626
3
2月 25
1812
1
12月 24
2001