Skip to content

Commit

Permalink
Merge PR #36 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by andhit-r
  • Loading branch information
ssi-bot committed Nov 3, 2023
2 parents 58154ae + 74dc5a3 commit 1c382f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ssi_account_move_line_day_overdue/data/ir_cron_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<field name="numbercall">-1</field>
<field eval="False" name="doall" />
<field name="model_id" ref="account.model_account_move_line" />
<field eval="'compute_days_overdue'" name="code" />
<field eval="'model.compute_days_overdue()'" name="code" />
<field name="state">code</field>
</record>

Expand Down
9 changes: 4 additions & 5 deletions ssi_account_move_line_day_overdue/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

_logger = logging.getLogger(__name__)
try:
import numpy as np
import pandas as pd
pass
except (ImportError, IOError) as err:
_logger.debug(err)

Expand Down Expand Up @@ -37,10 +36,10 @@ def compute_days_overdue(self):
def _compute_days_overdue(self):
self.ensure_one()
if self.date_maturity:
dt_date_due = pd.to_datetime(self.date_maturity)
dt_date_today = pd.datetime.now()
dt_date_due = fields.Datetime.to_datetime(self.date_maturity)
dt_date_today = fields.Datetime.now()
if dt_date_today <= dt_date_due:
day_diff = 0
else:
day_diff = int((dt_date_today - dt_date_due) / np.timedelta64(1, "D"))
day_diff = (dt_date_today - dt_date_due).days
self.write({"days_overdue": day_diff})

0 comments on commit 1c382f4

Please sign in to comment.