ValueError: Expected singleton: hr.salary.rule(2, 3)
when i do in python :
self.env.create
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
ValueError: Expected singleton: hr.salary.rule(2, 3)
when i do in python :
self.env.create
This error means that your object contains an array you should only choose one of the 2 rules either by a for loop or typing [0] or [1] to choose one of the rules here is an example:
'salary_rule_id': bonus.contract_id.ev_bonus.salary_rule_id[0].id
Happy to help :) an upvote will be awesome
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
1
thg 2 21
|
2356 | ||
|
1
thg 7 25
|
2452 | ||
|
2
thg 7 25
|
7907 | ||
|
2
thg 7 25
|
4323 | ||
|
2
thg 7 25
|
4065 |
CODE /
for bonus in self:
if len(bonus.contract_id.ev_bonus)>0:
bonus.line_ids.create({
'sequence': bonus.contract_id.ev_bonus.salary_rule_id.sequence,
'code': bonus.contract_id.ev_bonus.salary_rule_id.code,
'name': bonus.contract_id.ev_bonus.salary_rule_id.name,
'note': bonus.contract_id.ev_bonus.salary_rule_id.note,
'salary_rule_id': bonus.contract_id.ev_bonus.salary_rule_id.id,
'contract_id': bonus.contract_id,
'employee_id': bonus.employee_id,
'amount': bonus.contract_id.ev_total_bonus,
'quantity': qty,
'rate': rate,
'slip_id': bonus.id,
})