Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
2730 Переглядів

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

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
лист. 22
6472
0
січ. 21
2307
1
лист. 22
3648
3
лют. 25
1834
1
груд. 24
2027