예제 #1
0
    def test_penalty_and_interest(self):
        payment = self.create_payment(payment_type=Payment.TYPE_OUT,
                                      value=100,
                                      date=localtoday().date() -
                                      datetime.timedelta(5))

        payment.method.daily_interest = 1
        payment.method.penalty = 1

        slave = PurchasePaymentConfirmSlave(self.store, [payment])

        # Penalty and interest enabled
        self.assertEqual(slave.penalty.read(), currency('1'))
        self.assertEqual(slave.interest.read(), currency('5.05'))

        # Penalty disabled and interest enabled
        self.click(slave.pay_penalty)
        self.assertEqual(slave.penalty.read(), currency('0'))
        self.assertEqual(slave.interest.read(), currency('5'))

        # Penalty enabled and interest disabled
        self.click(slave.pay_penalty)
        self.click(slave.pay_interest)
        self.assertEqual(slave.penalty.read(), currency('1'))
        self.assertEqual(slave.interest.read(), currency('0'))

        # Penalty and interest disabled
        self.click(slave.pay_penalty)
        self.assertEqual(slave.penalty.read(), currency('0'))
        self.assertEqual(slave.interest.read(), currency('0'))
예제 #2
0
    def test_create(self):
        # We are creating a cost center, and it should appear in the slave,
        # since payment is a lonely payment.
        self.create_cost_center()
        self.create_cost_center(is_active=False)

        payment = self.create_payment()
        payment.identifier = 28567
        payment.method = self.get_payment_method(u'money')
        payment.description = u'payment description'
        slave = PurchasePaymentConfirmSlave(self.store, [payment])

        self.check_editor(slave, 'editor-lonely-payment-confirm-create')
예제 #3
0
    def test_penalty_and_interest(self):
        sale = self.create_sale()
        sale_item = self.create_sale_item(sale=sale)
        self.create_storable(sale_item.sellable.product,
                             get_current_branch(self.store), 10)

        payment = self.create_payment(payment_type=Payment.TYPE_OUT,
                                      value=100,
                                      date=localtoday().date() -
                                      datetime.timedelta(5))

        sale.group = payment.group

        sale.order()

        payment.method.daily_interest = 1
        payment.method.penalty = 1

        slave = PurchasePaymentConfirmSlave(self.store, [payment])

        # Penalty and interest enabled
        self.assertEqual(slave.penalty.read(), currency('1'))
        self.assertEqual(slave.interest.read(), currency('5.05'))

        # Penalty disabled and interest enabled
        self.click(slave.pay_penalty)
        self.assertEqual(slave.penalty.read(), currency('0'))
        self.assertEqual(slave.interest.read(), currency('5'))

        # Penalty enabled and interest disabled
        self.click(slave.pay_penalty)
        self.click(slave.pay_interest)
        self.assertEqual(slave.penalty.read(), currency('1'))
        self.assertEqual(slave.interest.read(), currency('0'))

        # Penalty and interest disabled
        self.click(slave.pay_penalty)
        self.assertEqual(slave.penalty.read(), currency('0'))
        self.assertEqual(slave.interest.read(), currency('0'))
예제 #4
0
    def test_create(self):
        # We are creating a cost center, but it should not appear in the slave,
        # since payment is not a lonely payment.
        self.create_cost_center()
        self.create_cost_center(is_active=False)

        payment = self.create_payment()
        payment.identifier = 12345
        payment.method = self.get_payment_method(u'money')
        payment.description = u'payment description'

        order = self.create_purchase_order()
        self.create_purchase_order_item(order)
        order.identifier = 68395
        order.status = PurchaseOrder.ORDER_PENDING
        order.confirm()

        payment.group = order.group

        slave = PurchasePaymentConfirmSlave(self.store, [payment])

        self.assertSensitive(slave, ['source_account', 'destination_account'])
        self.check_editor(slave, 'editor-purchase-payment-confirm-create')