Skip to content

Commit

Permalink
Merge PR #300 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by LoisRForgeFlow
  • Loading branch information
OCA-git-bot committed Jul 5, 2023
2 parents 19bb0a8 + 0c9faae commit b70edac
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 28 deletions.
9 changes: 9 additions & 0 deletions .oca/oca-port/blacklist/ddmrp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"pull_requests": {
"203": "Nothing to port",
"213": "Nothing to port",
"219": "Migration PR",
"232": "Is a port of #231",
"256": "Nothing to port"
}
}
1 change: 0 additions & 1 deletion ddmrp/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from . import mrp_bom
from . import mrp_move
from . import mrp_production
from . import procurement_group
from . import product_adu_calculation_method
Expand Down
19 changes: 0 additions & 19 deletions ddmrp/models/mrp_move.py

This file was deleted.

11 changes: 4 additions & 7 deletions ddmrp/models/stock_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1335,11 +1335,6 @@ def _search_distributed_source_location_qty(self, operator, value):
)
return [("id", "in", buffers.ids)]

@api.onchange("adu_fixed", "adu_calculation_method")
def onchange_adu(self):
if self.adu_calculation_method.method == "fixed":
self._calc_adu()

def _search_open_stock_moves_domain(self):
self.ensure_one()
return [
Expand Down Expand Up @@ -1745,6 +1740,8 @@ def _calc_execution_priority(self):
@api.model_create_multi
def create(self, vals_list):
records = super().create(vals_list)
if not self.env.context.get("skip_adu_calculation", False):
records._calc_adu()
records._calc_distributed_source_location()
return records

Expand Down Expand Up @@ -1924,7 +1921,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 @@ -1989,7 +1986,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)
buffer_ids = self.search([]).ids
i = 0
j = len(buffer_ids)
Expand Down

0 comments on commit b70edac

Please sign in to comment.