Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
2757 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất
if not record.partner_id.parent_id:
  Warning('CONTACT IS MISSING')


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

Try this code and see,

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


Thanks

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 11 22
6512
0
thg 1 21
2331
1
thg 11 22
3672
3
thg 2 25
1894
1
thg 12 24
2060