Skip to Content
मेन्यू
This question has been flagged
1 Reply
4708 Views

I've tried different solutions from odoo help and stackoverflow but couldn't get any much help.

my code:


start_date = fields.Date()
end_date = fields.Date()
total_months = fields.Char(compute='_total_months')

@api.multi
def _total_months(self):
if self.start_date and self.end_date:
for rec in self:
s_date = dt.strptime(rec.start_date, '%d-%m-%Y')
e_date = dt.strptime(rec.end_date, '%d-%m-%Y')
rec.total_months = str((s_date - e_date).days)
Avatar
Discard
Related Posts Replies Views Activity
1
अप्रैल 19
5663
3
जून 25
826
2
जुल॰ 24
2444
1
जून 24
4959
1
अक्तू॰ 23
10624