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

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.

Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
окт. 24
1398
0
мар. 15
3543
1
мар. 25
1310
0
июн. 24
1132
1
июн. 24
1929