I don't like the present invoice layout and it does not allow much tweaking. The only thing I can change I should not change, namely the line items. If the rest is outside the view and is hard-coded, so I cannot easily add the extra field with the tax registration number that is obligatory in this country.

From alpha1 I still have an invoice view (see attached) that is adaptable and I had it nicely laid out, but unfortunately the alpha2 invoice list cannot be customized to change the link to my old view (see my other feature request).

Most likely it is better to wait and stay with alpha1 for a while until these limitations are fixed and just go with the previous solution of an extra column in the Order table view where the invoice numbers appear when available (see other attached). This seems all more compact and clearly relate the invoice with the order.

Comments

elmotri’s picture

+1 This would make it easy to generate PDFs from the Invoice view with views_pdf.

Slacker’s picture

+1 would love this functionality

CanOne’s picture

Thank you very much for that!
Just tried it myself couple of minutes ago but couldnt get the billing data.
How do you got the relationship "(Order associated to the invoice) Commerce Order: Billing information" into the view?

And another question, what is the field_nif for?
I just deleted it before importing the view cause otherwise i get errors.
But maybe i should create such a field, if i know what it is for :)

*EDIT: Ah okay, just googled nif! So its the spanish tax number right?
Kay dont need it at the moment :D

Cheers
Can

brianlp’s picture

Same here. I need to be able to add the leagally required information like tax number, company name and address etc.

marcoka’s picture

at the basic state the invoices generated are not "according to law" in most of the countries :D
so customizing would be needed if anyone really want to use it for a real shop.

The main question

i can do a view with all stuff needed, adding all fields i want using a path like /user/%/incoice/%
first % is uid second is order-id.
the order id itself is unique and so can be used as invoice number, you can add creation date too and create invoice numbers like

20-2012
21-2012
22-2012

(this is a good practice because you know which invoice matches which order from the invoice id)

after this you have a pretty invoice view you can modify like you want and even use views_pdf or the print module to generate pdfs?

my question now is what is the advantage of this module compared to a view only like i described.

Advantageof entity

If the invoice date is important and is NOT the date of the day when the customer bought the product. meaning invoice date is 6.6.2012 and date of order is 1.1.2012. When you use a view only (without commerce_invoice) this is not possible

ñull’s picture

Yes e-anima, the only reason I use Commerce Invoice is for the pro-forma and final invoice distinction. The invoice becomes final when paid and in my country it should have consecutive numbering. The order number is the same as the cart id and so there are even unused order numbers which is totally unacceptable for local tax laws.

ñull’s picture

For those that have used my view, I now have an issue with it myself that I don't seem to be able to solve easily. I can only access it as administrator (user id 1). I tried to change several view permissions of the authenticated user, but nothing helps. It is displaying the view, because the header text is visible, but somehow all invoice information is inaccessible for anonymous users.

ñull’s picture

Meanwhile I found out what is causing it to be inaccessible for authenticated users. Apparently it all depends on the "Administer orders" permission. When I enable it for authenticated users, then they are allowed to see the invoice data, but that gives also access to the complete order list and information on all client orders.

The question is why it depends on this permission? Shouldn't the view be overriding that?

marcoka’s picture

i now created a view myself, inspired by yours and overwrote the path that is linked from the invoice tab. so i have my own view to customize with all stuff.

@null, i am located in germany and thought that the numbering has to be without consecutive numbering. turns out law only says "unique" here. but i prefer consecutive numbering too and thats why i use this here too.

and the advantage when using views is that the print module or the views_pdf module can be used to make pdfs.

ñull’s picture

e-anima:

i now created a view myself, inspired by yours

Did you manage to make it accessible for the authenticated user? Can you share the view here? At the moment I am trying to circumvent that problem without much success.

brianlp’s picture

I'd also be highly interested in that.

marcoka’s picture

im checking what null said, wait a minute :)
ok damn i know what you mean. i have the same problem

well lol...this explains it: http://www.root.artwaves.de/screensnapr/1339759174-9NPkxe.jpg
if a user is not admin there is always uid 0, thats wrong. i am checking the rule

marcoka’s picture

haha, fixed.
be sure to SET the order access permissions, otherwise well order data that is needed for invoice is not avaliable
image: http://www.root.artwaves.de/screensnapr/1339759610-PYcQtL.jpg

with that your view should work again. if you still want mine tell me again.

ñull’s picture

yes please share your view here too. Mine still has the same issue despite the extra permissions.

marcoka’s picture

my view

marcoka’s picture

StatusFileSize
new27.7 KB
Elementica’s picture

Title: Could the invoice be views based? » Could the invoice be views based or be customized via templates?
Version: 7.x-1.0-alpha2 » 7.x-1.0-alpha3

I'd like to know how invoice's layout could be customized... views could be a solution, but can it be achieved via standard templates?

ñull’s picture

e-anima, sorry to bother you again, but the view you shared was the list of invoices, not the invoice view itself.

silkogelman’s picture

I'm for having it Views based too.
That way we can generate PDF invoices together with the views_pdf module.

marcoka’s picture

s1l you can also just use the print module to generate a pdf. just style the page with css and print. done. look great

silkogelman’s picture

Thanks, I'm aware of the print module.
Views (and Views PDF) lets me do customization through a neat UI.

c-logemann’s picture

Title: Could the invoice be views based or be customized via templates? » How can views can be used for invoice views incl. theming and exported as PDF
Component: Code » Miscellaneous
Category: feature » support

The feature for building "invoice PDFs" is not needed because it can be done with views_pdf or the print module as described above. So first of all this is a "support request" and I think we can close this issue. I think some information about this should be placed in the documentation. I changed the title so this issue can better be found as part of documentation.

c-logemann’s picture

Title: How can views can be used for invoice views incl. theming and exported as PDF » How can views be used for invoice views incl. theming and exported as PDF?

fix the title

c-logemann’s picture

Status: Active » Closed (fixed)

close the issue

dready2011’s picture

I succesfully created a view for the invoice as well by importing the view from this post.

But what I would like to achieve as well, is that the output of this view is shown if the (admin/shopowner) user clicks on the invoice link that is under store/orders (/admin/commerce/orders). The link is something like
admin/commerce/orders/1034/invoice

where the parameter is the orderID. But the view from above takes an invoice ID as a parameter. I couldn't figure out how to change the view to take an order-ID as parameter, or use something like URL-Redirects...

any ideas on how to do this?

ibuildit’s picture

This works in alpha3!