Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
2664 Visualizzazioni

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
Abbandona
Risposta migliore
if not record.partner_id.parent_id:
  Warning('CONTACT IS MISSING')


Avatar
Abbandona
Risposta migliore

Hi,

Try this code and see,

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


Thanks

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
nov 22
6423
0
gen 21
2297
1
nov 22
3581
3
feb 25
1783
1
dic 24
1987