Example #1
0
    def __init__(self, options, config=None):
        if not config:
            config = StoqConfig()

        self.settings = config.get_settings()
        self.link_request_done = False
        self.create_examples = False
        self.config = config
        self.enable_production = False
        self.has_installed_db = False
        self.options = options
        self.plugins = []
        self.db_is_local = False
        self.enable_online_services = True
        self.auth_type = TRUST_AUTHENTICATION

        if config.get('Database', 'enable_production') == 'True':
            self.enable_production = True

        if self.enable_production:
            first_step = PluginStep(self)
        else:
            first_step = WelcomeStep(self)
        BaseWizard.__init__(self, None, first_step, title=self.title)

        self.get_toplevel().set_deletable(False)
        self.next_button.grab_focus()
Example #2
0
    def __init__(self, store, model):
        self.temporary_items = {}
        self.imported_count = {}
        self.manual_count = True

        first_step = InventoryCountTypeStep(store, self, previous=None)
        BaseWizard.__init__(self, store, first_step, model)
Example #3
0
    def __init__(self, store, model=None):
        model = model or self._create_model(store)

        # If we receive the order right after the purchase.
        self.receiving_model = None
        first_step = StartConsignmentStep(self, store, model)
        BaseWizard.__init__(self, store, first_step, model)
Example #4
0
    def __init__(self, store, model=None, edit_mode=False):
        title = self._get_title(model)
        self.sync_mode = api.sysparam.get_bool('SYNCHRONIZED_MODE')
        self.current_branch = api.get_current_branch(store)
        if self.sync_mode and not model:
            self.temporary_identifier = PurchaseOrder.get_temporary_identifier(
                store)

        model = model or self._create_model(store)
        # Should we show all products or only the ones associated with the
        # selected supplier?
        self.all_products = False

        # If we receive the order right after the purchase.
        self.receiving_model = None
        purchase_edit = [
            PurchaseOrder.ORDER_CONFIRMED, PurchaseOrder.ORDER_PENDING
        ]

        if not model.status in purchase_edit:
            raise ValueError('Invalid order status. It should '
                             'be ORDER_PENDING or ORDER_CONFIRMED')
        first_step = StartPurchaseStep(self, store, model)
        BaseWizard.__init__(self,
                            store,
                            first_step,
                            model,
                            title=title,
                            edit_mode=edit_mode)
Example #5
0
 def __init__(self, store):
     self.model = None
     self.sync_mode = api.sysparam.get_bool('SYNCHRONIZED_MODE')
     self.current_branch = api.get_current_branch(store)
     first_step = ReceivingSelectionStep(self, store)
     BaseWizard.__init__(self, store, first_step, self.model)
     self.next_button.set_sensitive(False)
Example #6
0
    def __init__(self, store, model, subtotal, total_paid=0):
        """Creates a new SaleWizard that confirms a sale.
        To avoid excessive querying of the database we pass
        some data already queried/calculated before hand.

        :param store: a store
        :param model: a |sale|
        :param subtotal: subtotal of the sale
        :param total_paid: totaly value already paid
        """
        marker('ConfirmSaleWizard')
        self._check_payment_group(model, store)
        self._subtotal = subtotal
        self._total_paid = total_paid
        self.model = model

        # invoice_model is a Settable so avoid bug 4218, where more
        # than one checkout may try to use the same invoice number.
        self.invoice_model = Settable(invoice_number=None,
                                      original_invoice=None)
        marker('running SalesPersonStep')
        first_step = self.first_step(self, store, model, self.payment_group,
                                     self.invoice_model)
        marker('finished creating SalesPersonStep')
        BaseWizard.__init__(self, store, first_step, model)

        if not sysparam(self.store).CONFIRM_SALES_ON_TILL:
            # This was added to allow us to work even if an error
            # happened while adding a payment, where we already order
            # but cannot confirm and are thrown back to the main
            # POS interface
            if self.model.can_order():
                self.model.order()

        marker('leaving ConfirmSaleWizard.__init__')
 def __init__(self, store):
     self.model = None
     self.sync_mode = api.sysparam.get_bool('SYNCHRONIZED_MODE')
     self.current_branch = api.get_current_branch(store)
     first_step = ReceivingSelectionStep(self, store)
     BaseWizard.__init__(self, store, first_step, self.model)
     self.next_button.set_sensitive(False)
Example #8
0
    def __init__(self, store, model=None):
        model = model or self._create_model(store)

        # If we receive the order right after the purchase.
        self.receiving_model = None
        first_step = StartConsignmentStep(self, store, model)
        BaseWizard.__init__(self, store, first_step, model)
Example #9
0
    def __init__(self, store, model):
        self.temporary_items = {}
        self.imported_count = {}
        self.manual_count = True

        first_step = InventoryCountTypeStep(store, self, previous=None)
        BaseWizard.__init__(self, store, first_step, model)
Example #10
0
    def __init__(self, options, config=None):
        if not config:
            config = StoqConfig()
        self.settings = config.get_settings()

        self.enable_production = False
        self.config = config
        self.remove_demo = False
        self.has_installed_db = False
        self.options = options
        self.plugins = []
        self.db_is_local = False
        self.enable_online_services = True
        self.auth_type = TRUST_AUTHENTICATION

        if config.get('Database', 'enable_production') == 'True':
            self.remove_demo = True

        if self.remove_demo:
            first_step = PluginStep(self)
        else:
            first_step = WelcomeStep(self)
        BaseWizard.__init__(self, None, first_step, title=self.title)

        self.get_toplevel().set_deletable(False)
        self.next_button.grab_focus()
Example #11
0
    def __init__(self, store, model):
        self.temporary_items = {}
        self.imported_count = {}
        self.manual_count = True
        self.can_count_twice = api.sysparam.get_bool('ALLOW_SAME_SELLABLE_IN_A_ROW')

        first_step = InventoryCountTypeStep(store, self, previous=None)
        BaseWizard.__init__(self, store, first_step, model)
Example #12
0
    def __init__(self, store, model=None):
        title = self._get_title(model)
        model = model or self._create_model(store)
        if model.status != Loan.STATUS_OPEN:
            raise ValueError("Invalid loan status. It should " "be STATUS_OPEN")

        first_step = StartNewLoanStep(store, self, model)
        BaseWizard.__init__(self, store, first_step, model, title=title, edit_mode=False)
Example #13
0
    def __init__(self, store, receiving_order=None):
        self.receiving_order = receiving_order
        if self.receiving_order is not None:
            self.title = _('Receiving Order Return')

        model = self._create_model(store)
        first_step = StartStockDecreaseStep(store, self, model)
        BaseWizard.__init__(self, store, first_step, model)
        self.create_payments = False
Example #14
0
    def __init__(self, store, receiving_order=None):
        self.receiving_order = receiving_order
        if self.receiving_order is not None:
            self.title = _('Receiving Order Return')

        model = self._create_model(store)
        first_step = StartStockDecreaseStep(store, self, model)
        BaseWizard.__init__(self, store, first_step, model)
        self.create_payments = False
Example #15
0
    def __init__(self, store, role_editor):
        if not issubclass(role_editor, BasePersonRoleEditor):
            raise TypeError("Editor %s must be BasePersonRoleEditor " "instance" % role_editor)
        self.role_editor = role_editor

        BaseWizard.__init__(self, store, PersonRoleTypeStep(self, store), title=self.get_role_title())

        if role_editor.help_section:
            self.set_help_section(role_editor.help_section)
    def __init__(self, store, purchase):
        self.purchase = purchase
        model = self._create_model(purchase)

        if self.purchase.status != PurchaseOrder.ORDER_CONFIRMED:
            raise ValueError("Invalid order status. It should " "be ORDER_CONFIRMED")

        first_step = PurchaseFinishProductListStep(store, self, model)
        BaseWizard.__init__(self, store, first_step, model)
Example #17
0
    def __init__(self, store, purchase):
        self.purchase = purchase
        model = self._create_model(purchase)

        if self.purchase.status != PurchaseOrder.ORDER_CONFIRMED:
            raise ValueError('Invalid order status. It should '
                             'be ORDER_CONFIRMED')

        first_step = PurchaseFinishProductListStep(store, self, model)
        BaseWizard.__init__(self, store, first_step, model)
Example #18
0
    def __init__(self, store, model=None):
        title = self._get_title(model)
        model = model or self._create_model(store)
        if model.status != Loan.STATUS_OPEN:
            raise ValueError('Invalid loan status. It should '
                             'be STATUS_OPEN')

        first_step = StartNewLoanStep(store, self, model)
        BaseWizard.__init__(self, store, first_step, model, title=title,
                            edit_mode=False)
Example #19
0
 def __init__(self, store, model=None, edit_mode=False):
     title = self._get_title(model)
     model = model or self._create_model(store)
     first_step = OpenProductionOrderStep(store, self, model)
     BaseWizard.__init__(self,
                         store,
                         first_step,
                         model,
                         title=title,
                         edit_mode=edit_mode)
Example #20
0
    def __init__(self, store, model=None):
        title = self.get_title(model)
        model = model or self._create_model(store)

        if not model.can_edit():
            raise ValueError('Invalid sale status. It should '
                             'be STATUS_QUOTE or STATUS_ORDERED')

        first_step = self.get_first_step(store, model)
        BaseWizard.__init__(self, store, first_step, model, title=title,
                            edit_mode=False)
Example #21
0
    def __init__(self, store, model=None):
        title = self._get_title(model)
        model = model or self._create_model(store)

        if model.status != Sale.STATUS_QUOTE:
            raise ValueError('Invalid sale status. It should '
                             'be STATUS_QUOTE')

        first_step = StartSaleQuoteStep(store, self, model)
        BaseWizard.__init__(self, store, first_step, model, title=title,
                            edit_mode=False)
Example #22
0
    def __init__(self, store, model=None):
        title = self.get_title(model)
        model = model or self._create_model(store)

        if not model.can_edit():
            raise ValueError('Invalid sale status. It should '
                             'be STATUS_QUOTE or STATUS_ORDERED')

        first_step = self.get_first_step(store, model)
        BaseWizard.__init__(self, store, first_step, model, title=title,
                            edit_mode=False)
Example #23
0
    def __init__(self, store, model=None):
        self.unkown_sale = False
        if model:
            # Adjust items befre creating the step, so that plugins may have a
            # chance to change the value
            for item in model.returned_items:
                _adjust_returned_sale_item(item)
            first_step = SaleReturnItemsStep(self, None, store, model)
        else:
            first_step = SaleReturnSelectionStep(store, self, None)

        BaseWizard.__init__(self, store, first_step, model)
Example #24
0
    def __init__(self, store, model=None):
        self.unkown_sale = False
        if model:
            # Adjust items befre creating the step, so that plugins may have a
            # chance to change the value
            for item in model.returned_items:
                _adjust_returned_sale_item(item)
            first_step = SaleReturnItemsStep(self, None, store, model)
        else:
            first_step = SaleReturnSelectionStep(store, self, None)

        BaseWizard.__init__(self, store, first_step, model)
Example #25
0
    def __init__(self, store, model=None):
        title = self._get_title(model)
        self.edit = model is not None
        self.quote = None
        self.quote_group = self._get_or_create_quote_group(model, store)
        model = model or self._create_model(store)
        if model.status != PurchaseOrder.ORDER_QUOTING:
            raise ValueError('Invalid order status. It should '
                             'be ORDER_QUOTING')

        first_step = StartQuoteStep(self, None, store, model)
        BaseWizard.__init__(self, store, first_step, model, title=title)
Example #26
0
    def __init__(self, store, model=None):
        title = self._get_title(model)
        self.edit = model is not None
        self.quote = None
        self.quote_group = self._get_or_create_quote_group(model, store)
        model = model or self._create_model(store)
        if model.status != PurchaseOrder.ORDER_QUOTING:
            raise ValueError('Invalid order status. It should '
                             'be ORDER_QUOTING')

        first_step = StartQuoteStep(self, None, store, model)
        BaseWizard.__init__(self, store, first_step, model, title=title)
Example #27
0
    def __init__(self, store, role_editor, document=None):
        if not issubclass(role_editor, BasePersonRoleEditor):
            raise TypeError('Editor %s must be BasePersonRoleEditor '
                            'instance' % role_editor)
        self.role_editor = role_editor
        self._document = document

        BaseWizard.__init__(self, store,
                            self.get_first_step(store),
                            title=self.get_role_title())

        if role_editor.help_section:
            self.set_help_section(role_editor.help_section)
Example #28
0
    def __init__(self, store, role_editor):
        if not issubclass(role_editor, BasePersonRoleEditor):
            raise TypeError('Editor %s must be BasePersonRoleEditor '
                            'instance' % role_editor)
        self.role_editor = role_editor

        BaseWizard.__init__(self,
                            store,
                            PersonRoleTypeStep(self, store),
                            title=self.get_role_title())

        if role_editor.help_section:
            self.set_help_section(role_editor.help_section)
Example #29
0
    def __init__(self, store, role_editor, document=None, description=None):
        if not issubclass(role_editor, BasePersonRoleEditor):
            raise TypeError('Editor %s must be BasePersonRoleEditor '
                            'instance' % role_editor)
        self.role_editor = role_editor
        self._description = description
        self._document = document

        BaseWizard.__init__(self, store,
                            self.get_first_step(store),
                            title=self.get_role_title())

        if role_editor.help_section:
            self.set_help_section(role_editor.help_section)
Example #30
0
    def __init__(self, store, purchase):
        sync_mode = api.sysparam.get_bool("SYNCHRONIZED_MODE")
        # When in sync mode, only the branch owner can finish a purchase order.
        if sync_mode:
            assert purchase.branch == api.get_current_branch(store)

        self.purchase = purchase
        model = self._create_model(purchase)

        if self.purchase.status != PurchaseOrder.ORDER_CONFIRMED:
            raise ValueError("Invalid order status. It should " "be ORDER_CONFIRMED")

        first_step = PurchaseFinishProductListStep(store, self, model)
        BaseWizard.__init__(self, store, first_step, model)
Example #31
0
    def __init__(self, store, model=None, edit_mode=False):
        title = self._get_title(model)
        model = model or self._create_model(store)
        # Should we show all products or only the ones associated with the
        # selected supplier?
        self.all_products = False

        # If we receive the order right after the purchase.
        self.receiving_model = None
        if model.status != PurchaseOrder.ORDER_PENDING:
            raise ValueError('Invalid order status. It should '
                             'be ORDER_PENDING')
        first_step = StartPurchaseStep(self, store, model)
        BaseWizard.__init__(self, store, first_step, model, title=title,
                            edit_mode=edit_mode)
Example #32
0
    def __init__(self, store, model=None, edit_mode=False):
        title = self._get_title(model)
        model = model or self._create_model(store)
        # Should we show all products or only the ones associated with the
        # selected supplier?
        self.all_products = False

        # If we receive the order right after the purchase.
        self.receiving_model = None
        if model.status != PurchaseOrder.ORDER_PENDING:
            raise ValueError('Invalid order status. It should '
                             'be ORDER_PENDING')
        first_step = StartPurchaseStep(self, store, model)
        BaseWizard.__init__(self, store, first_step, model, title=title,
                            edit_mode=edit_mode)
Example #33
0
    def __init__(self, store, purchase):
        sync_mode = api.sysparam.get_bool('SYNCHRONIZED_MODE')
        # When in sync mode, only the branch owner can finish a purchase order.
        if sync_mode:
            assert purchase.branch == api.get_current_branch(store)

        self.purchase = purchase
        model = self._create_model(purchase)

        if self.purchase.status != PurchaseOrder.ORDER_CONFIRMED:
            raise ValueError('Invalid order status. It should '
                             'be ORDER_CONFIRMED')

        first_step = PurchaseFinishProductListStep(store, self, model)
        BaseWizard.__init__(self, store, first_step, model)
Example #34
0
 def __init__(self, store, create_sale=True, require_sale_items=False):
     """
     :param store: A database store
     :param create_sale: If a sale should be created for all the items that
       will be sold from this loan.
     :param require_sale_items: If there should be at least one item sold in
       the Loan. If ``False``, a loan with only returned items will be allowed
       to be confirmed. When ``True``, there should be at least one item in
       the loan that will be sold before confirming this wizard.
     """
     self._create_sale = create_sale
     self._sold_items = []
     self.original_items = {}
     self.require_sale_items = require_sale_items
     first_step = LoanSelectionStep(self, store)
     BaseWizard.__init__(self, store, first_step, model=None, title=self.title, edit_mode=False)
Example #35
0
    def test_cancel_confirmation_close(self, yesno):
        step = _FakeStep(self.store, None)
        wizard = BaseWizard(self.store, step, title="Fake")

        # need_cancel_confirmation is False, cancel should close the wizard
        with mock.patch.object(wizard, 'close') as close:
            wizard.cancel()
            self.assertEquals(yesno.call_count, 0)
            close.assert_called_once()

        wizard.need_cancel_confirmation = True

        # need_cancel_confirmation is True but there're no changes. Cancel
        # should still close the dialog
        with mock.patch.object(wizard, 'close') as close:
            wizard.cancel()
            self.assertEquals(yesno.call_count, 0)
            close.assert_called_once()

        # Just to make store.get_pending_changes return something greater
        # thant the time the wizard was created
        self.create_sellable()

        yesno.return_value = True
        # need_cancel_confirmation is True and there're changes. yesno
        # should ask if we can close the wizard or not and since we are
        # answering True, it should still close
        with mock.patch.object(wizard, 'close') as close:
            wizard.cancel()
            yesno.assert_called_once_with(
                ("If you cancel this dialog all changes will be "
                 "lost. Are you sure?"),
                gtk.RESPONSE_NO, "Cancel", "Don't cancel")
            close.assert_called_once()

        yesno.reset_mock()
        yesno.return_value = False
        # need_cancel_confirmation is True and there're changes. yesno
        # should ask if we can close the wizard or not and since we are
        # answering False, it should not close
        with mock.patch.object(wizard, 'close') as close:
            wizard.cancel()
            yesno.assert_called_once_with(
                ("If you cancel this dialog all changes will be "
                 "lost. Are you sure?"),
                gtk.RESPONSE_NO, "Cancel", "Don't cancel")
            self.assertEquals(close.call_count, 0)
Example #36
0
 def __init__(self, store, create_sale=True, require_sale_items=False):
     """
     :param store: A database store
     :param create_sale: If a sale should be created for all the items that
       will be sold from this loan.
     :param require_sale_items: If there should be at least one item sold in
       the Loan. If ``False``, a loan with only returned items will be allowed
       to be confirmed. When ``True``, there should be at least one item in
       the loan that will be sold before confirming this wizard.
     """
     self._create_sale = create_sale
     self._sold_items = []
     self.original_items = {}
     self.require_sale_items = require_sale_items
     first_step = LoanSelectionStep(self, store)
     BaseWizard.__init__(self, store, first_step, model=None,
                         title=self.title, edit_mode=False)
Example #37
0
    def __init__(self, store, model, subtotal, total_paid=0,
                 current_document=None):
        """Creates a new SaleWizard that confirms a sale.
        To avoid excessive querying of the database we pass
        some data already queried/calculated before hand.

        :param store: a store
        :param model: a |sale|
        :param subtotal: subtotal of the sale
        :param total_paid: totaly value already paid
        :param current_document: the current document of the identified client,
          if any
        """
        marker('ConfirmSaleWizard')
        self._check_payment_group(model, store)
        self._subtotal = subtotal
        self._total_paid = total_paid
        self._current_document = current_document
        self.model = model

        # invoice_model is a Settable so avoid bug 4218, where more
        # than one checkout may try to use the same invoice number.
        self.invoice_model = Settable(invoice_number=None,
                                      original_invoice=None)

        adjusted_batches = model.check_and_adjust_batches()
        if not adjusted_batches:
            first_step = ConfirmSaleBatchStep(store, self, model, None)
        else:
            marker('running SalesPersonStep')
            first_step = SalesPersonStep(self, store, model, self.payment_group,
                                         self.invoice_model)
            marker('finished creating SalesPersonStep')

        BaseWizard.__init__(self, store, first_step, model)

        if not sysparam.get_bool('CONFIRM_SALES_ON_TILL'):
            # This was added to allow us to work even if an error
            # happened while adding a payment, where we already order
            # but cannot confirm and are thrown back to the main
            # POS interface
            if self.model.can_order():
                self.model.order()

        marker('leaving ConfirmSaleWizard.__init__')
Example #38
0
    def __init__(self,
                 store,
                 model,
                 subtotal,
                 total_paid=0,
                 current_document=None):
        """Creates a new SaleWizard that confirms a sale.
        To avoid excessive querying of the database we pass
        some data already queried/calculated before hand.

        :param store: a store
        :param model: a |sale|
        :param subtotal: subtotal of the sale
        :param total_paid: totaly value already paid
        :param current_document: the current document of the identified client,
          if any
        """
        marker('ConfirmSaleWizard')
        self._check_payment_group(model, store)
        self._subtotal = subtotal
        self._total_paid = total_paid
        self._current_document = current_document
        self.model = model

        adjusted_batches = model.check_and_adjust_batches()
        if not adjusted_batches:
            first_step = ConfirmSaleBatchStep(store, self, model, None)
        else:
            marker('running SalesPersonStep')
            first_step = SalesPersonStep(self, store, model,
                                         self.payment_group)
            marker('finished creating SalesPersonStep')

        BaseWizard.__init__(self, store, first_step, model)

        if not sysparam.get_bool('CONFIRM_SALES_ON_TILL'):
            # This was added to allow us to work even if an error
            # happened while adding a payment, where we already order
            # but cannot confirm and are thrown back to the main
            # POS interface
            if self.model.can_order():
                self.model.order()

        marker('leaving ConfirmSaleWizard.__init__')
Example #39
0
    def __init__(self, store, model=None, edit_mode=False):
        title = self._get_title(model)
        model = model or self._create_model(store)
        # Should we show all products or only the ones associated with the
        # selected supplier?
        self.all_products = False
        self.sync_mode = api.sysparam.get_bool('SYNCHRONIZED_MODE')

        # If we receive the order right after the purchase.
        self.receiving_model = None
        purchase_edit = [PurchaseOrder.ORDER_CONFIRMED,
                         PurchaseOrder.ORDER_PENDING]

        if not model.status in purchase_edit:
            raise ValueError('Invalid order status. It should '
                             'be ORDER_PENDING or ORDER_CONFIRMED')
        first_step = StartPurchaseStep(self, store, model)
        BaseWizard.__init__(self, store, first_step, model, title=title,
                            edit_mode=edit_mode)
Example #40
0
    def __init__(self, options, config=None):
        if not config:
            config = StoqConfig()

        self.settings = config.get_settings()
        if is_windows:
            self.settings.username = WINDOWS_DEFAULT_USER
            self.settings.password = WINDOWS_DEFAULT_PASSWORD
            self.settings.dbname = WINDOWS_DEFAULT_DBNAME
            self.settings.address = "localhost"
            self.settings.port = 5432

        self.link_request_done = False
        self.create_examples = False
        self.config = config
        self.enable_production = False
        self.has_installed_db = False
        self.options = options
        self.db_is_local = False
        self.enable_online_services = True
        self.auth_type = TRUST_AUTHENTICATION

        if config.get('Database', 'enable_production') == 'True':
            self.enable_production = True

        if self.enable_production:
            first_step = CreateDatabaseStep(self)
        elif is_windows and self.try_connect(self.settings, warn=False):
            self.auth_type = PASSWORD_AUTHENTICATION
            self.write_pgpass()
            first_step = self.connect_for_settings()
        else:
            first_step = DatabaseLocationStep(self)

        BaseWizard.__init__(self, None, first_step, title=self.title)

        self.get_toplevel().set_deletable(False)
        self.next_button.grab_focus()
Example #41
0
    def __init__(self, options, config=None):
        if not config:
            config = StoqConfig()

        self.settings = config.get_settings()
        if is_windows:
            self.settings.username = WINDOWS_DEFAULT_USER
            self.settings.password = WINDOWS_DEFAULT_PASSWORD
            self.settings.dbname = WINDOWS_DEFAULT_DBNAME
            self.settings.address = "localhost"
            self.settings.port = 5432

        self.link_request_done = False
        self.create_examples = False
        self.config = config
        self.enable_production = False
        self.has_installed_db = False
        self.options = options
        self.db_is_local = False
        self.enable_online_services = True
        self.auth_type = TRUST_AUTHENTICATION

        if config.get('Database', 'enable_production') == 'True':
            self.enable_production = True

        if self.enable_production:
            first_step = CreateDatabaseStep(self)
        elif is_windows and self.try_connect(self.settings, warn=False):
            self.auth_type = PASSWORD_AUTHENTICATION
            self.write_pgpass()
            first_step = self.connect_for_settings()
        else:
            first_step = DatabaseLocationStep(self)

        BaseWizard.__init__(self, None, first_step, title=self.title)

        self.get_toplevel().set_deletable(False)
        self.next_button.grab_focus()
Example #42
0
 def __init__(self, store):
     self.model = None
     first_step = PurchaseSelectionStep(self, store)
     BaseWizard.__init__(self, store, first_step, self.model)
     self.next_button.set_sensitive(False)
Example #43
0
 def __init__(self, store, model=None, edit_mode=False):
     title = self._get_title(model)
     model = model or self._create_model(store)
     first_step = OpenProductionOrderStep(store, self, model)
     BaseWizard.__init__(self, store, first_step, model, title=title,
                         edit_mode=edit_mode)
 def __init__(self, store):
     self.model = TemporaryTransferOrder(
         source_branch=api.get_current_branch(store))
     first_step = StockTransferItemStep(self, None, store, self.model)
     BaseWizard.__init__(self, store, first_step, self.model)
     self.next_button.set_sensitive(False)
Example #45
0
 def __init__(self, store):
     register_payment_slaves()
     self.purchase_model = None
     first_step = ConsignmentSelectionStep(self, store)
     BaseWizard.__init__(self, store, first_step, None)
     self.next_button.set_sensitive(False)
Example #46
0
 def __init__(self, store):
     self.model = TemporaryTransferOrder()
     first_step = StockTransferItemStep(self, None, store, self.model)
     BaseWizard.__init__(self, store, first_step, self.model)
     self.next_button.set_sensitive(False)
Example #47
0
    def __init__(self, store):
        model = self._create_model(store)

        first_step = StartStockDecreaseStep(store, self, model)
        BaseWizard.__init__(self, store, first_step, model)
        self.create_payments = False
Example #48
0
 def __init__(self, store, groups):
     self.groups = groups
     self.model = self._create_model(store)
     first = PaymentRenegotiationPaymentListStep(store, self, self.model,
                                                 self.groups)
     BaseWizard.__init__(self, store, first, self.model)
Example #49
0
 def __init__(self):
     first_step = UpdateWelcomeStep(None, wizard=self)
     BaseWizard.__init__(self, None, first_step, title=self.title)
     # Disable back until #2771 is solved
     self.previous_button.hide()
Example #50
0
 def __init__(self, store, groups):
     self.groups = groups
     self.model = self._create_model(store)
     first = PaymentRenegotiationPaymentListStep(store, self, self.model, self.groups)
     BaseWizard.__init__(self, store, first, self.model)
Example #51
0
 def __init__(self, store):
     register_payment_slaves()
     self.purchase_model = None
     first_step = ConsignmentSelectionStep(self, store)
     BaseWizard.__init__(self, store, first_step, None)
     self.next_button.set_sensitive(False)
Example #52
0
    def __init__(self, store):
        model = self._create_model(store)

        first_step = StartStockDecreaseStep(store, self, model)
        BaseWizard.__init__(self, store, first_step, model)
        self.create_payments = False
Example #53
0
 def __init__(self, store):
     self.model = None
     first_step = PurchaseSelectionStep(self, store)
     BaseWizard.__init__(self, store, first_step, self.model)
     self.next_button.set_sensitive(False)
Example #54
0
 def __init__(self, store):
     self.model = self._create_model(store)
     first_step = StockTransferInitialStep(self, store, self.model)
     BaseWizard.__init__(self, store, first_step, self.model)
Example #55
0
 def __init__(self, store, *args, **kwargs):
     self.product_type = Product.TYPE_COMMON
     first_step = ProductTypeStep(store, self)
     BaseWizard.__init__(self, store, first_step)
Example #56
0
    def test_cancel_confirmation_close(self, yesno):
        step = _FakeStep(self.store, None)
        wizard = BaseWizard(self.store, step, title="Fake")

        # need_cancel_confirmation is False, cancel should close the wizard
        with mock.patch.object(wizard, 'close') as close:
            wizard.cancel()
            self.assertEquals(yesno.call_count, 0)
            self.assertEquals(close.call_count, 1)

        wizard.need_cancel_confirmation = True

        # need_cancel_confirmation is True but there're no changes. Cancel
        # should still close the dialog
        with mock.patch.object(wizard, 'close') as close:
            wizard.cancel()
            self.assertEquals(yesno.call_count, 0)
            self.assertEquals(close.call_count, 1)

        # Just to make store.get_pending_changes return something greater
        # thant the time the wizard was created
        self.create_sellable()

        yesno.return_value = True
        # need_cancel_confirmation is True and there're changes. yesno
        # should ask if we can close the wizard or not and since we are
        # answering True, it should still close
        with mock.patch.object(wizard, 'close') as close:
            wizard.cancel()
            yesno.assert_called_once_with(
                ("If you cancel this dialog all changes will be "
                 "lost. Are you sure?"), gtk.RESPONSE_NO, "Cancel",
                "Don't cancel")
            self.assertEquals(close.call_count, 1)

        yesno.reset_mock()
        yesno.return_value = False
        # need_cancel_confirmation is True and there're changes. yesno
        # should ask if we can close the wizard or not and since we are
        # answering False, it should not close
        with mock.patch.object(wizard, 'close') as close:
            wizard.cancel()
            yesno.assert_called_once_with(
                ("If you cancel this dialog all changes will be "
                 "lost. Are you sure?"), gtk.RESPONSE_NO, "Cancel",
                "Don't cancel")
            self.assertEquals(close.call_count, 0)
Example #57
0
 def __init__(self, store):
     self.model = self._create_model(store)
     first_step = StockTransferInitialStep(self, store, self.model)
     BaseWizard.__init__(self, store, first_step, self.model)
Example #58
0
 def __init__(self, store, *args, **kwargs):
     self.product_type = Product.TYPE_COMMON
     first_step = ProductTypeStep(store, self)
     BaseWizard.__init__(self, store, first_step)
Example #59
0
 def __init__(self):
     first_step = UpdateWelcomeStep(None, wizard=self)
     BaseWizard.__init__(self, None, first_step, title=self.title)
     # Disable back until #2771 is solved
     self.previous_button.hide()