Commit b13df338 authored by Cédric Krier's avatar Cédric Krier
Browse files

Do not copy number of lot with sequence

Closes #11593
parent 0ec4f9595cbc
Pipeline #60046 passed with stages
in 15 seconds
* Do not copy number of lot with sequence
Version 6.6.0 - 2022-10-31
--------------------------
* Bug fixes (see mercurial logs for details)
......
......@@ -132,6 +132,14 @@
return self.product.default_uom.digits
@classmethod
def copy(cls, lots, default=None):
default = default.copy() if default else {}
has_sequence = {l.id: l.has_sequence for l in lots}
default.setdefault(
'number', lambda o: None if has_sequence[o['id']] else o['number'])
return super().copy(lots, default=default)
@classmethod
def create(cls, vlist):
vlist = [v.copy() for v in vlist]
for values in vlist:
......
......@@ -51,3 +51,17 @@
>>> lot.number
'1'
Copy set a new number::
>>> lot2, = lot.duplicate()
>>> lot2.number
'2'
Copy without sequence keep same number::
>>> template.lot_sequence = None
>>> template.save()
>>> lot3, = lot.duplicate()
>>> lot3.number
'1'
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment