تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
2619 أدوات العرض

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

الصورة الرمزية
إهمال
أفضل إجابة
if not record.partner_id.parent_id:
  Warning('CONTACT IS MISSING')


الصورة الرمزية
إهمال
أفضل إجابة

Hi,

Try this code and see,

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


Thanks

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
نوفمبر 22
6366
0
يناير 21
2283
1
نوفمبر 22
3515
3
فبراير 25
1719
1
ديسمبر 24
1908