本文整理汇总了Python中stoqlib.domain.returnedsale.ReturnedSale.return_方法的典型用法代码示例。如果您正苦于以下问题:Python ReturnedSale.return_方法的具体用法?Python ReturnedSale.return_怎么用?Python ReturnedSale.return_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stoqlib.domain.returnedsale.ReturnedSale
的用法示例。
在下文中一共展示了ReturnedSale.return_方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_return_with_credit
# 需要导入模块: from stoqlib.domain.returnedsale import ReturnedSale [as 别名]
# 或者: from stoqlib.domain.returnedsale.ReturnedSale import return_ [as 别名]
def test_return_with_credit(self):
branch = get_current_branch(self.store)
sale_item = self.create_sale_item()
sale = sale_item.sale
sellable = sale_item.sellable
self.create_storable(product=sellable.product, branch=branch, stock=10)
payments = self.add_payments(sale, method_type=u'bill',
installments=2)
payments[0].status = Payment.STATUS_PENDING
self.add_payments(sale, method_type=u'money')
sale.order()
sale.confirm()
rsale = ReturnedSale(branch=branch,
sale=sale,
store=self.store)
ReturnedSaleItem(store=self.store,
returned_sale=rsale,
sale_item=sale_item,
quantity=1)
# Create an unused to test the removal of unused items,
# should probably be removed.
ReturnedSaleItem(store=self.store,
returned_sale=rsale,
sale_item=sale_item,
quantity=0)
rsale.return_(u'credit')
示例2: test_return_on_another_branch
# 需要导入模块: from stoqlib.domain.returnedsale import ReturnedSale [as 别名]
# 或者: from stoqlib.domain.returnedsale.ReturnedSale import return_ [as 别名]
def test_return_on_another_branch(self, gcb):
# Branch where the sale was created
sale_branch = get_current_branch(self.store)
# Branch where the sale was returned
return_branch = self.create_branch()
gcb.return_value = return_branch
product = self.create_product(branch=sale_branch, stock=2)
client = self.create_client()
# Creating a sale on sale_branch
sale = self.create_sale(branch=sale_branch, client=client)
sale_item = sale.add_sellable(sellable=product.sellable)
# Adding payments and confirming the sale
payments = self.add_payments(sale, method_type=u'bill',
installments=2)
payments[0].status = Payment.STATUS_PENDING
self.add_payments(sale, method_type=u'money')
sale.order()
sale.confirm()
# Creating the returned_sale
rsale = ReturnedSale(branch=return_branch,
sale=sale,
store=self.store)
ReturnedSaleItem(store=self.store,
returned_sale=rsale,
sale_item=sale_item,
quantity=1)
rsale.return_(u'credit')
# Checking the status of sale and returned_sale
self.assertEquals(rsale.status, ReturnedSale.STATUS_PENDING)
self.assertEquals(sale.status, Sale.STATUS_RETURNED)
# Checking the quantity on sale_branch
self.assertEquals(product.storable.get_balance_for_branch(sale_branch), 1)
# We should not increase the stock of that product on return_branch
self.assertEquals(product.storable.get_balance_for_branch(return_branch), 0)
示例3: test_return_unpaid_with_credit
# 需要导入模块: from stoqlib.domain.returnedsale import ReturnedSale [as 别名]
# 或者: from stoqlib.domain.returnedsale.ReturnedSale import return_ [as 别名]
def test_return_unpaid_with_credit(self):
branch = get_current_branch(self.store)
sale_item = self.create_sale_item()
sale = sale_item.sale
sellable = sale_item.sellable
self.create_storable(product=sellable.product, branch=branch, stock=10)
self.add_payments(sale, method_type=u'bill', installments=1)
sale.order()
sale.confirm()
rsale = ReturnedSale(branch=branch,
sale=sale,
store=self.store)
ReturnedSaleItem(store=self.store,
returned_sale=rsale,
sale_item=sale_item,
quantity=1)
# Before the return there is not out payment
self.assertIsNone(sale.group.payments.find(payment_type=Payment.TYPE_OUT).one())
rsale.return_(u'credit')
# There should be one payment with a credit for the returned value
self.assertIsNotNone(sale.group.payments.find(payment_type=Payment.TYPE_OUT).one())