本文整理汇总了Python中stoqlib.lib.parameters.sysparam.get_object_id函数的典型用法代码示例。如果您正苦于以下问题:Python get_object_id函数的具体用法?Python get_object_id怎么用?Python get_object_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_object_id函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: get_pixbuf
def get_pixbuf(self, model):
kind = model.kind
if kind == 'payable':
pixbuf = self._pixbuf_payable
elif kind == 'receivable':
pixbuf = self._pixbuf_receivable
elif kind == 'account':
till_account_id = sysparam.get_object_id('TILLS_ACCOUNT')
if model.matches(till_account_id):
pixbuf = self._pixbuf_till
else:
pixbuf = self._pixbuf_money
else:
return None
return pixbuf
开发者ID:EasyDevSolutions,项目名称:stoq,代码行数:15,代码来源:accounttree.py
示例17: _create_model
def _create_model(self, store):
if self.receiving_order:
return StockDecrease.create_for_receiving_order(self.receiving_order)
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')
stock_decrease = StockDecrease(store=store,
responsible=user,
removed_by=employee,
branch=branch,
status=StockDecrease.STATUS_INITIAL,
cfop_id=cfop_id)
stock_decrease.invoice.operation_nature = self.title
return stock_decrease
开发者ID:hackedbellini,项目名称:stoq,代码行数:16,代码来源:stockdecreasewizard.py
示例18: process_one
def process_one(self, data, fields, store):
person = store.find(Person, name=data.branch_name).one()
if person is None or person.branch is None:
raise ValueError(u"%s is not a valid branch" % (
data.branch_name, ))
branch = person.branch
person = store.find(Person, name=data.client_name).one()
if person is None or person.client is None:
raise ValueError(u"%s is not a valid client" % (
data.client_name, ))
client = person.client
person = store.find(Person, name=data.salesperson_name).one()
if person is None or person.sales_person is None:
raise ValueError(u"%s is not a valid sales person" % (
data.salesperson_name, ))
salesperson = person.sales_person
group = PaymentGroup(store=store)
sale = Sale(client=client,
open_date=self.parse_date(data.open_date),
coupon_id=int(data.coupon_id),
invoice_number=int(data.coupon_id),
salesperson=salesperson,
branch=branch,
cfop_id=sysparam.get_object_id('DEFAULT_SALES_CFOP'),
group=group,
store=store)
total_price = 0
for product in self.parse_multi(Product, data.product_list, store):
sale.add_sellable(product.sellable)
total_price += product.sellable.price
sale.order()
method = PaymentMethod.get_by_name(store, data.payment_method)
method.create_payment(Payment.TYPE_IN, group, branch, total_price,
self.parse_date(data.due_date))
sale.confirm()
# XXX: The payments are paid automatically when a sale is confirmed.
# So, we will change all the payment paid_date to the same date
# as open_date, then we can test the reports properly.
for payment in sale.payments:
if payment.is_paid():
p = store.fetch(payment)
p.paid_date = self.parse_date(data.open_date)
开发者ID:Guillon88,项目名称:stoq,代码行数:46,代码来源:saleimporter.py
示例19: reverse_entry
def reverse_entry(self, invoice_number,
iss_value=None, icms_value=None, ipi_value=None):
store = self.store
icms_value = icms_value if icms_value is not None else self.icms_value
iss_value = iss_value if iss_value is not None else self.iss_value
ipi_value = ipi_value if ipi_value is not None else self.ipi_value
return FiscalBookEntry(
entry_type=self.entry_type,
iss_value=iss_value,
icms_value=icms_value,
ipi_value=ipi_value,
cfop_id=sysparam.get_object_id('DEFAULT_SALES_CFOP'),
branch=self.branch,
invoice_number=invoice_number,
drawee=self.drawee,
is_reversal=True,
payment_group=self.payment_group,
store=store)
开发者ID:igorferreira,项目名称:stoq,代码行数:19,代码来源:fiscal.py
示例20: register_payment_methods
def register_payment_methods(store):
"""Registers the payment methods and creates persistent
domain classes associated with them.
"""
from stoqlib.domain.payment.method import PaymentMethod
from stoqlib.domain.payment.operation import get_payment_operation_manager
log.info("Registering payment operations")
pom = get_payment_operation_manager()
log.info("Creating domain objects for payment methods")
account_id = sysparam.get_object_id('IMBALANCE_ACCOUNT')
assert account_id
for operation_name in pom.get_operation_names():
operation = pom.get(operation_name)
pm = store.find(PaymentMethod, method_name=operation_name).one()
if pm is None:
pm = PaymentMethod(store=store,
method_name=operation_name,
destination_account_id=account_id,
max_installments=operation.max_installments)
开发者ID:Guillon88,项目名称:stoq,代码行数:21,代码来源:admin.py
注:本文中的stoqlib.lib.parameters.sysparam.get_object_id函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论