コード例 #1
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)
コード例 #2
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)
コード例 #3
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)
コード例 #4
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)
コード例 #5
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
コード例 #6
0
ファイル: salequotewizard.py プロジェクト: Felipebros/stoq
    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)
コード例 #7
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)
コード例 #8
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)
コード例 #9
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)
コード例 #10
0
ファイル: personwizard.py プロジェクト: pauloscarin1972/stoq
    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)
コード例 #11
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)
コード例 #12
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(api.get_current_user(self.store))

        marker('leaving ConfirmSaleWizard.__init__')
コード例 #13
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)
コード例 #14
0
ファイル: config.py プロジェクト: pauloscarin1972/stoq
    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()
コード例 #15
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()
コード例 #16
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)
コード例 #17
0
ファイル: productwizard.py プロジェクト: pauloscarin1972/stoq
 def __init__(self, store, *args, **kwargs):
     self.product_type = Product.TYPE_COMMON
     first_step = ProductTypeStep(store, self)
     BaseWizard.__init__(self, store, first_step)
コード例 #18
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)
コード例 #19
0
ファイル: productionwizard.py プロジェクト: Felipebros/stoq
 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)
コード例 #20
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)
コード例 #21
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)