DiningRoomLimit class (models.Model):
_name = 'dining.room.limit'
_order = 'sequence'
name = fields.Char (readonly = True, create = "false", store = True)
limit = fields.Float (string = 'Credit Limit', mandatory = True, digits = (64, 2))
@ api.onchange ('limit')
def _onchange_limit (self):
h = j = 0.0
to r itself:
h = r.limit
j = r.limit - h
result = self.env ['hr.employee']. search ([])
result.write ({
'limit_id': j,
})
DiningRoomIndexCord class (models.Model):
_rec_name = 'record'
_inherit = ['hr.employee']
limit_id = fieldss.Float (string = 'Credit Limit', mandatory = True, digits = (64, 2))
I am trying to perform a subtraction between the limit and the limit_id that is in the class hr.employee and this result is the one that is saved in limit_id
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
1869
Lượt xem
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
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ý
pls structure your code, and pls be specific what you want to do
I use this form to update the limit_id value that is found in hr.employee automatically but I want to make a subtraction before between the amount that is in limit_id and the amount that is in the limit class called limit and that result is the one that is place when you pass the value to travz
of this code
@api.onchange('limit')
def _onchange_limit(self):
h = j = 0.0
for r in self:
h = r.limit
j = r.limit - h
result = self.env['hr.employee'].search([])
result.write({
'limit_id': j,
})