Esempio n. 1
0
    def test_get_active(self):
        cost_center = self.create_cost_center()
        self.create_cost_center(is_active=False)

        cost_centers = CostCenter.get_active(self.store)

        self.assertEquals([cost_center], list(cost_centers))
Esempio n. 2
0
    def test_get_active(self):
        cost_center = self.create_cost_center()
        self.create_cost_center(is_active=False)

        cost_centers = CostCenter.get_active(self.store)

        self.assertEquals([cost_center], list(cost_centers))
Esempio n. 3
0
    def _fill_cost_center_combo(self):
        cost_centers = CostCenter.get_active(self.store)

        # we keep this value because each call to is_empty() is a new sql query
        # to the database
        cost_centers_exists = not cost_centers.is_empty()

        if cost_centers_exists:
            self.cost_center.prefill(api.for_combo(cost_centers, attr="name", empty=_("No cost center.")))
        self.cost_center.set_visible(cost_centers_exists)
        self.cost_center_lbl.set_visible(cost_centers_exists)
Esempio n. 4
0
    def _fill_cost_center_combo(self):
        cost_centers = CostCenter.get_active(self.store)

        # we keep this value because each call to is_empty() is a new sql query
        # to the database
        cost_centers_exists = not cost_centers.is_empty()

        if (cost_centers_exists and
            isinstance(self.model, _LonelyConfirmationModel)):
            self.cost_center.prefill(api.for_combo(cost_centers, attr='name',
                                                   empty=_('No cost center.')))
            self.cost_center.set_visible(cost_centers_exists)
            self.cost_center_lbl.set_visible(cost_centers_exists)
Esempio n. 5
0
    def _fill_cost_center_combo(self):
        cost_centers = CostCenter.get_active(self.store)

        # we keep this value because each call to is_empty() is a new sql query
        # to the database
        cost_centers_exists = not cost_centers.is_empty()

        if (cost_centers_exists and isinstance(self.model,
                                               _LonelyConfirmationModel)):
            self.cost_center.prefill(api.for_combo(cost_centers, attr='name',
                                                   empty=_('No cost center.')))
            self.cost_center.set_visible(cost_centers_exists)
            self.cost_center_lbl.set_visible(cost_centers_exists)
Esempio n. 6
0
    def _fill_cost_center_combo(self):
        marker('Filling cost centers')
        cost_centers = CostCenter.get_active(self.store)

        # we keep this value because each call to is_empty() is a new sql query
        # to the database
        cost_centers_exists = not cost_centers.is_empty()

        if cost_centers_exists:
            self.cost_center.prefill(api.for_combo(cost_centers, attr='name',
                                                   empty=_('No cost center.')))
        self.cost_center.set_visible(cost_centers_exists)
        self.cost_center_lbl.set_visible(cost_centers_exists)
        marker('Filled cost centers')