Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
2568 Tampilan

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
Buang
Jawaban Terbai
if not record.partner_id.parent_id:
  Warning('CONTACT IS MISSING')


Avatar
Buang
Jawaban Terbai

Hi,

Try this code and see,

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


Thanks

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
1
Nov 22
6280
0
Jan 21
2240
1
Nov 22
3404
3
Feb 25
1597
1
Des 24
1806