Skip to content

Commit

Permalink
[FIX] - assign channel end date to picking after release
Browse files Browse the repository at this point in the history
  • Loading branch information
sbejaoui committed Jul 27, 2023
1 parent 8f20385 commit 310a615
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions stock_release_channel_process_end_time/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"depends": [
"partner_tz",
"stock_release_channel",
"stock_available_to_promise_release",
],
"data": [
"views/stock_release_channel.xml",
Expand Down
13 changes: 13 additions & 0 deletions stock_release_channel_process_end_time/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,16 @@ def _search_schedule_date_prior_to_channel_process_end_date(self, operator, valu
else:
operator_inselect = "not inselect" if operator == "=" else "inselect"
return [("id", operator_inselect, (query, []))]

def _after_release_set_expected_date(self):
res = super()._after_release_set_expected_date()
for rec in self:
# Check if a channel has been assigned to the picking and write
# scheduled_date if different to avoid unnecessary write
if (
rec.release_channel_id
and rec.release_channel_id.process_end_date
and rec.scheduled_date != rec.release_channel_id.process_end_date
):
rec.scheduled_date = rec.release_channel_id.process_end_date
return res
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,7 @@ def _compute_process_end_time_tz(self):
@api.model
def assign_release_channel(self, picking):
res = super().assign_release_channel(picking)
# Check if a channel has been assigned to the picking and write scheduled_date
# if different to avoid unnecessary write
if (
picking.release_channel_id
and picking.release_channel_id.process_end_date
and picking.scheduled_date != picking.release_channel_id.process_end_date
):
picking.scheduled_date = picking.release_channel_id.process_end_date
picking._after_release_set_expected_date()
return res

def _field_picking_domains(self):
Expand Down

0 comments on commit 310a615

Please sign in to comment.