示例#1
0
def orders(request):
    """
    Orders. All Orders Partner Available
    """

    partner_id = checkPartnerID(request)
    if not partner_id:
        error = _(
            'Are you a customer? Please, contact us. We will create a new role'
        )
        return render_to_response("partner/error.html",
                                  locals(),
                                  context_instance=RequestContext(request))
    full_name = checkFullName(request)
    conn = connOOOP()
    if not conn:
        error = _(
            'Error when connecting with our ERP. Try again or cantact us')
        return render_to_response("partner/error.html",
                                  locals(),
                                  context_instance=RequestContext(request))

    values = {}
    total = len(
        conn.SaleOrder.filter(partner_id=partner_id, shop_id__in=OERP_SALES))
    offset, page_previous, page_next = paginationOOOP(request, total,
                                                      PAGINATOR_ORDER_TOTAL)

    values = conn.SaleOrder.filter(partner_id=partner_id,
                                   shop_id__in=OERP_SALES,
                                   offset=offset,
                                   limit=PAGINATOR_ORDER_TOTAL,
                                   order='date_order DESC, name DESC')

    title = _('All Orders')
    metadescription = _('List all orders of %s') % full_name

    return render_to_response("sale/orders.html", {
        'title': title,
        'metadescription': metadescription,
        'values': values,
        'page_previous': page_previous,
        'page_next': page_next,
    },
                              context_instance=RequestContext(request))
示例#2
0
def invoices(request):
    partner_id = checkPartnerID(request)
    if not partner_id:
        error = _('Are you a customer? Please, contact us. We will create a new role')
        return render_to_response("partner/error.html", locals(), context_instance=RequestContext(request))
    full_name = checkFullName(request)
    conn = connOOOP()
    if not conn:
        error = _('Error when connecting with our ERP. Try again or cantact us')
        return render_to_response("partner/error.html", locals(), context_instance=RequestContext(request))
    
    values = {}
    total = len(conn.AccountInvoice.filter(partner_id=partner_id, state__ne='draft', type='out_invoice', company_id=OERP_COMPANY))
    offset, page_previous, page_next = paginationOOOP(request, total, PAGINATOR_INVOICE_TOTAL)

    values = conn.AccountInvoice.filter(partner_id=partner_id, state__ne='draft', type='out_invoice', company_id=OERP_COMPANY, offset=offset, limit=PAGINATOR_INVOICE_TOTAL, order='name DESC')

    title = _('All Invoices')
    metadescription = _('List all invoices of %s') % full_name

    return render_to_response("account/invoices.html", {'title':title, 'metadescription':metadescription, 'values':values, 'page_previous':page_previous, 'page_next':page_next}, context_instance=RequestContext(request))