Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
2726 Weergaven

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
Annuleer
Beste antwoord
if not record.partner_id.parent_id:
  Warning('CONTACT IS MISSING')


Avatar
Annuleer
Beste antwoord

Hi,

Try this code and see,

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


Thanks

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
nov. 22
6471
0
jan. 21
2304
1
nov. 22
3646
3
feb. 25
1832
1
dec. 24
2020