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
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
1690
Views
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up
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,
})