Skip to content

Commit

Permalink
[14.0][FIX] added case when resupply from another warehouse
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisOForgeFlow committed Jun 30, 2022
1 parent 5766b73 commit 872ba50
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from odoo import SUPERUSER_ID, api


def migrate(cr, version):
env = api.Environment(cr, SUPERUSER_ID, {})
buffers = env["stock.buffer"].search(
[("buffer_profile_id.item_type", "=", "distributed")]
)
if buffers:
buffers._calc_distributed_source_location()
13 changes: 13 additions & 0 deletions ddmrp/models/stock_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1730,6 +1730,19 @@ def _source_location_from_route(self, route=None):
)
if rule.procure_method == "make_to_stock":
return rule.location_src_id
elif rule.procure_method == "make_to_order":
# If resupply from another warehouse, this rule can't be retrieved by
# method _get_rule, because that we try to get this rule bases on previous rule
pull_rule = self.env["stock.rule"].search(
[
("action", "in", ("pull", "pull_push")),
("procure_method", "=", "make_to_stock"),
("route_id", "=", rule.route_id.id),
("location_id", "=", rule.location_src_id.id),
]
)
if pull_rule:
return pull_rule.location_src_id
current_location = rule.location_src_id

def action_dummy(self):
Expand Down

0 comments on commit 872ba50

Please sign in to comment.