Пример #1
0
    def setUp(self):
        self.client = APIClient()
        testing.create_test_data()

        self.ramshik1 = User.objects.get(username='******')
        self.ramshik2 = User.objects.get(username='******')
        self.ramshik3 = User.objects.get(username='******')
        self.ramshik4 = User.objects.get(username='******')

        self.seller1 = User.objects.get(username='******')
        self.kladman = User.objects.get(username='******')

        self.brus1 = Lumber.objects.filter(name__contains='брус')[0]
        self.brus2 = Lumber.objects.filter(name__contains='брус')[1]
        self.doska1 = Lumber.objects.filter(name__contains='доска')[0]
        self.doska2 = Lumber.objects.filter(name__contains='доска')[1]

        self.doska4_18 = Lumber.objects.filter(name__contains='доска 4*18')[0]
        self.doska25_18 = Lumber.objects.filter(
            name__contains='доска 2.5*18')[0]

        self.china_brus1 = Lumber.objects.filter(
            name='брус 18*18', wood_species='pine',
            china_volume__isnull=False).first()
        self.china_brus2 = Lumber.objects.filter(
            name='брус 15*18', wood_species='pine',
            china_volume__isnull=False).first()
Пример #2
0
    def setUp(self):
        self.client = APIClient()
        lumber_testing.create_test_data()

        self.rama = Rama.objects.all().first()
        self.rama2 = Rama.objects.filter(name='rama2').first()

        self.ramshik1 = User.objects.get(username='******')

        self.seller1 = User.objects.get(username='******')
        self.seller2 = User.objects.get(username='******')
        self.kladman = User.objects.get(username='******')

        self.manager1 = User.objects.get(username='******')
        self.manager1.account.can_see_rama_cash.add(self.rama)
        self.manager2 = User.objects.get(username='******')
        self.manager1.account.can_see_rama_cash.add(self.rama2)

        self.capo1 = User.objects.get(username='******')
        self.capo1.account.can_see_rama_cash.add(self.rama, self.rama2)

        self.capo2 = User.objects.get(username='******')
        self.capo2.account.can_see_rama_cash.add(self.rama2)

        CashRecord.objects.create_withdraw_employee(employee=self.ramshik1.account, amount=100,
         initiator=self.manager1)

        CashRecord.objects.create_withdraw_cash_from_manager(manager_account=self.manager2.account,
         amount=150, initiator=self.manager2)
Пример #3
0
    def setUp(self):
        self.client = APIClient()
        lumber_testing.create_test_data()

        self.rama = Rama.objects.all().first()
        self.rama2 = Rama.objects.filter(name='rama2').first()

        self.ramshik1 = User.objects.get(username='******')
        self.ramshik2 = User.objects.get(username='******')
        self.ramshik3 = User.objects.get(username='******')
        self.ramshik4 = User.objects.get(username='******')

        self.seller1 = User.objects.get(username='******')
        self.seller1.account.can_see_rama_stock.add(self.rama, self.rama2)
        self.seller2 = User.objects.get(username='******')
        self.seller2.account.can_see_rama_stock.add(self.rama2)
        self.kladman = User.objects.get(username='******')

        self.manager1 = User.objects.get(username='******')
        self.manager1.account.can_see_rama_shift.add(self.rama)

        self.manager2 = User.objects.get(username='******')
        self.manager2.account.can_see_rama_shift.add(self.rama2)

        self.capo1 = User.objects.get(username='******')
        self.capo1.account.can_see_rama_shift.add(self.rama, self.rama2)

        self.brus1 = Lumber.objects.filter(name__contains='брус')[0]
        self.brus2 = Lumber.objects.filter(name__contains='брус')[1]
        self.doska1 = Lumber.objects.filter(name__contains='доска')[0]
        self.doska2 = Lumber.objects.filter(name__contains='доска')[1]

        self.doska4_18 = Lumber.objects.filter(name__contains='доска 4*18',
             wood_species='pine')[0]
        self.doska25_18 = Lumber.objects.filter(name__contains='доска 2.5*18',
             wood_species='pine')[0]

        self.china_brus1 = Lumber.objects.filter(name='брус 18*18', wood_species='pine',
         china_volume__isnull=False).first()
        self.china_brus2 = Lumber.objects.filter(name='брус 15*18', wood_species='pine',
         china_volume__isnull=False).first()

        employees = [self.ramshik1.account, self.ramshik2.account, self.ramshik3.account]
        data_list = [
            {'lumber': self.brus1, 'quantity': 10, 'volume_total': 0.6, 'rate': 600, 'cash': 360 },
            {'lumber': self.brus2, 'quantity': 10, 'volume_total': 0.4, 'rate': 600, 'cash': 240 },
            {'lumber': self.doska4_18, 'quantity': 50, 'volume_total': 1.44, 'rate': 600, 'cash': 864 },
            {'lumber': self.doska25_18, 'quantity': 40, 'volume_total': 0.96, 'rate': 600, 'cash': 576 },
        ]

        shift = Shift.objects.create_shift_raw_records(shift_type='day', employees=employees, 
            raw_records=data_list, cash=1200, initiator=self.ramshik1, rama=self.rama)
Пример #4
0
    def setUp(self):
        testing.create_test_data()

        self.ramshik1 = User.objects.get(username='******')
        self.ramshik2 = User.objects.get(username='******')
        self.ramshik3 = User.objects.get(username='******')
        self.ramshik4 = User.objects.get(username='******')

        self.brus1 = Lumber.objects.filter(name__contains='брус')[0]
        self.brus2 = Lumber.objects.filter(name__contains='брус')[1]
        self.doska1 = Lumber.objects.filter(name__contains='доска')[0]
        self.doska2 = Lumber.objects.filter(name__contains='доска')[1]
        self.rama = Rama.objects.all().first()
    def setUp(self):
        testing.create_test_data()

        self.seller1 = User.objects.get(username='******')
        self.kladman = User.objects.get(username='******')

        self.brus1 = Lumber.objects.filter(name__contains='брус')[0]
        self.brus2 = Lumber.objects.filter(name__contains='брус')[1]
        self.doska1 = Lumber.objects.filter(name__contains='доска')[0]
        self.doska2 = Lumber.objects.filter(name__contains='доска')[1]

        self.rama = Rama.objects.all().first()

        data_list = [
            {
                'lumber': self.brus1,
                'quantity': 10,
                'rama_price': 12000,
                'selling_price': 12500,
                'selling_total_cash': 12510
            },
            {
                'lumber': self.brus2,
                'quantity': 15,
                'rama_price': 12000,
                'selling_price': 12800,
                'selling_total_cash': 7680
            },
            {
                'lumber': self.doska1,
                'quantity': 70,
                'rama_price': 7000,
                'selling_price': 7500,
                'selling_total_cash': 15120
            },
            {
                'lumber': self.doska2,
                'quantity': 55,
                'rama_price': 7000,
                'selling_price': 7200,
                'selling_total_cash': 9504
            },
        ]

        lumber_records = LumberRecord.objects.create_from_raw_for_common_sale(
            records_list=data_list, rama=self.rama)

        self.lumber_records_qs = LumberRecord.objects.filter(
            pk__in=(lr.pk for lr in lumber_records))
Пример #6
0
    def setUp(self):
        lumber_testing.create_test_data()
        timber_testing.create_test_timber()

        self.seller1 = User.objects.get(username='******')
        self.kladman = User.objects.get(username='******')

        self.pine_timber20 = Timber.objects.get(diameter=20,
                                                wood_species='pine')
        self.pine_timber22 = Timber.objects.get(diameter=22,
                                                wood_species='pine')
        self.pine_timber28 = Timber.objects.get(diameter=28,
                                                wood_species='pine')

        self.rama = Rama.objects.all().first()
Пример #7
0
    def setUp(self):
        self.client = APIClient()
        lumber_testing.create_test_data()
        timber_testing.create_test_timber()

        self.seller1 = User.objects.get(username='******')
        self.kladman = User.objects.get(username='******')

        self.ramshik1 = User.objects.get(username='******')
        self.ramshik2 = User.objects.get(username='******')
        self.ramshik3 = User.objects.get(username='******')
        self.ramshik4 = User.objects.get(username='******')

        self.pine_timber20 = Timber.objects.get(diameter=20, wood_species='pine')
        self.pine_timber22 = Timber.objects.get(diameter=22, wood_species='pine')
        self.pine_timber28 = Timber.objects.get(diameter=28, wood_species='pine')

        self.brus1 = Lumber.objects.filter(name__contains='брус')[0]
        self.brus2 = Lumber.objects.filter(name__contains='брус')[1]
        self.doska1 = Lumber.objects.filter(name__contains='доска')[0]
        self.doska2 = Lumber.objects.filter(name__contains='доска')[1]

        self.rama = Rama.objects.all().first()
Пример #8
0
    def setUp(self):
        self.client = APIClient()
        lumber_testing.create_test_data()

        self.rama = Rama.objects.filter(name='batorama').first()
        self.rama2 = Rama.objects.filter(name='rama2').first()

        self.ramshik1 = User.objects.get(username='******')
        self.ramshik2 = User.objects.get(username='******')
        self.ramshik3 = User.objects.get(username='******')
        self.ramshik4 = User.objects.get(username='******')

        self.seller1 = User.objects.get(username='******')
        self.seller1.account.can_see_rama_sales.add(self.rama, self.rama2)

        self.seller2 = User.objects.get(username='******')
        self.seller2.account.can_see_rama_sales.add(self.rama2)

        self.kladman = User.objects.get(username='******')

        self.manager1 = User.objects.get(username='******')
        self.manager1.account.can_see_rama_sales.add(self.rama, self.rama2)

        self.manager2 = User.objects.get(username='******')
        self.manager2.account.can_see_rama_sales.add(self.rama2)

        self.capo1 = User.objects.get(username='******')
        self.capo1.account.can_see_rama_sales.add(self.rama)

        self.brus1 = Lumber.objects.filter(name__contains='брус')[0]
        self.brus2 = Lumber.objects.filter(name__contains='брус')[1]
        self.doska1 = Lumber.objects.filter(name__contains='доска')[0]
        self.doska2 = Lumber.objects.filter(name__contains='доска')[1]

        self.doska4_18 = Lumber.objects.filter(name__contains='доска 4*18',
             wood_species='pine')[0]
        self.doska25_18 = Lumber.objects.filter(name__contains='доска 2.5*18',
             wood_species='pine')[0]

        self.china_brus1 = Lumber.objects.filter(name='брус 18*18', wood_species='pine',
         china_volume__isnull=False).first()
        self.china_brus2 = Lumber.objects.filter(name='брус 15*18', wood_species='pine',
         china_volume__isnull=False).first()

        data_list1 = {
            'lumbers': [
                {'lumber': self.brus1, 'quantity': 10, 'rama_price': 12000, 'selling_price': 12500,
                    'selling_total_cash': 7500, 'calc_type': 'exact'},
                {'lumber': self.china_brus1, 'quantity': 10, 'rama_price': 15000,
                    'selling_price': 15000, 'selling_total_cash': 19010, 'calc_type': 'china'},
                {'lumber': self.doska4_18, 'quantity': 70, 'rama_price': 7000, 'selling_price': 7500,
                    'selling_total_cash': 15443, 'calc_type': 'round'},
            ],
            'loader': True,
            'seller': self.seller1,
            'bonus_kladman': self.kladman,
            'delivery_fee': 500,
            'add_expenses': 0,
            'note': '',
            'client': 'Баярма'
        }

        self.sale1 = Sale.objects.create_sale_common(
            raw_records=data_list1['lumbers'],
            initiator=self.manager1,
            loader=data_list1['loader'],
            delivery_fee=data_list1['delivery_fee'],
            add_expenses=data_list1['add_expenses'],
            note=data_list1['note'],
            client=data_list1['client'],
            seller=data_list1['seller'],
            bonus_kladman=data_list1['bonus_kladman']
            )

        data_list2 = {
            'lumbers': [
                {'lumber': self.brus1, 'quantity': 20, 'rama_price': 12000, 
                    'selling_price': 12500,'selling_total_cash': 7500, 'calc_type': 'exact'},
                {'lumber': self.doska25_18, 'quantity': 60, 'rama_price': 7000,
                    'selling_price': 7500, 'selling_total_cash': 15443, 'calc_type': 'round'},
            ],
            'loader': True,
            'seller': self.seller2,
            'bonus_kladman': None,
            'delivery_fee': 500,
            'add_expenses': 0,
            'note': '',
            'client': 'Баярма2'
        }

        self.sale2 = Sale.objects.create_sale_common(
            raw_records=data_list2['lumbers'],
            initiator=self.manager2,
            loader=data_list2['loader'],
            delivery_fee=data_list2['delivery_fee'],
            add_expenses=data_list2['add_expenses'],
            note=data_list2['note'],
            client=data_list2['client'],
            seller=data_list2['seller'],
            bonus_kladman=data_list2['bonus_kladman']
            )

        data_list3 = {
            'lumbers': [
                {'lumber': self.brus1, 'quantity': 30, 'rama_price': 12000, 'selling_price': 12500,
                    'selling_total_cash': 7500, 'calc_type': 'exact'},
                {'lumber': self.china_brus1, 'quantity': 30, 'rama_price': 15000,
                    'selling_price': 15000, 'selling_total_cash': 19010, 'calc_type': 'china'},
            ],
            'loader': True,
            'seller': self.seller2,
            'bonus_kladman': self.kladman,
            'delivery_fee': 500,
            'add_expenses': 0,
            'note': '',
            'client': 'Баярма3'
        }

        self.sale3 = Sale.objects.create_sale_common(
            raw_records=data_list3['lumbers'],
            initiator=self.manager2,
            loader=data_list3['loader'],
            delivery_fee=data_list3['delivery_fee'],
            add_expenses=data_list3['add_expenses'],
            note=data_list3['note'],
            client=data_list3['client'],
            seller=data_list3['seller'],
            bonus_kladman=data_list3['bonus_kladman']
            )
    def setUp(self):
        testing.create_test_data()

        self.seller1 = User.objects.get(username='******')
        self.kladman = User.objects.get(username='******')
        self.ramshik1 = User.objects.get(username='******')
        self.ramshik2 = User.objects.get(username='******')
        self.ramshik3 = User.objects.get(username='******')

        self.brus1 = Lumber.objects.filter(name__contains='брус')[0]
        self.brus2 = Lumber.objects.filter(name__contains='брус')[1]
        self.doska1 = Lumber.objects.filter(name__contains='доска')[0]
        self.doska2 = Lumber.objects.filter(name__contains='доска')[1]

        self.china_brus1 = Lumber.objects.filter(
            name='брус 18*18', wood_species='pine',
            china_volume__isnull=False).first()
        self.china_brus2 = Lumber.objects.filter(
            name='брус 15*18', wood_species='pine',
            china_volume__isnull=False).first()

        self.doska4_18 = Lumber.objects.filter(name__contains='доска 4*18')[0]
        self.doska25_18 = Lumber.objects.filter(
            name__contains='доска 2.5*18')[0]

        self.rama = Rama.objects.all().first()

        employees = [
            self.ramshik1.account, self.ramshik2.account, self.ramshik3.account
        ]
        data_list1 = [
            {
                'lumber': self.brus1,
                'quantity': 50,
                'rate': 600,
                'cash': 360
            },
            {
                'lumber': self.brus2,
                'quantity': 55,
                'rate': 600,
                'cash': 240
            },
            {
                'lumber': self.doska1,
                'quantity': 250,
                'rate': 600,
                'cash': 864
            },
            {
                'lumber': self.doska2,
                'quantity': 240,
                'rate': 600,
                'cash': 576
            },
        ]

        self.shift = Shift.objects.create_shift_raw_records(
            shift_type='day',
            employees=employees,
            raw_records=data_list1,
            cash=1200,
            volume=10,
            initiator=self.ramshik1,
            rama=self.rama)

        data_list = {
            'lumbers': [
                {
                    'lumber': self.brus1,
                    'quantity': 10,
                    'rama_price': 12000,
                    'selling_price': 12500,
                    'selling_total_cash': 7500,
                    'calc_type': 'exact'
                },
                {
                    'lumber': self.china_brus1,
                    'quantity': 10,
                    'rama_price': 15000,
                    'selling_price': 15000,
                    'selling_total_cash': 19010,
                    'calc_type': 'china'
                },
                {
                    'lumber': self.doska4_18,
                    'quantity': 70,
                    'rama_price': 7000,
                    'selling_price': 7500,
                    'selling_total_cash': 15443,
                    'calc_type': 'round'
                },
            ],
            'loader':
            True,
            'seller':
            self.seller1,
            'bonus_kladman':
            self.kladman,
            'delivery_fee':
            500,
            'add_expenses':
            0,
            'note':
            '',
            'client':
            'Баярма'
        }

        self.sale = Sale.objects.create_sale_common(
            raw_records=data_list['lumbers'],
            initiator=self.kladman,
            loader=data_list['loader'],
            delivery_fee=data_list['delivery_fee'],
            add_expenses=data_list['add_expenses'],
            note=data_list['note'],
            client=data_list['client'],
            seller=data_list['seller'],
            bonus_kladman=data_list['bonus_kladman'])

        self.resaw = ReSaw.objects.create_resaw(resaw_lumber_in={
            'lumber': self.brus1,
            'quantity': 10
        },
                                                resaw_lumber_out={
                                                    'lumber': self.doska1,
                                                    'quantity': 44
                                                },
                                                rama=self.rama)

        self.refuse = RefuseLumber.objects.create_refuse(lumber=self.brus1,
                                                         quantity=2,
                                                         rama=self.rama)