def setUp(self): lumber_testing.create_init_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() data_list = [ { 'timber': self.pine_timber20, 'quantity': 10 }, { 'timber': self.pine_timber22, 'quantity': 15 }, { 'timber': self.pine_timber28, 'quantity': 20 }, ] self.income_timber = IncomeTimber.objects.create_income_timber( raw_timber_records=data_list, initiator=self.kladman)
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()
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()
def get(self, request, format=None): # create_init_data() create_test_timber() return Response({'msg': 'Done.'})
def setUp(self): lumber_testing.create_init_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.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() data_list = [ {'timber': self.pine_timber20, 'quantity': 20 }, {'timber': self.pine_timber22, 'quantity': 25 }, {'timber': self.pine_timber28, 'quantity': 30 }, ] self.income_timber = IncomeTimber.objects.create_income_timber( raw_timber_records=data_list, initiator=self.kladman, rama=self.rama) data_list2 = { '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_list2['lumbers'], initiator=self.kladman, 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': 13, 'rama_price': 12000, 'selling_price': 12500, 'selling_total_cash': 7500, 'calc_type': 'exact'}, {'lumber': self.china_brus1, 'quantity': 5, 'rama_price': 15000, 'selling_price': 15000, 'selling_total_cash': 19010, 'calc_type': 'china'}, {'lumber': self.doska25_18, 'quantity': 53, '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.sale2 = Sale.objects.create_sale_common( raw_records=data_list3['lumbers'], initiator=self.kladman, 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'] )