diff --git a/modules/web_shop/product.py b/modules/web_shop/product.py index 1c1813b5c537d864b73f083d53ded6377e8a1034_bW9kdWxlcy93ZWJfc2hvcC9wcm9kdWN0LnB5..5d367d43910755537e434b851c40496d10e7529f_bW9kdWxlcy93ZWJfc2hvcC9wcm9kdWN0LnB5 100644 --- a/modules/web_shop/product.py +++ b/modules/web_shop/product.py @@ -27,6 +27,12 @@ }, help="The list of web shops on which the product is published.") + @classmethod + def copy(cls, products, default=None): + default = default.copy() if default is not None else {} + default.setdefault('web_shops') + return super().copy(products, default=default) + class Category(metaclass=PoolMeta): __name__ = 'product.category' @@ -35,6 +41,12 @@ 'web.shop-product.category', 'category', 'shop', "Web Shops", help="The list of web shops on which the category is published.") + @classmethod + def copy(cls, categories, default=None): + default = default.copy() if default is not None else {} + default.setdefault('web_shops') + return super().copy(categories, default=default) + class Attribute(metaclass=PoolMeta): __name__ = 'product.attribute' @@ -43,8 +55,14 @@ 'web.shop-product.attribute', 'attribute', 'shop', "Web Shops", help="The list of web shops on which the attribute is published.") + @classmethod + def copy(cls, attributes, default=None): + default = default.copy() if default is not None else {} + default.setdefault('web_shops') + return super().copy(attributes, default=default) + class Image(metaclass=PoolMeta): __name__ = 'product.image' web_shop = fields.Boolean("Web Shop") @@ -46,5 +64,11 @@ class Image(metaclass=PoolMeta): __name__ = 'product.image' web_shop = fields.Boolean("Web Shop") + + @classmethod + def copy(cls, images, default=None): + default = default.copy() if default is not None else {} + default.setdefault('web_shop') + return super().copy(images, default=default) diff --git a/modules/web_shop/web.py b/modules/web_shop/web.py index 1c1813b5c537d864b73f083d53ded6377e8a1034_bW9kdWxlcy93ZWJfc2hvcC93ZWIucHk=..5d367d43910755537e434b851c40496d10e7529f_bW9kdWxlcy93ZWJfc2hvcC93ZWIucHk= 100644 --- a/modules/web_shop/web.py +++ b/modules/web_shop/web.py @@ -148,6 +148,16 @@ return shop @classmethod + def copy(cls, shops, default=None): + default = default.copy() if default is not None else {} + default.setdefault('warehouses') + default.setdefault('products') + default.setdefault('products_removed') + default.setdefault('categories') + default.setdefault('categories_removed') + return super().copy(shops, default=default) + + @classmethod def write(cls, *args): cls._name_cache.clear() super().write(*args)