[FIX] sale_stock: change shipping address

- Create a SO for a stockable product
- Validate the SO
- Change the 'Delivery Address'

Nothing warns the user that the address was not changed on the
corresponding pickings.

opw-2002084

closes odoo/odoo#33636

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2019-05-24 08:06:40 +00:00
parent b0ea06ab91
commit bfe76859e8
2 changed files with 27 additions and 0 deletions
+12
View File
@@ -166,6 +166,12 @@ msgstr ""
msgid "Display incoterms on orders &amp; invoices"
msgstr ""
#. module: sale_stock
#: code:addons/sale_stock/models/sale_order.py:101
#, python-format
msgid "Do not forget to change the partner on the following delivery orders: %s"
msgstr ""
#. module: sale_stock
#: model:ir.model.fields,field_description:sale_stock.field_sale_order__effective_date
msgid "Effective Date"
@@ -491,6 +497,12 @@ msgstr ""
msgid "Warning"
msgstr ""
#. module: sale_stock
#: code:addons/sale_stock/models/sale_order.py:100
#, python-format
msgid "Warning!"
msgstr ""
#. module: sale_stock
#: model_terms:ir.ui.view,arch_db:sale_stock.res_config_settings_view_form_stock
msgid "When to reserve sold products"
+15
View File
@@ -89,6 +89,21 @@ class SaleOrder(models.Model):
if self.warehouse_id.company_id:
self.company_id = self.warehouse_id.company_id.id
@api.onchange('partner_shipping_id')
def _onchange_partner_shipping_id(self):
res = {}
pickings = self.picking_ids.filtered(
lambda p: p.state not in ['done', 'cancel'] and p.partner_id != self.partner_shipping_id
)
if pickings:
res['warning'] = {
'title': _('Warning!'),
'message': _(
'Do not forget to change the partner on the following delivery orders: %s'
) % (','.join(pickings.mapped('name')))
}
return res
@api.multi
def action_view_delivery(self):
'''