跳至内容
菜单
此问题已终结
2 回复
2574 查看

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
6292
0
1月 21
2246
1
11月 22
3439
3
2月 25
1618
1
12月 24
1822