Create a new Order.

        Args:
            debtor (Debtor): the debtor of the order
            debtor_data (mapping): map of debtor data {'postal_code: .., 'city': .., 'ean': ..}
                                   defaults to values on debitor instance for missing values
            delivery_data (mapping): map of delivery data {'address': ..., 'postal_code': ...}
                                     defaults to values on debitor instance for missing values
            due_date (datetime): due date
            heading (string): heading to be displayed in the order pdf
            text_line1 (string): first order description line
            text_line2 (string): second order description line
            other_reference (string): custom string to be used for identification
            extra (mapping): mapping of extra values to be passed in to the server call
        Returns:
            Order instance

def create_order(self, debtor, is_vat_included=True, due_date=None,
                     heading='', text_line1='', text_line2='',
                     debtor_data=None, delivery_data=None, products=None,
                     project=None, other_reference='', model=models.Order, **extra
                     ):
        """Create a new Order.

        Args:
            debtor (Debtor): the debtor of the order
            debtor_data (mapping): map of debtor data {'postal_code: .., 'city': .., 'ean': ..}
                                   defaults to values on debitor instance for missing values
            delivery_data (mapping): map of delivery data {'address': ..., 'postal_code': ...}
                                     defaults to values on debitor instance for missing values
            due_date (datetime): due date
            heading (string): heading to be displayed in the order pdf
            text_line1 (string): first order description line
            text_line2 (string): second order description line
            other_reference (string): custom string to be used for identification
            extra (mapping): mapping of extra values to be passed in to the server call
        Returns:
            Order instance
        """

        debtor_data = debtor_data or {}
        delivery_data = delivery_data or {}
        delivery_date = delivery_data.get('date', datetime.datetime.now())
        our_reference = extra.get('our_reference', debtor.our_reference)
        currency = extra.get('currency', debtor.currency)
        layout = extra.get('layout', debtor.layout)
        term_of_payment = extra.get('term_of_payment', debtor.term_of_payment)
        date = extra.get('date', datetime.datetime.now())
        order_input = {
            'debtor': debtor,
            'number': extra.get('number', 1),
            'project': project,
        }
        for dd in ['name', 'address', 'postal_code', 'city', 'country', 'ean']:
            order_input['debtor_%s' % dd] = debtor_data.get(dd, getattr(debtor, dd))

        for dd in ['address', 'postal_code', 'city', 'country']:
            order_input['delivery_%s' % dd] = delivery_data.get(dd, getattr(debtor, dd))

        order_input.update({
            'delivery_date': delivery_date or datetime.datetime.now(),
            'heading': heading,
            'text_line1': text_line1,
            'text_line2': text_line2,
            'is_archived': extra.get('is_archived', 0),
            'is_sent': extra.get('is_sent', 0),
            'net_amount': extra.get('net_amount', 0),
            'vat_amount': extra.get('vat_amount', 0),
            'gross_amount': extra.get('gross_amount', 0),
            'margin': extra.get('margin', 0),
            'margin_as_percent': extra.get('margin_as_percent', 0),
            'date': date,
            'our_reference': our_reference,
            'other_reference': other_reference,
            'currency': currency,
            'exchange_rate': extra.get('exchange_rate', 1.0),
            'is_vat_included': is_vat_included,
            'layout': layout,
            'due_date': due_date or datetime.datetime.now(),
            'term_of_payment': term_of_payment
        })
        order_input.update(extra)
        order = self.create(model, **order_input)
        if products:
            for product in products:
                self.create_orderline(order, product)
        return order