Ejemplo n.º 1
0
    def testClientSearch(self):
        self.clean_domain([Commission, SaleItem, Sale, Client])

        client = self.create_client(u'Richard Stallman')
        client.person.individual.birth_date = datetime.date(1989, 3, 4)
        client = self.create_client(u'Junio C. Hamano')
        client.person.individual.birth_date = datetime.date(1972, 10, 15)

        search = ClientSearch(self.store)

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

        search.set_searchbar_search_string(u'ham')
        search.search.refresh()
        self.check_search(search, 'client-string-filter')

        column = search.search.get_column_by_attribute('birth_date')
        search_title = column.get_search_label() + ':'

        search.search.search.add_filter_by_column(column)
        birthday_filter = search.search.search.get_search_filter_by_label(
                                                                  search_title)

        search.set_searchbar_search_string('')
        birthday_filter.select(data=DateSearchFilter.Type.USER_DAY)
        birthday_filter.start_date.update(datetime.date(1987, 3, 4))
        search.search.refresh()
        self.check_search(search, 'client-birthday-date-filter')

        birthday_filter.select(data=DateSearchFilter.Type.USER_INTERVAL)
        birthday_filter.start_date.update(datetime.date(1987, 10, 1))
        birthday_filter.end_date.update(datetime.date(1987, 10, 31))
        search.search.refresh()
        self.check_search(search, 'client-birthday-interval-filter')
Ejemplo n.º 2
0
    def test_client_as_company(self):
        self.clean_domain([Commission, SaleItem, Sale, Client])

        person = self.create_person(name=u'Agatha Christie')

        self.create_client(person=person)
        self.create_company(person=person)

        search = ClientSearch(self.store)

        search.set_searchbar_search_string(u'dum')
        search.search.refresh()
        self.check_search(search, 'client-company-string-filter')