From 3929e419ffdbf49ed9b0c1370a2538e86e2aac34 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 4 Jan 2019 13:41:17 +0000 Subject: [PATCH] [FIX] stock: assign partner - Create a SO with a stockable product, validate - On the corresponding picking, change the partner - Print the 'Picking Operations' or 'Delivery Slip' The partner printed is the partner of the SO, not of the picking. This was reported many times in the past, and is quite confusing. It happens because the partner on the `stock.move` remains the partner set on the SO. We shouldn't change the reports, nor automatically propagate the change since it might cause issues, e.g. in case on dropshipping or manual creation of the picking. Therefore, we add an action which allows to set the partner on the stock move manually. opw-1917851 closes odoo/odoo#29939 --- addons/stock/i18n/stock.pot | 10 ++++++++++ addons/stock/models/stock_picking.py | 4 ++++ addons/stock/views/stock_picking_views.xml | 3 +++ 3 files changed, 17 insertions(+) diff --git a/addons/stock/i18n/stock.pot b/addons/stock/i18n/stock.pot index 39533e3c765..845d5707750 100644 --- a/addons/stock/i18n/stock.pot +++ b/addons/stock/i18n/stock.pot @@ -716,6 +716,16 @@ msgstr "" msgid "Assign Owner" msgstr "" +#. module: stock +#: model:ir.ui.view,arch_db:stock.view_picking_form +msgid "Assign Partner" +msgstr "" + +#. module: stock +#: model:ir.ui.view,arch_db:stock.view_picking_form +msgid "Assign the partner to the Operations. Use only if the partner is manually changed!" +msgstr "" + #. module: stock #: model:ir.ui.view,arch_db:stock.view_picking_internal_search msgid "Assigned Moves" diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index 6be5cd8b26a..47e0fcceaec 100644 --- a/addons/stock/models/stock_picking.py +++ b/addons/stock/models/stock_picking.py @@ -547,6 +547,10 @@ class Picking(models.Model): def action_assign_owner(self): self.move_line_ids.write({'owner_id': self.owner_id.id}) + def action_assign_partner(self): + for picking in self: + picking.move_lines.write({'partner_id': picking.partner_id.id}) + @api.multi def do_print_picking(self): self.write({'printed': True}) diff --git a/addons/stock/views/stock_picking_views.xml b/addons/stock/views/stock_picking_views.xml index 4c459ad2d9c..a39c5794652 100644 --- a/addons/stock/views/stock_picking_views.xml +++ b/addons/stock/views/stock_picking_views.xml @@ -242,6 +242,9 @@ +