[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 <backspac@users.noreply.github.com>
This commit is contained in:
nie
2020-10-06 08:39:56 +00:00
parent 7b82e5f89d
commit 3765415e6a
+7 -1
View File
@@ -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