当前位置: 首页>>代码示例>>Python>>正文


Python sysparam.get_object_id函数代码示例

本文整理汇总了Python中stoqlib.lib.parameters.sysparam.get_object_id函数的典型用法代码示例。如果您正苦于以下问题:Python get_object_id函数的具体用法?Python get_object_id怎么用?Python get_object_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_object_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _create_transaction

def _create_transaction(store, till_entry):
    AccountTransaction(description=till_entry.description,
                       source_account_id=sysparam.get_object_id('IMBALANCE_ACCOUNT'),
                       account_id=sysparam.get_object_id('TILLS_ACCOUNT'),
                       value=till_entry.value,
                       code=unicode(till_entry.identifier),
                       date=TransactionTimestamp(),
                       store=store,
                       payment=till_entry.payment)
开发者ID:EasyDevSolutions,项目名称:stoq,代码行数:9,代码来源:tilleditor.py

示例2: create_model

 def create_model(self, store):
     self._model_created = True
     sellable = Sellable(store=store)
     sellable.tax_constant_id = sysparam.get_object_id('DEFAULT_PRODUCT_TAX_CONSTANT')
     sellable.unit_id = sysparam.get_object_id('SUGGESTED_UNIT')
     model = Product(store=store, sellable=sellable)
     # FIXME: Instead of creating and then removing, we should only create
     # the Storable if the user chooses to do so, but due to the way the
     # editor is implemented, it is not that easy. Change this once we write
     # the new product editor.
     Storable(product=model, store=store)
     return model
开发者ID:pkaislan,项目名称:stoq,代码行数:12,代码来源:producteditor.py

示例3: create_model

    def create_model(self, store):
        self._model_created = True
        sellable = Sellable(store=store)
        model = Product(store=store, sellable=sellable)
        no_storable = [Product.TYPE_WITHOUT_STOCK, Product.TYPE_PACKAGE]
        if not self._product_type in no_storable:
            storable = Storable(product=model, store=store)

        if self._product_type == Product.TYPE_BATCH:
            storable.is_batch = True
        elif self._product_type == Product.TYPE_WITHOUT_STOCK:
            model.manage_stock = False
        elif self._product_type == Product.TYPE_CONSIGNED:
            model.consignment = True
        elif self._product_type == Product.TYPE_GRID:
            model.is_grid = True
            # Configurable products should not manage stock
            model.manage_stock = False
        elif self._product_type == Product.TYPE_PACKAGE:
            model.is_package = True
            # Package products should not manage stock
            model.manage_stock = False

        if self._template is not None:
            sellable.tax_constant = self._template.sellable.tax_constant
            sellable.unit = self._template.sellable.unit
            sellable.category = self._template.sellable.category
            sellable.base_price = self._template.sellable.base_price
            sellable.cost = self._template.sellable.cost

            model.manufacturer = self._template.manufacturer
            model.brand = self._template.brand
            model.family = self._template.family
            model.ncm = self._template.ncm
            model.icms_template = self._template.icms_template
            model.ipi_template = self._template.ipi_template

            for product_attr in self._template.attributes:
                ProductAttribute(store=self.store,
                                 product_id=model.id,
                                 attribute_id=product_attr.attribute.id)
            for supplier_info in self._template.suppliers:
                ProductSupplierInfo(
                    store=self.store,
                    product=model,
                    supplier=supplier_info.supplier)
        else:
            sellable.tax_constant_id = sysparam.get_object_id(
                'DEFAULT_PRODUCT_TAX_CONSTANT')
            sellable.unit_id = sysparam.get_object_id('SUGGESTED_UNIT')

        return model
开发者ID:Guillon88,项目名称:stoq,代码行数:52,代码来源:producteditor.py

示例4: create_for_receiving_order

    def create_for_receiving_order(cls, receiving_order):
        store = receiving_order.store
        current_user = get_current_user(store)
        employee = current_user.person.employee
        cfop_id = sysparam.get_object_id('DEFAULT_STOCK_DECREASE_CFOP')
        return_stock_decrease = cls(
            store=store,
            receiving_order=receiving_order,
            branch=get_current_branch(store),
            responsible=current_user,
            removed_by=employee,
            cfop_id=cfop_id)

        for receiving_item in receiving_order.get_items(with_children=False):
            if receiving_item.is_totally_returned():
                # Exclude items already totally returned
                continue

            if receiving_item.children_items.count():
                for child in receiving_item.children_items:
                    StockDecreaseItem.create_for_receiving_item(
                        return_stock_decrease, child)
            else:
                StockDecreaseItem.create_for_receiving_item(return_stock_decrease,
                                                            receiving_item)
        return return_stock_decrease
开发者ID:hackedbellini,项目名称:stoq,代码行数:26,代码来源:stockdecrease.py

示例5: create_model

 def create_model(self, store):
     tax_constant = SellableTaxConstant.get_by_type(TaxType.SERVICE, self.store)
     sellable = Sellable(description=u"", price=currency(0), store=store)
     sellable.tax_constant = tax_constant
     sellable.unit_id = sysparam.get_object_id("SUGGESTED_UNIT")
     model = Service(sellable=sellable, store=store)
     return model
开发者ID:EasyDevSolutions,项目名称:stoq,代码行数:7,代码来源:serviceeditor.py

示例6: create_from_payment

    def create_from_payment(cls, payment, account=None):
        """Create a new transaction based on a |payment|.
        It's normally used when creating a transaction which represents
        a payment, for instance when you receive a bill or a check from
        a |client| which will enter a |bankaccount|.

        :param payment: the |payment| to create the transaction for.
        :param account: |account| where this transaction will arrive,
          or ``None``
        :returns: the transaction
        """
        if not payment.is_paid():
            raise PaymentError(_("Payment needs to be paid"))
        store = payment.store
        value = payment.paid_value
        if payment.is_outpayment():
            value = -value
        return cls(source_account_id=sysparam.get_object_id('IMBALANCE_ACCOUNT'),
                   account=account or payment.method.destination_account,
                   value=value,
                   description=payment.description,
                   code=unicode(payment.identifier),
                   date=payment.paid_date,
                   store=store,
                   payment=payment)
开发者ID:igorferreira,项目名称:stoq,代码行数:25,代码来源:account.py

示例7: create_account_transaction

    def create_account_transaction(self, account=None, value=1,
                                   source=None, incoming=False):
        from stoqlib.domain.account import AccountTransaction
        if account is None:
            account = self.create_account()

        if source:
            source_id = source.id
        else:
            source_id = sysparam.get_object_id('IMBALANCE_ACCOUNT')

        if incoming:
            operation_type = AccountTransaction.TYPE_IN
        else:
            operation_type = AccountTransaction.TYPE_OUT

        return AccountTransaction(
            description=u"Test Account Transaction",
            code=u"Code",
            date=localnow(),
            value=value,
            account=account,
            source_account_id=source_id,
            operation_type=operation_type,
            store=self.store)
开发者ID:Joaldino,项目名称:stoq,代码行数:25,代码来源:exampledata.py

示例8: remove

    def remove(self, store):
        """Remove the current account. This updates all transactions which
        refers to this account and removes them.

        :param store: a store
        """
        if not self.can_remove():
            raise TypeError("Account %r cannot be removed" % (self, ))

        imbalance_account_id = sysparam.get_object_id('IMBALANCE_ACCOUNT')

        for transaction in store.find(AccountTransaction,
                                      account=self):
            transaction.account_id = imbalance_account_id
            store.flush()

        for transaction in store.find(AccountTransaction,
                                      source_account=self):
            transaction.source_account_id = imbalance_account_id
            store.flush()

        bank = self.bank
        if bank:
            for option in bank.options:
                store.remove(option)
            store.remove(bank)

        self.store.remove(self)
开发者ID:barkinet,项目名称:stoq,代码行数:28,代码来源:account.py

示例9: create_model

    def create_model(self, store):
        self._model_created = True
        sellable = Sellable(store=store)
        sellable.tax_constant_id = sysparam.get_object_id('DEFAULT_PRODUCT_TAX_CONSTANT')
        sellable.unit_id = sysparam.get_object_id('SUGGESTED_UNIT')
        model = Product(store=store, sellable=sellable)
        if self._product_type != Product.TYPE_WITHOUT_STOCK:
            storable = Storable(product=model, store=store)

        if self._product_type == Product.TYPE_BATCH:
            storable.is_batch = True
        elif self._product_type == Product.TYPE_WITHOUT_STOCK:
            model.manage_stock = False
        elif self._product_type == Product.TYPE_CONSIGNED:
            model.consignment = True

        return model
开发者ID:igorferreira,项目名称:stoq,代码行数:17,代码来源:producteditor.py

示例10: _create_model

 def _create_model(self, store):
     supplier_id = sysparam.get_object_id('SUGGESTED_SUPPLIER')
     branch = api.get_current_branch(store)
     status = PurchaseOrder.ORDER_QUOTING
     group = PaymentGroup(store=store)
     return PurchaseOrder(supplier_id=supplier_id,
                          branch=branch, status=status,
                          expected_receival_date=None,
                          responsible=api.get_current_user(store),
                          group=group,
                          store=store)
开发者ID:pkaislan,项目名称:stoq,代码行数:11,代码来源:purchasequotewizard.py

示例11: _create_model

 def _create_model(self, store):
     branch = api.get_current_branch(store)
     user = api.get_current_user(store)
     employee = user.person.employee
     cfop_id = sysparam.get_object_id('DEFAULT_STOCK_DECREASE_CFOP')
     return StockDecrease(responsible=user,
                          removed_by=employee,
                          branch=branch,
                          status=StockDecrease.STATUS_INITIAL,
                          cfop_id=cfop_id,
                          store=store)
开发者ID:Guillon88,项目名称:stoq,代码行数:11,代码来源:stockdecreasewizard.py

示例12: _create_model

 def _create_model(self, store):
     supplier_id = sysparam.get_object_id('SUGGESTED_SUPPLIER')
     branch = api.get_current_branch(store)
     group = PaymentGroup(store=store)
     status = PurchaseOrder.ORDER_PENDING
     return PurchaseOrder(supplier_id=supplier_id,
                          responsible=api.get_current_user(store),
                          branch=branch,
                          status=status,
                          group=group,
                          store=store)
开发者ID:Guillon88,项目名称:stoq,代码行数:11,代码来源:purchasewizard.py

示例13: before_start

 def before_start(self, store):
     account = store.find(Account,
                          code=unicode(self.tp.account_id)).one()
     if account is None:
         account = Account(description=self.get_account_id(),
                           code=unicode(self.tp.account_id),
                           account_type=Account.TYPE_BANK,
                           parent=sysparam.get_object(store, 'BANKS_ACCOUNT'),
                           store=store)
     self.account_id = account.id
     self.source_account_id = sysparam.get_object_id('IMBALANCE_ACCOUNT')
     self.skipped = 0
开发者ID:Joaldino,项目名称:stoq,代码行数:12,代码来源:ofximporter.py

示例14: _create_transaction

def _create_transaction(store, till_entry):
    if till_entry.value > 0:
        operation_type = AccountTransaction.TYPE_IN
        source_account = sysparam.get_object_id("IMBALANCE_ACCOUNT")
        dest_account = sysparam.get_object_id("TILLS_ACCOUNT")
    else:
        operation_type = AccountTransaction.TYPE_OUT
        source_account = sysparam.get_object_id("TILLS_ACCOUNT")
        dest_account = sysparam.get_object_id("IMBALANCE_ACCOUNT")

    AccountTransaction(
        description=till_entry.description,
        source_account_id=source_account,
        account_id=dest_account,
        value=abs(till_entry.value),
        code=unicode(till_entry.identifier),
        date=TransactionTimestamp(),
        store=store,
        payment=till_entry.payment,
        operation_type=operation_type,
    )
开发者ID:amaurihamasu,项目名称:stoq,代码行数:21,代码来源:tilleditor.py

示例15: __init__

    def __init__(self):
        super(ProductImporter, self).__init__()
        default_store = get_default_store()
        suppliers = default_store.find(Supplier)
        if not suppliers.count():
            raise ValueError(u"You must have at least one suppliers on your " u"database at this point.")
        self.supplier = suppliers[0]

        self.units = {}
        for unit in default_store.find(SellableUnit):
            self.units[unit.description] = unit

        self.tax_constant_id = sysparam.get_object_id("DEFAULT_PRODUCT_TAX_CONSTANT")
        self._code = 1
开发者ID:stoq,项目名称:stoq,代码行数:14,代码来源:productimporter.py


注:本文中的stoqlib.lib.parameters.sysparam.get_object_id函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。