From 3765415e6ae00ca69d7411f8ef0bd8356e62915f Mon Sep 17 00:00:00 2001 From: nie Date: Tue, 29 Sep 2020 09:28:21 +0000 Subject: [PATCH] [FIX] sale: calendar view overrides stock picking name Steps to reproduce the bug: - Open the calendar view of the quotations in Sales - Select a time slot and enter a summary (A) - Click "Create", fill in the required values and add an order line - Save and Confirm - Click the "Delivery" smart button Bug: The delivery order has the summary (A) for name and not the computed sequence. Cause: Context key 'default_name' is added here: https://github.com/odoo/odoo/blob/0db882ce3eddc88adb3e5046f9b8d14685ffc8a8/addons/web/static/src/js/views/calendar/calendar_controller.js#L231 And it's propagated up to here: https://github.com/odoo/odoo/blob/0db882ce3eddc88adb3e5046f9b8d14685ffc8a8/addons/stock/models/stock_picking.py#L483 opw:2335541 closes odoo/odoo#59210 X-original-commit: df580bdc8fdaa33685862f2210881f19017f1daf Signed-off-by: backspac --- addons/sale/models/sale.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index df14f2a3f3f..3a185418000 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -844,7 +844,13 @@ Reason(s) of this behavior could be: for order in self.filtered(lambda order: order.partner_id not in order.message_partner_ids): order.message_subscribe([order.partner_id.id]) self.write(self._prepare_confirmation_values()) - self._action_confirm() + + # Context key 'default_name' is sometimes propagated up to here. + # We don't need it and it creates issues in the creation of linked records. + context = self._context.copy() + context.pop('default_name', None) + + self.with_context(context)._action_confirm() if self.env.user.has_group('sale.group_auto_done_setting'): self.action_done() return True