Do not copy the template code
When the variant has no code, the template code is the only part of the unique constraint. In such case copying the template fails because the new variant will have the same code. issue9462 review306081002
This commit is contained in:
@@ -217,6 +217,15 @@ class Template(
|
||||
products = sum((t.products for t in templates), ())
|
||||
Product.sync_code(products)
|
||||
|
||||
@classmethod
|
||||
def copy(cls, templates, default=None):
|
||||
if default is None:
|
||||
default = {}
|
||||
else:
|
||||
default = default.copy()
|
||||
default.setdefault('code', None)
|
||||
return super().copy(templates, default=default)
|
||||
|
||||
@classmethod
|
||||
def search_global(cls, text):
|
||||
for record, rec_name, icon in super(Template, cls).search_global(text):
|
||||
|
||||
Reference in New Issue
Block a user