Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
2621 Vizualizări

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

Imagine profil
Abandonează
Cel mai bun răspuns
if not record.partner_id.parent_id:
  Warning('CONTACT IS MISSING')


Imagine profil
Abandonează
Cel mai bun răspuns

Hi,

Try this code and see,

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


Thanks

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
nov. 22
6373
0
ian. 21
2283
1
nov. 22
3522
3
feb. 25
1727
1
dec. 24
1915