예제 #1
0
def recover_deleted_product(parent_product: Product, shop: Shop,
                            deleted_product: Product, combination: Combination,
                            combination_hash: str) -> Product:
    deleted_product.name = get_variation_product_name(parent_product,
                                                      combination)
    deleted_product.tax_class = parent_product.tax_class
    deleted_product.sales_unit = parent_product.sales_unit
    deleted_product.shipping_mode = parent_product.shipping_mode
    deleted_product.type = parent_product.type
    deleted_product.manufacturer = parent_product.manufacturer
    deleted_product.height = parent_product.height
    deleted_product.depth = parent_product.depth
    deleted_product.net_weight = parent_product.net_weight
    deleted_product.gross_weight = parent_product.gross_weight
    deleted_product.deleted = False
    deleted_product.save()
    deleted_product.link_to_parent(parent_product,
                                   combination_hash=combination_hash)
    return deleted_product