Skip to content

Commit

Permalink
[FIX] ddmrp_*: Adapt call to current thread
Browse files Browse the repository at this point in the history
  • Loading branch information
BernatPForgeFlow authored and sebalix committed Jul 5, 2023
1 parent a39c8a4 commit 0c9faae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ddmrp/models/stock_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1917,7 +1917,7 @@ def action_view_future_adu(self):
@api.model
def cron_ddmrp_adu(self, automatic=False):
"""calculate ADU for each DDMRP buffer. Called by cronjob."""
auto_commit = not getattr(threading.currentThread(), "testing", False)
auto_commit = not getattr(threading.current_thread(), "testing", False)
_logger.info("Start cron_ddmrp_adu.")
buffer_ids = self.search([]).ids
i = 0
Expand Down Expand Up @@ -1982,7 +1982,7 @@ def cron_actions(self, only_nfp=False):
def cron_ddmrp(self, automatic=False):
"""Calculate key DDMRP parameters for each buffer.
Called by cronjob."""
auto_commit = not getattr(threading.currentThread(), "testing", False)
auto_commit = not getattr(threading.current_thread(), "testing", False)
_logger.info("Start cron_ddmrp.")
buffer_ids = self.search([]).ids
i = 0
Expand Down
2 changes: 1 addition & 1 deletion ddmrp_warning/models/stock_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def action_generate_warnings(self):

@api.model
def cron_generate_ddmrp_warnings(self, automatic=False):
auto_commit = not getattr(threading.currentThread(), "testing", False)
auto_commit = not getattr(threading.current_thread(), "testing", False)

Check warning on line 48 in ddmrp_warning/models/stock_buffer.py

View check run for this annotation

Codecov / codecov/patch

ddmrp_warning/models/stock_buffer.py#L48

Added line #L48 was not covered by tests
buffer_ids = self.search([]).ids
i = 0
j = len(buffer_ids)
Expand Down

0 comments on commit 0c9faae

Please sign in to comment.