summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorWilliam Henrotin <whe@odoo.com>2019-02-06 16:04:03 +0000
committerWilliam Henrotin <whe@odoo.com>2019-02-07 09:57:08 +0000
commit8cc62b1a6def6f74dd0e3ccdc9831b98f6078230 (patch)
tree969f53c35079df62cb4c98eae4a0e15e8b5a4e13 /addons
parenta46138cb019a3617704afb018132396ac2339823 (diff)
[FIX] stock: warning in case of duplicate serial numbers
The onchange on serial number aims to track any duplicates. The issue comes from the fact that `.mapped()` removes the duplicates when it returns a recordset. We use a list comprehension instead. Opw : 1910963 closes odoo/odoo#30913
Diffstat (limited to 'addons')
-rw-r--r--addons/stock/models/stock_move_line.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/stock/models/stock_move_line.py b/addons/stock/models/stock_move_line.py
index 45b00100dd6..3aefd3c837d 100644
--- a/addons/stock/models/stock_move_line.py
+++ b/addons/stock/models/stock_move_line.py
@@ -117,11 +117,11 @@ class StockMoveLine(models.Model):
if self.lot_name or self.lot_id:
move_lines_to_check = self._get_similar_move_lines() - self
if self.lot_name:
- counter = Counter(move_lines_to_check.mapped('lot_name'))
+ counter = Counter([line.lot_name for line in move_lines_to_check])
if counter.get(self.lot_name) and counter[self.lot_name] > 1:
message = _('You cannot use the same serial number twice. Please correct the serial numbers encoded.')
elif self.lot_id:
- counter = Counter(move_lines_to_check.mapped('lot_id.id'))
+ counter = Counter([line.lot_id.id for line in move_lines_to_check])
if counter.get(self.lot_id.id) and counter[self.lot_id.id] > 1:
message = _('You cannot use the same serial number twice. Please correct the serial numbers encoded.')