[16.0][IMP] stock_release_channel_partner_by_date: do not archive future partner dates on action_sleep#1190
Conversation
…rtner dates on action_sleep When putting a release channel to sleep, restrict the deactivation of channel partner dates to only those in the past or present (<= today), leaving future configurations active. - Update action_sleep() in the release channel model to construct an AND domain filtering by date. - Add test_release_channel_sleep_archive_specific_date_future to ensure future dates are untouched.
| domain = expression.AND( | ||
| [ | ||
| self._get_release_channel_partner_date_domain(), | ||
| [("date", "<=", fields.Date.today())], |
There was a problem hiding this comment.
Couldn't this be moved into _get_release_channel_partner_date_domain?
I'm not sure to what extent this should be configurable at the stock.release.channel level in order to avoid breaking the module's behavior.
There was a problem hiding this comment.
I considered that, but _get_release_channel_partner_date_domain() is a generic selector for partner-date records related to the channel.
Adding ("date", "<=", today) there would make the date cutoff part of the base domain everywhere , which would change module behavior outside action_sleep().
In this PR I only want to limit the archival behavior during action_sleep(), so I kept the extra condition local to that method.
| domain = expression.AND( | ||
| [ | ||
| self._get_release_channel_partner_date_domain(), | ||
| [("date", "<=", fields.Date.today())], |
There was a problem hiding this comment.
The date is the delivery date. So you should add this only if there is a shipment_date and use that date instead of today. You can add a dependency on stock_release_channel_shipment_lead_time for that as there is no base delivery date concept on the stock release channel base module.
When putting a release channel to sleep, restrict the deactivation of channel partner dates to only those in the past or present (<= today), leaving future configurations active.