콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

I'm trying to set a salary rule in my "Salesman" salary structure that computes a bonus based on the sales amount that the salesman made during the last month.


I found a similar question (https://www.odoo.com/forum/help-1/question/is-there-anything-like-salesman-sales-amount-function-9566), but unfortunately the code doesn't work. I'll copy it here:

total_sale_amount = 0.0
sale_order_ids = sale_order_obj.search(cr, uid, [('user_id', '=', employee.id)], context=context)
for sale_order in sale_order_obj.browse(cr, uid, sale_order_ids, context=context):
    total_sale_amount += sale_order.amount_total
result = total_sale_amount * 0.10

Can you help me?

아바타
취소

I don't think you can use ORM methods inside salary rule. May be you can use this code to write to a field in payroll form and access that field from salary rule.

작성자

Thanks for the comment. Could you explain how should I do it? I'm quite new to Odoo and Python.

관련 게시물 답글 화면 활동
2
12월 24
12207
3
9월 19
7002
1
9월 17
6263
0
3월 25
1841
4
4월 24
174886