Clear purchase lines when copying works

issue11546
review421291003
(grafted from 555fdc46e8d1485a4da1b1cd970746f2bfd28fbe)

--HG--
branch : 6.0
This commit is contained in:
Sergi Almacellas Abellana committed 2022-06-16 14:31:01 +02:00
1 parent e6c3438cab
commit dda7dfc3c7
1 file changed
+11
+11
View File
@@ -226,3 +226,14 @@ class Work(metaclass=PoolMeta):
return
time = Category(ModelData.get_id('product', 'uom_cat_time'))
return self.product.default_uom_category == time
@classmethod
def copy(cls, records, default=None):
if default is None:
default = {}
else:
default = default.copy()
if hasattr(cls, 'purchase_lines'):
# Do not copy purchase lines if purchase is activated
default.setdefault('purchase_lines', None)
return super().copy(records, default=default)