summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorAndrea Grazioso (agr-odoo) <agr@odoo.com>2019-11-07 08:37:04 +0000
committerfw-bot <otis@odoo.com>2019-11-12 08:39:05 +0000
commitf52bcddcccba619253352097ede7a889edb8e8e0 (patch)
tree54a3c59c702a7d42d894d0082ed5b7a7ddca7b71 /addons
parent70c4e5611e59e6ce6df0892cf96c77559f382bd1 (diff)
[FIX] stock_move: show source document
Install stock and sale. Create a sale with 2+ products, save and confirm. Look for the created picking. There will be no source doument, because of cb618e9a99ea3b86fdeed0295168a1e9fd7cddc3 the behavior has changed when there are multiple source document, possibly to avoid displaying the wrong source if they differ. Adding the possibility to display multiple source documents, eventually truncating the list opw-2117886 closes odoo/odoo#40098 X-original-commit: baad02d01b86a8d036524b789f046a54a878a729 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Diffstat (limited to 'addons')
-rw-r--r--addons/stock/models/stock_move.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py
index 29be782a9fb..616630deb47 100644
--- a/addons/stock/models/stock_move.py
+++ b/addons/stock/models/stock_move.py
@@ -907,8 +907,16 @@ class StockMove(models.Model):
""" return create values for new picking that will be linked with group
of moves in self.
"""
- origins = set(self.filtered(lambda m: m.origin).mapped('origin'))
- origin = len(origins) == 1 and origins.pop() or False
+ origins = self.filtered(lambda m: m.origin).mapped('origin')
+ origins = list(dict.fromkeys(origins)) # create a list of unique items
+ # Will display source document if any, when multiple different origins
+ # are found display a maximum of 5
+ if len(origins) == 0:
+ origin = False
+ else:
+ origin = ','.join(origins[:5])
+ if len(origins) > 5:
+ origin += "..."
partners = self.mapped('partner_id')
partner = len(partners) == 1 and partners.id or False
return {