Browse files

[IMP] stock: schedule date should be change only when we enable 'No R…

…escheduling Propagation' in setting.

Task ID : 1913401
  • Loading branch information...
hsh-odoo committed Dec 17, 2018
1 parent de05979 commit e76f84291122da9f54fc8c41d2f0a84afa88598e
@@ -8,6 +8,9 @@ class Company(models.Model):
_inherit = ""

propagation_minimum_delta = fields.Integer('Minimum Delta for Propagation of a Date Change on moves linked together', default=1)
use_propagation_minimum_delta = fields.Boolean(
string="No Rescheduling Propagation",
help="Rescheduling applies to any chain of operations (e.g. Make To Order, Pick Pack Ship). In the case of MTO sales, a vendor delay (updated incoming date) impacts the expected delivery date to the customer. \n This option allows to not propagate the rescheduling if the change is not critical.")
internal_transit_location_id = fields.Many2one(
'stock.location', 'Internal Transit Location', on_delete="restrict",
help="Technical field used for resupply routes between warehouses that belong to this company")
@@ -28,6 +28,8 @@ class ResConfigSettings(models.TransientModel):
group_warning_stock = fields.Boolean("Warnings for Stock", implied_group='stock.group_warning_stock')
propagation_minimum_delta = fields.Integer(related='company_id.propagation_minimum_delta', string="Minimum Delta for Propagation", readonly=False)
use_propagation_minimum_delta = fields.Boolean(
string="No Rescheduling Propagation",
@@ -423,7 +423,8 @@ def write(self, vals):
current_date = move.date_expected
new_date = fields.Datetime.from_string(vals.get(propagated_date_field))
delta_days = (new_date - current_date).total_seconds() / 86400
if abs(delta_days) >= move.company_id.propagation_minimum_delta:
use_propagation_minimum_delta = move.company_id.use_propagation_minimum_delta
if use_propagation_minimum_delta and abs(delta_days) >= move.company_id.propagation_minimum_delta:
old_move_date = move.move_dest_ids[0].date_expected
new_move_date = (old_move_date + relativedelta.relativedelta(days=delta_days or 0)).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
propagated_changes_dict['date_expected'] = new_move_date

0 comments on commit e76f842

Please sign in to comment.