[FIX] sale: remove dumb onchange logic
Do not update the commitment_date everytime the expected date is modified, otherwise there is no meaning to have two fields... Furthermore, it seems that this onchange causes a performance loss on SO/SOL updates, forcing the whole SOL data to be returned along the SO data during the SO onchange. Therefore removing this onchange improves the performance of SOL updates and consequently the final save of the record by reducing the data wrongly considered modified and given to the create/write call. X-original-commit: 116ca30b2f5f27f8959961c786b88fdcec36338a Part-of: odoo/odoo#84105
This commit is contained in:
@@ -396,13 +396,6 @@ class SaleOrder(models.Model):
|
||||
tax_totals = account_move._get_tax_totals(order.partner_id, tax_lines_data, order.amount_total, order.amount_untaxed, order.currency_id)
|
||||
order.tax_totals_json = json.dumps(tax_totals)
|
||||
|
||||
# YTI TODO: Convert into compute method, however this introduces
|
||||
# a behavior change that breaks the test test_reservation_method_w_sale
|
||||
# Note: This should be the case
|
||||
@api.onchange('expected_date')
|
||||
def _onchange_expected_date(self):
|
||||
self.commitment_date = self.expected_date
|
||||
|
||||
@api.depends('transaction_ids')
|
||||
def _compute_authorized_transaction_ids(self):
|
||||
for trans in self:
|
||||
@@ -544,7 +537,7 @@ class SaleOrder(models.Model):
|
||||
}
|
||||
}
|
||||
|
||||
@api.onchange('commitment_date')
|
||||
@api.onchange('commitment_date', 'expected_date')
|
||||
def _onchange_commitment_date(self):
|
||||
""" Warn if the commitment dates is sooner than the expected date """
|
||||
if (self.commitment_date and self.expected_date and self.commitment_date < self.expected_date):
|
||||
|
||||
Reference in New Issue
Block a user