Пример #1
0
    def test_on_print_button__clicked_with_adjusted_item(self, print_report):
        inventory = self._create_inventory()
        item = self.create_inventory_item(inventory)
        item.recorded_quantity = 10
        item.actual_quantity = 5
        dialog = InventoryDetailsDialog(self.store, inventory)

        self.assertSensitive(dialog, ['print_button'])
        items = list(dialog._get_report_items())
        self.click(dialog.print_button)
        print_report.assert_called_once_with(InventoryReport,
                                             dialog.items_list, items)
Пример #2
0
    def test_on_print_button__clicked_with_adjusted_item(self, print_report):
        inventory = self._create_inventory()
        item = self.create_inventory_item(inventory)
        item.recorded_quantity = 10
        item.actual_quantity = 5
        dialog = InventoryDetailsDialog(self.store, inventory)

        self.assertSensitive(dialog, ['print_button'])
        items = list(dialog._get_report_items())
        self.click(dialog.print_button)
        print_report.assert_called_once_with(InventoryReport,
                                             dialog.items_list, items)
Пример #3
0
    def test_inventory_report(self):
        inventory = self.create_inventory()

        item = self.create_inventory_item(inventory=inventory)
        self.assertFalse(item.is_adjusted)
        item.counted_quantity = item.recorded_quantity - 1
        item.actual_quantity = item.recorded_quantity - 1
        item.cfop_data = self.create_cfop_data()
        item.reason = u"test adjust"
        item.adjust(self.current_user, 13)

        item2 = self.create_inventory_item(inventory=inventory)
        self.assertFalse(item2.is_adjusted)
        item2.counted_quantity = item.recorded_quantity - 1
        item2.actual_quantity = item.recorded_quantity - 1
        item2.cfop_data = self.create_cfop_data()
        item2.reason = u"test adjust2"
        item2.adjust(self.current_user, 13)
        inventory.close()

        from stoqlib.gui.dialogs.inventorydetails import InventoryDetailsDialog
        dialog = InventoryDetailsDialog(self.store, model=inventory)
        items = list(
            InventoryItemsView.find_by_inventory(self.store, inventory))
        self._diff_expected(InventoryReport, 'inventory-report',
                            dialog.items_list, items)
Пример #4
0
    def test_on_items_list__double_click_without_reason(self, run_dialog):
        inventory = self._create_inventory()
        item = self.create_inventory_item(inventory)

        dialog = InventoryDetailsDialog(self.store, inventory)
        dialog.items_list.emit('double-click', item)
        self.assertEquals(run_dialog.call_count, 0)
Пример #5
0
    def test_export_spread_sheet(self, export):
        inventory = self._create_inventory()
        self.create_inventory_item(inventory)
        dialog = InventoryDetailsDialog(self.store, inventory)

        self.assertEquals(export.call_count, 0)
        self.click(dialog.export_button)
        self.assertEquals(export.call_count, 1)
Пример #6
0
    def test_on_items_list__double_click_with_reason(self, run_dialog):
        inventory = self._create_inventory()
        item = self.create_inventory_item(inventory)
        item.reason = u'Reason test'

        dialog = InventoryDetailsDialog(self.store, inventory)
        dialog.items_list.emit('double-click', item)
        run_dialog.assert_called_once_with(NoteEditor, dialog, self.store,
                                           item, 'reason', title='Reason',
                                           label_text='Adjust reason',
                                           visual_mode=True)
Пример #7
0
    def test_on_info_button__clicked_with_reason(self, run_dialog):
        inventory = self._create_inventory()
        item = self.create_inventory_item(inventory)
        item.reason = u'Reason test'
        item_view = self.store.find(InventoryItemsView, id=item.id).one()
        dialog = InventoryDetailsDialog(self.store, inventory)

        dialog.items_list.select(item_view)
        self.assertSensitive(dialog, ['info_button'])
        self.click(dialog.info_button)
        run_dialog.assert_called_once_with(NoteEditor, dialog, self.store,
                                           item_view, 'reason', title='Reason',
                                           label_text='Adjust reason',
                                           visual_mode=True)
Пример #8
0
    def test_on_info_button__clicked_without_reason(self, run_dialog):
        inventory = self._create_inventory()
        dialog = InventoryDetailsDialog(self.store, inventory)

        dialog.items_list.select(dialog.items_list[0])
        self.assertNotSensitive(dialog, ['info_button'])
Пример #9
0
 def test_show(self):
     inventory = self._create_inventory()
     dialog = InventoryDetailsDialog(self.store, inventory)
     self.check_editor(dialog, 'dialog-inventory-details')
     self.assertNotSensitive(dialog, ['info_button'])