Ejemplo n.º 1
0
    def create_product_line_component(self):
        if not hasattr(self.cls, 'product'):
            imc = InventoryModelCreator(self.cls)
            imc.create_product()

        self.cls.product_line_component = ProductLineComponent.objects.create(
            product=self.cls.product,
            quantity=1,
        )

        self.cls.product_line_component
Ejemplo n.º 2
0
    def setUpTestData(cls):
        create_test_employees_models(cls)
        # common
        cls.usr = User.objects.create_user(username="******")
        create_test_employees_models(cls)

        InventoryModelCreator(cls).create_all()
        InvoicingModelCreator(cls).create_all()
        cls.product.unit_purchase_price = 0
        cls.product.save()

        cls.asset = Asset.objects.create(
            name='Test Asset',
            initialized_by=cls.employee,
            description='Test description',
            category=0,
            initial_value=100,
            credit_account=Account.objects.get(pk=1000),  # cash
            depreciation_period=5,
            init_date=TODAY,
            depreciation_method=0,
            salvage_value=20,
        )

        cls.employee.user = cls.usr
        cls.employee.save()
        es = EmployeesSettings.objects.first()
        es.payroll_officer = cls.officer
        es.save()
Ejemplo n.º 3
0
 def setUpTestData(cls):
     InventoryModelCreator(cls).create_all()
     cls.usr = User.objects.create_user(username='******', password='******')
     cls.employee = Employee.objects.create(first_name='name',
                                            last_name='name',
                                            user=cls.usr)
     cls.controller = models.InventoryController.objects.create(
         employee=cls.employee)
Ejemplo n.º 4
0
    def create_invoice(self):
        if hasattr(self.cls, 'invoice') and self.cls.invoice is not None:
            return self.cls.invoice

        if not hasattr(self.cls, 'customer_org'):
            self.create_customer_org()

        if not hasattr(self.cls, 'warehouse'):
            imc = InventoryModelCreator(self.cls)
            imc.create_warehouse()

        self.cls.invoice = Invoice.objects.create(
            draft=False,
            status='invoice',
            customer=self.cls.customer_org,
            ship_from=self.cls.warehouse,
            salesperson='person')

        return self.cls.invoice
Ejemplo n.º 5
0
    def create_quotation(self):
        if hasattr(self.cls, 'quotation') and self.cls.invoice is not None:
            return self.cls.invoice

        if not hasattr(self.cls, 'customer_org'):
            self.create_customer_org()

        if not hasattr(self.cls, 'warehouse'):
            imc = InventoryModelCreator(self.cls)
            imc.create_warehouse()

        self.cls.quotation = Invoice.objects.create(
            draft=False,
            status='quotation',
            quotation_date=datetime.date.today(),
            quotation_valid=datetime.date.today(),
            customer=self.cls.customer_org,
            ship_from=self.cls.warehouse,
            salesperson='self.cls.sales_representative')

        return self.cls.quotation
Ejemplo n.º 6
0
 def setUpTestData(cls):
     invmc = InventoryModelCreator(cls)
     invmc.create_warehouse_item()
     invmc.create_orderitem()
     cls.imc = InvoicingModelCreator(cls)
     cls.imc.create_all()
     accounting.tests.model_util.AccountingModelCreator(cls).create_tax()
Ejemplo n.º 7
0
 def setUpTestData(cls):
     invmc = InventoryModelCreator(cls)
     invmc.create_warehouse_item()
     invmc.create_orderitem()
     create_test_user(cls)
     cls.imc = InvoicingModelCreator(cls)
     cls.imc.create_all()
     accounting.tests.model_util.AccountingModelCreator(cls).create_tax()
     create_test_common_entities(cls)
     cls.session = POSSession.objects.create(
         start = datetime.datetime.now(),
         sales_person = cls.employee
     )
Ejemplo n.º 8
0
    def setUpTestData(cls):
        invmc = InventoryModelCreator(cls)
        invmc.create_warehouse_item()
        invmc.create_orderitem()
        create_test_user(cls)
        cls.imc = InvoicingModelCreator(cls)
        cls.imc.create_all()
        accounting.tests.model_util.AccountingModelCreator(cls).create_tax()
        create_test_common_entities(cls)
        cls.ls = LeadSource.objects.create(
            name='email',
            description='source'
        )
        cls.interaction_type = InteractionType.objects.create(
            name='type',
            description='of interaction'
        )

        cls.sales_team = SalesTeam.objects.create(
            name='team',
            description='focused on sales',
            leader=cls.sales_representative,
        )
        cls.lead = Lead.objects.create(
            title='title',
            description='description',
            owner=cls.sales_representative,
            team=cls.sales_team,
            created=datetime.date.today(),
            source=cls.ls,
        )
        cls.interaction = Interaction.objects.create(
            lead=cls.lead,
            contact=cls.individual,
            sales_representative=cls.sales_representative,
            type=cls.interaction_type
        )
        cls.task = Task.objects.create(
            title='do something',
            description='description',
            due=datetime.date.today(),
            lead=cls.lead,
            assigned=cls.sales_representative
        )
Ejemplo n.º 9
0
 def setUpTestData(cls):
     invmc = InventoryModelCreator(cls)
     invmc.create_warehouse_item()
     invmc.create_orderitem()
     cls.imc = InvoicingModelCreator(cls)
     cls.imc.create_all()
Ejemplo n.º 10
0
def create_test_inventory_models(cls):
    create_account_models(cls)
    if User.objects.all().count() == 0:
        User.objects.create_user(username='******')

    if not hasattr(cls, 'organization'):
        cls.organization = Organization.objects.create(
            legal_name='test business'
        )

    cls.supplier = models.Supplier.objects.create(
        organization=cls.organization,
        account=cls.account_c
    )

    InventoryModelCreator(cls).create_inventory_controller()
    cls.unit = models.UnitOfMeasure.objects.create(
        name='Test Unit',
        description='Test description'
    )
    cls.category = models.Category.objects.create(
        name='Test Category',
        description='Test description'
    )

    pc = models.ProductComponent.objects.create(
        pricing_method=0,  # KISS direct pricing
        direct_price=10,
        margin=0.5,
    )

    cls.product = models.InventoryItem.objects.create(
        name='test name',
        unit=cls.unit,
        type=0,
        unit_purchase_price=10,
        description='Test Description',
        supplier=cls.supplier,
        minimum_order_level=0,
        maximum_stock_level=20,
        category=cls.category,
        product_component=pc
    )

    ec = models.EquipmentComponent.objects.create(
        condition="excellent",
        asset_data=cls.asset
    )

    cls.equipment = models.InventoryItem.objects.create(
        name='test equipment',
        unit=cls.unit,
        type=1,
        unit_purchase_price=10,
        description='Test Description',
        supplier=cls.supplier,
        category=cls.category,
        equipment_component=ec
    )

    cls.consumable = models.InventoryItem.objects.create(
        name='test comsumable',
        unit=cls.unit,
        unit_purchase_price=10,
        type=2,
        description='Test Description',
        supplier=cls.supplier,
        minimum_order_level=0,
        maximum_stock_level=20,
        category=cls.category
    )

    cls.warehouse = models.WareHouse.objects.create(
        name='Test Location',
        address='Test Address'
    )
    cls.medium = models.StorageMedia.objects.create(
        name="Test Medium",
        warehouse=cls.warehouse,
        description="shelves",
    )
    cls.warehouse_item = models.WareHouseItem.objects.create(
        item=cls.product,
        quantity=10,
        warehouse=cls.warehouse,
        location=cls.medium
    )
    cls.order = models.Order.objects.create(
        expected_receipt_date=TODAY,
        date=TODAY,
        tax=Tax.objects.first(),  # 10%
        supplier=cls.supplier,
        bill_to='Test Bill to',
        ship_to=cls.warehouse,
        tracking_number='34234',
        notes='Test Note',
        status='draft',
        issuing_inventory_controller=cls.controller
    )
    cls.order_item = models.OrderItem.objects.create(
        order=cls.order,
        item=cls.product,
        quantity=1,
        order_price=10,
    )
    cls.stock_receipt = models.StockReceipt.objects.create(
        order=cls.order,
        receive_date=TODAY,
        note='Test Note',
        fully_received=True,
    )

    cls.check = models.InventoryCheck.objects.create(
        date=TODAY,
        adjusted_by=cls.controller,
        warehouse=cls.warehouse,
        comments="Nothing new"
    )

    cls.adjustment = models.StockAdjustment.objects.create(
        warehouse_item=cls.warehouse_item,
        adjustment=1.0,
        note="Too many",
        inventory_check=cls.check
    )

    cls.transfer = models.TransferOrder.objects.create(
        date=TODAY,
        expected_completion_date=TODAY,
        issuing_inventory_controller=cls.controller,
        receiving_inventory_controller=cls.controller,
        actual_completion_date=TODAY,
        source_warehouse=cls.warehouse,
        receiving_warehouse=cls.warehouse,
    )
    cls.transfer_line = models.TransferOrderLine.objects.create(
        item=cls.product,
        quantity=1,
        transfer_order=cls.transfer
    )
    cls.scrap = models.InventoryScrappingRecord.objects.create(
        date=TODAY,
        controller=cls.controller,
        warehouse=cls.warehouse
    )
    cls.scrap_line = models.InventoryScrappingRecordLine.objects.create(
        item=cls.product,
        quantity=1,
        scrapping_record=cls.scrap
    )

    cls.note = models.DebitNote.objects.create(
        date=datetime.date.today(),
        order=cls.order,
        comments="comment"
    )