• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python returnedsale.ReturnedSale类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_return_with_credit

    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')
开发者ID:fuinha,项目名称:stoq,代码行数:27,代码来源:test_returnedsale.py


示例2: test_add_item

 def test_add_item(self, branch=None):
     sale_item = self.create_sale_item()
     branch = branch or self.create_branch()
     item = ReturnedSaleItem(store=self.store,
                             sale_item=sale_item)
     rsale = ReturnedSale(store=self.store, branch=branch)
     rsale.add_item(item)
开发者ID:,项目名称:,代码行数:7,代码来源:


示例3: test_client

 def test_client(self):
     branch = self.create_branch()
     client = self.create_client()
     sale = self.create_sale(branch=branch)
     sale.client = client
     rsale = ReturnedSale(store=self.store)
     self.assertIsNone(rsale.client)
     rsale.sale = sale
     self.assertEquals(rsale.client, client)
开发者ID:fuinha,项目名称:stoq,代码行数:9,代码来源:test_returnedsale.py


示例4: test_group

    def test_group(self):
        branch = self.create_branch()
        client = self.create_client()
        sale = self.create_sale(branch=branch)
        sale.client = client
        rsale = ReturnedSale(branch=branch, store=self.store)
        self.assertIsNone(rsale.group)
        rsale.sale = sale
        self.assertEquals(rsale.group, sale.group)

        rsale.sale = None
        rsale.new_sale = sale
        self.assertEquals(rsale.group, sale.group)
开发者ID:EasyDevSolutions,项目名称:stoq,代码行数:13,代码来源:test_returnedsale.py


示例5: create_trade

    def create_trade(self, trade_value=100):
        from stoqlib.domain.returnedsale import ReturnedSale, ReturnedSaleItem
        branch = get_current_branch(self.store)
        returned_sale = ReturnedSale(store=self.store,
                                     responsible=get_current_user(self.store),
                                     branch=branch)
        ReturnedSaleItem(store=self.store,
                         quantity=1,
                         price=trade_value,
                         sellable=self.create_sellable(),
                         returned_sale=returned_sale)

        new_sale = self.create_sale()
        product_price = trade_value * 2
        self.add_product(new_sale, price=product_price)
        new_sale.discount_value = trade_value
        returned_sale.new_sale = new_sale
        return returned_sale
开发者ID:Joaldino,项目名称:stoq,代码行数:18,代码来源:exampledata.py


示例6: test_trade_without_sale

    def test_trade_without_sale(self):
        # With discount
        branch = get_current_branch(self.store)
        returned_sale = ReturnedSale(store=self.store,
                                     responsible=get_current_user(self.store),
                                     branch=branch)
        storable = self.create_storable(branch=branch,
                                        stock=10)
        ReturnedSaleItem(store=self.store,
                         quantity=1,
                         price=10,
                         sellable=storable.product.sellable,
                         returned_sale=returned_sale)
        new_sale = self.create_sale()
        returned_sale.new_sale = new_sale
        balance_before_trade = storable.get_balance_for_branch(branch)

        with self.sysparam(USE_TRADE_AS_DISCOUNT=True):
            returned_sale.trade()
            self.assertEqual(new_sale.discount_value, currency(10))

        self.assertEqual(returned_sale.status, ReturnedSale.STATUS_CONFIRMED)
        self.assertEqual(storable.get_balance_for_branch(branch),
                         balance_before_trade + 1)

        # Without discount
        returned_sale2 = ReturnedSale(store=self.store,
                                      responsible=get_current_user(self.store),
                                      branch=branch)
        storable = self.create_storable(branch=branch,
                                        stock=10)
        ReturnedSaleItem(store=self.store,
                         quantity=1,
                         price=10,
                         sellable=storable.product.sellable,
                         returned_sale=returned_sale2)
        new_sale = self.create_sale()
        returned_sale2.new_sale = new_sale
        balance_before_trade = storable.get_balance_for_branch(branch)

        returned_sale2.trade()
        self.assertEqual(returned_sale.status, ReturnedSale.STATUS_CONFIRMED)
        self.assertEqual(new_sale.discount_value, currency(0))

        group = new_sale.group
        payment = group.payments[0]
        self.assertEqual(group.payments.count(), 1)
        self.assertEqual(payment.value, returned_sale2.returned_total)
        self.assertEqual(storable.get_balance_for_branch(branch),
                         balance_before_trade + 1)
开发者ID:,项目名称:,代码行数:50,代码来源:


示例7: test_return_on_another_branch

    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)
开发者ID:fuinha,项目名称:stoq,代码行数:38,代码来源:test_returnedsale.py


示例8: _create_pending_returned_sale_message

    def _create_pending_returned_sale_message(self):
        branch = api.get_current_branch(self.store)
        n_returned = ReturnedSale.get_pending_returned_sales(self.store, branch).count()

        if not n_returned:
            return None

        msg = stoqlib_ngettext(_(u"You have %s returned sale to receive"),
                               _(u"You have %s returned sales to receive"),
                               n_returned) % n_returned
        info_returned_bar = self.window.add_info_bar(gtk.MESSAGE_QUESTION, msg)
        button = info_returned_bar.add_button(_(u"Returned sale"), gtk.RESPONSE_OK)
        button.connect('clicked', self._on_info_returned_sales__clicked)

        return info_returned_bar
开发者ID:adrianoaguiar,项目名称:stoq,代码行数:15,代码来源:stock.py


示例9: test_return_unpaid_with_credit

    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())
开发者ID:hackedbellini,项目名称:stoq,代码行数:24,代码来源:test_returnedsale.py


示例10: _search_pending_returned_sales

    def _search_pending_returned_sales(self):
        with api.new_store() as store:
            self.run_dialog(PendingReturnedSaleSearch, store)

        branch = api.get_current_branch(self.store)
        # After the search is closed we may want to update , or even hide the
        # message, if there is no pending returned sale to receive
        if self.returned_bar:
            n_returned = ReturnedSale.get_pending_returned_sales(self.store, branch).count()

            if n_returned > 0:
                msg = stoqlib_ngettext(_(u"You have %s returned sale to receive"),
                                       _(u"You have %s returned sales to receive"),
                                       n_returned) % n_returned
                self.returned_bar.set_message(msg)
            else:
                self.returned_bar.hide()
        self.refresh()
开发者ID:adrianoaguiar,项目名称:stoq,代码行数:18,代码来源:stock.py


示例11: test_trade_on_another_branch

    def test_trade_on_another_branch(self):
        sale_branch = get_current_branch(self.store)
        return_branch = self.create_branch()
        current_user = get_current_user(self.store)

        product = self.create_product(branch=sale_branch, stock=5)
        sale = self.create_sale(branch=sale_branch)
        sale_item = sale.add_sellable(sellable=product.sellable)
        storable = product.storable
        sale.order()

        self.add_payments(sale)
        sale.confirm()
        self.assertEqual(storable.get_balance_for_branch(sale_branch), 4)

        returned_sale = ReturnedSale(store=self.store,
                                     responsible=current_user,
                                     sale=sale,
                                     branch=return_branch)
        ReturnedSaleItem(store=self.store,
                         quantity=1,
                         price=10,
                         sale_item=sale_item,
                         returned_sale=returned_sale)
        new_sale = self.create_sale(branch=return_branch)
        returned_sale.new_sale = new_sale
        returned_sale.trade()

        self.assertEqual(returned_sale.status, ReturnedSale.STATUS_PENDING)
        self.assertEqual(storable.get_balance_for_branch(sale_branch), 4)
        self.assertEqual(storable.get_balance_for_branch(return_branch), 0)

        returned_sale.confirm(current_user)
        self.assertEqual(returned_sale.status, ReturnedSale.STATUS_CONFIRMED)
        self.assertEqual(storable.get_balance_for_branch(sale_branch), 5)
        self.assertEqual(storable.get_balance_for_branch(return_branch), 0)
开发者ID:,项目名称:,代码行数:36,代码来源:


示例12: test_add_item

 def test_add_item(self):
     sale_item = self.create_sale_item()
     item = ReturnedSaleItem(store=self.store,
                             sale_item=sale_item)
     rsale = ReturnedSale(store=self.store)
     rsale.add_item(item)
开发者ID:fuinha,项目名称:stoq,代码行数:6,代码来源:test_returnedsale.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sale.Sale类代码示例发布时间:2022-05-27
下一篇:
Python production.ProductionProducedItem类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap