Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
2839 Представления

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
6621
0
янв. 21
2402
1
нояб. 22
3799
3
февр. 25
2090
1
дек. 24
2164