[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.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user