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

Dear Odoo Community

I kindly need your urgent help. I currently have >150 Landed Costs in Draft Stage for which all cost lines use the Split Method "Equal". 

Can someone please advise how to write an expression in an automated/server action to update all cost lines to "By Current Cost"? That would save me a lot of time otherwise I would have to go in one by one and change it. 


Many thanks!


Manuel

アバター
破棄
最善の回答

Hello Manuel,

I have written a scheduled action which should achieve what you are after.

# get all in draft stage and have the split_method equal
all_items = env["stock.landed.cost.lines"].search(["&", ("cost_id.state", "=", "draft"), ("split_method", "=", "equal")])

for item in all_items:
    item["split_method"] = "by_current_cost_price"

I would suggest trying this on some test data first, as I have only tested this briefly. 

Thanks, 

アバター
破棄
著作者 最善の回答

@Jack Dane


Perfect! Works like a charm! Thanks so much for your super fast and spot on help.

アバター
破棄
関連投稿 返信 ビュー 活動
1
10月 24
1641
0
3月 15
3755
1
3月 25
1585
0
6月 24
1302
1
6月 24
2230