def test_search(self):
        self.clean_domain([
            StockTransactionHistory, ProductSupplierInfo, ProductStockItem,
            Storable, Product
        ])

        branches = self.store.find(Branch)

        product = self.create_product()
        storable = self.create_storable(product=product)
        ProductStockItem(quantity=1,
                         branch=branches[0],
                         storable=storable,
                         store=self.store)
        ProductStockItem(quantity=2,
                         branch=branches[1],
                         storable=storable,
                         store=self.store)
        product.sellable.code = u'1'
        product.sellable.description = u'Luvas'

        product = self.create_product()
        storable = self.create_storable(product=product)
        ProductStockItem(quantity=3,
                         branch=branches[0],
                         storable=storable,
                         store=self.store)
        ProductStockItem(quantity=4,
                         branch=branches[1],
                         storable=storable,
                         store=self.store)
        product.sellable.code = u'2'
        product.sellable.description = u'Botas'
        product.sellable.status = Sellable.STATUS_CLOSED

        search = ProductSearch(self.store)

        search.search.refresh()
        self.check_search(search, 'product-no-filter')

        search.set_searchbar_search_string('bot')
        search.search.refresh()
        self.check_search(search, 'product-string-filter')

        search.set_searchbar_search_string('')
        search.status_filter.set_state(Sellable.STATUS_AVAILABLE)
        search.search.refresh()
        self.check_search(search, 'product-status-filter')

        search.status_filter.set_state(None)
        search.branch_filter.set_state(branches[0].id)
        search.search.refresh()
        self.check_search(search, 'product-branch-filter')
Exemple #2
0
    def test_search(self):
        self.clean_domain([
            StockTransactionHistory, ProductSupplierInfo, ProductStockItem,
            Storable, Product
        ])

        branches = list(self.store.find(Branch))

        product = self.create_product()
        storable = self.create_storable(product=product)
        self.create_product_stock_item(storable=storable,
                                       branch=branches[0],
                                       quantity=1)
        self.create_product_stock_item(storable=storable,
                                       branch=branches[1],
                                       quantity=2)
        product.sellable.code = u'1'
        product.sellable.description = u'Luvas'
        product.brand = u'Rawlings'
        product.internal_use = True

        product = self.create_product()
        storable = self.create_storable(product=product)
        self.create_product_stock_item(storable=storable,
                                       branch=branches[0],
                                       quantity=3)
        self.create_product_stock_item(storable=storable,
                                       branch=branches[1],
                                       quantity=4)
        product.sellable.code = u'2'
        product.sellable.description = u'Botas'
        product.sellable.status = Sellable.STATUS_CLOSED
        product.brand = u'Timberland'

        search = ProductSearch(self.store)

        search.search.refresh()
        self.check_search(search, 'product-no-filter')

        search.set_searchbar_search_string('bot')
        search.search.refresh()
        self.check_search(search, 'product-string-filter')

        search.set_searchbar_search_string('')
        search.status_filter.set_state(Sellable.STATUS_AVAILABLE)
        search.search.refresh()
        self.check_search(search, 'product-status-filter')

        search.status_filter.set_state(None)
        search.branch_filter.set_state(branches[0].id)
        search.search.refresh()
        self.check_search(search, 'product-branch-filter')
    def test_search(self):
        self.clean_domain([StockTransactionHistory, ProductSupplierInfo,
                           ProductStockItem, Storable, Product])

        branches = list(self.store.find(Branch))

        product = self.create_product()
        storable = self.create_storable(product=product)
        self.create_product_stock_item(
            storable=storable, branch=branches[0], quantity=1)
        self.create_product_stock_item(
            storable=storable, branch=branches[1], quantity=2)
        product.sellable.code = u'1'
        product.sellable.description = u'Luvas'
        product.brand = u'Rawlings'
        product.internal_use = True

        product = self.create_product()
        storable = self.create_storable(product=product)
        self.create_product_stock_item(
            storable=storable, branch=branches[0], quantity=3)
        self.create_product_stock_item(
            storable=storable, branch=branches[1], quantity=4)
        product.sellable.code = u'2'
        product.sellable.description = u'Botas'
        product.sellable.status = Sellable.STATUS_CLOSED
        product.brand = u'Timberland'

        search = ProductSearch(self.store)

        search.search.refresh()
        self.check_search(search, 'product-no-filter')

        search.set_searchbar_search_string('bot')
        search.search.refresh()
        self.check_search(search, 'product-string-filter')

        search.set_searchbar_search_string('')
        search.status_filter.set_state(Sellable.STATUS_AVAILABLE)
        search.search.refresh()
        self.check_search(search, 'product-status-filter')

        search.status_filter.set_state(None)
        search.branch_filter.set_state(branches[0].id)
        search.search.refresh()
        self.check_search(search, 'product-branch-filter')
Exemple #4
0
    def testSearch(self):
        self.clean_domain([ProductSupplierInfo, ProductStockItem, Storable,
                           Product])

        branches = self.store.find(Branch)

        product = self.create_product()
        storable = self.create_storable(product=product)
        ProductStockItem(quantity=1, branch=branches[0], storable=storable,
                         store=self.store)
        ProductStockItem(quantity=2, branch=branches[1], storable=storable,
                         store=self.store)
        product.sellable.code = u'1'
        product.sellable.description = u'Luvas'
        product.sellable.status = Sellable.STATUS_AVAILABLE

        product = self.create_product()
        storable = self.create_storable(product=product)
        ProductStockItem(quantity=3, branch=branches[0], storable=storable,
                         store=self.store)
        ProductStockItem(quantity=4, branch=branches[1], storable=storable,
                         store=self.store)
        product.sellable.code = u'2'
        product.sellable.description = u'Botas'
        product.sellable.status = Sellable.STATUS_UNAVAILABLE

        search = ProductSearch(self.store)

        search.search.refresh()
        self.check_search(search, 'product-no-filter')

        search.set_searchbar_search_string('bot')
        search.search.refresh()
        self.check_search(search, 'product-string-filter')

        search.set_searchbar_search_string('')
        search.status_filter.set_state(Sellable.STATUS_AVAILABLE)
        search.search.refresh()
        self.check_search(search, 'product-status-filter')

        search.status_filter.set_state(None)
        search.branch_filter.set_state(branches[0].id)
        search.search.refresh()
        self.check_search(search, 'product-branch-filter')