コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
1233 ビュー

Hello Odoo Community:

   I'd like to create an automated action in model sale.order.inherited, in which every time (on creation and update) the field "name" has a keyword "sample", the invoice.status will change to "no" (nothing to invoice); before update, "name" is not set; after update, "name" (order.reference) contains "sample"; I have tried update the record -->invoice.status--> value --> no, but it doesn't work; I'd like to try execute the python code, would you please help me write the code

["invoice_status","=","no"]

Thanks a lot

アバター
破棄
最善の回答

Hi, 

Try this code:

# Assuming 'sample' is case-sensitive in the order reference
if record.name and 'sample' in record.name:
    record.invoice_status = 'no'


Hope it helps

アバター
破棄
著作者

Thank you for your reply, but it shows "forbidden opcode(s) in "if record.name and 'sample' in record.name:\n record.invoice_status = 'no'": STORE_ATTR"

著作者

Also, how to I write the code if it is the name field contains the keyword "sample"; name, ilike, sample?

関連投稿 返信 ビュー 活動
1
1月 24
1126
1
12月 23
1505
1
2月 19
21913
3
7月 18
4599
2
4月 16
8284