Skip to Content
मेन्यू
This question has been flagged
2 Replies
2858 Views

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

Avatar
Discard
Best Answer
if not record.partner_id.parent_id:
  Warning('CONTACT IS MISSING')


Avatar
Discard
Best Answer

Hi,

Try this code and see,

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


Thanks

Avatar
Discard
Related Posts Replies Views Activity
1
नव॰ 22
6653
0
जन॰ 21
2405
1
नव॰ 22
3816
3
फ़र॰ 25
2105
1
दिस॰ 24
2173