Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
4715 Prikazi

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
Opusti
Related Posts Odgovori Prikazi Aktivnost
1
apr. 19
5669
3
jun. 25
830
2
jul. 24
2447
1
jun. 24
4961
1
okt. 23
10627