Hi Guys I Need To Change Value Of Field According To Selection Field Changed So What The Best Way To Do It
Like (When I Chose The Employee Automatically Get His Wage in Another Field )
Thanks A lot
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi Guys I Need To Change Value Of Field According To Selection Field Changed So What The Best Way To Do It
Like (When I Chose The Employee Automatically Get His Wage in Another Field )
Thanks A lot
In python file:
_columns = {
'name': fields.many2one('hr.employee', "Employee", required=True),
'wage_amt': fields.float('Wage', digits=(16,2), required=True, help="Basic Salary of the employee"),
}
def onchange_employee_id(self, cr, uid, ids, employee_id, context=None):
v = {}
if employee_id:
contract_sr = self.pool.get('hr.contract').search(cr, uid, [('employee_id','=',employee_id)], context=context)
if contract_sr:
contract_br = self.pool.get('hr.contract').browse(cr, uid, contract_sr, context=context)[0]
v['wage_amt'] = contract_br.wage
return {'value': v}
In XML file:
<field name="name" on_change="onchange_employee_id(name)"/>
<field name="wage_amt"/>
Thanks Ayyappan For Answer But Please If You Have Example I W'll Can Understand It
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 | |
---|---|---|---|---|
|
2
thg 12 17
|
16860 | ||
|
0
thg 4 15
|
3891 | ||
|
1
thg 12 24
|
1530 | ||
|
0
thg 6 19
|
3775 | ||
|
1
thg 8 18
|
8018 |