Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
2575 Widoki

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

Awatar
Odrzuć
Najlepsza odpowiedź
if not record.partner_id.parent_id:
  Warning('CONTACT IS MISSING')


Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

Try this code and see,

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


Thanks

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
lis 22
6292
0
sty 21
2246
1
lis 22
3440
3
lut 25
1619
1
gru 24
1824