diff options
| author | Arnold Moyaux <arm@odoo.com> | 2019-07-31 12:35:26 +0000 |
|---|---|---|
| committer | Arnold Moyaux <arm@odoo.com> | 2019-08-19 15:03:59 +0000 |
| commit | 319ae318601dcfb59bf02b2bd8d29f78f0ff46ba (patch) | |
| tree | 8f097548c9272f34dc02a66f0d07506fabbb85cf | |
| parent | 37200abfc5684935f932bf42923add145f5dfd1e (diff) | |
[FIX] stock: same origin documents
Create two moves with a product MTO and the same SO.
Confirm them. It will generate a new picking without origin.
However the purpose of removing origin on picking is to avoid
an endless enumaration of all documents but if they only have
one origin it should be display.
In this case, the origin was ignored because moves.mapped('origins')
result in a list of ['doc_origin','doc_origin'] and have a length
of 2 because .mapped do not return a distinct set on fields different
than Many2one, one2Many and M2M.
| -rw-r--r-- | addons/stock/models/stock_move.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py index 35a4d97c8a8..f3a9752446f 100644 --- a/addons/stock/models/stock_move.py +++ b/addons/stock/models/stock_move.py @@ -872,8 +872,8 @@ class StockMove(models.Model): """ return create values for new picking that will be linked with group of moves in self. """ - origins = self.filtered(lambda m: m.origin).mapped('origin') - origin = len(origins) == 1 and origins[0] or False + origins = set(self.filtered(lambda m: m.origin).mapped('origin')) + origin = len(origins) == 1 and origins.pop() or False partners = self.mapped('partner_id') partner = len(partners) == 1 and partners.id or False return { |
