Ejemplo n.º 1
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.º 2
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