Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
2673 Zobrazení

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
Zrušit
Nejlepší odpověď
if not record.partner_id.parent_id:
  Warning('CONTACT IS MISSING')


Avatar
Zrušit
Nejlepší odpověď

Hi,

Try this code and see,

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


Thanks

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
lis 22
6443
0
led 21
2297
1
lis 22
3591
3
úno 25
1794
1
pro 24
1994