Skip to Content
Menu
This question has been flagged
2 Replies
3373 Views
i want to create field where countinues count

i have field

odometer_pasang = fields.Integer(string='Odometer Pemasangan Sebelumnya')
odometer_tire = fields.Integer(string='Odometer Tire', compute='_compute_odometer_tire')
odometer_pengecekan = fields.Integer(string='Odometer Pengecekan')
odometer_cek = fields.Integer(string='KM Pemasangan - KM Pengecekan', compute='_compute_odometer_cek')

@api.depends('odometer_pengecekan','odometer_pasang')
def _compute_odometer_cek(self):
for r in self:
if r.odometer_pengecekan and r.odometer_pasang:
r.odometer_cek = r.odometer_pengecekan - r.odometer_pasang

@api.depends('odometer_pengecekan','odometer_pasang')
def _compute_odometer_tire(self):
for r in self:
tampung = r.odometer_pengecekan - r.odometer_pasang
r.odometer_tire += tampung


i want to make field odometer_tire always count from odometer_cek but for now odometer_tire not counting sum
Avatar
Discard
Best Answer

you need to add onchange method to achieve your goal...

Avatar
Discard
Best Answer

Why ignore the onchange method?

Avatar
Discard
Related Posts Replies Views Activity
2
Dec 23
686
3
Feb 21
16406
1
Aug 18
6745
2
Aug 18
2770
0
Apr 18
2676