This question has been flagged
43 Replies
45087 Views

I would like to have multiple layouts on the invoice. Under the print button you get 'invoices' I would like to see more choices of custom made layout invoices.

Something like [PRINT] - invoice std - invoice special - invoice foreign Where the names are also custom depending on the layout.

We use the delivery address as a location reference so this should be printed on the invoice in some cases.

Is this possible ? If so how do I do this ?

PS. I have tried the OpenOffice template editor module but this ruined my openerp-print-invoice.

Avatar
Discard
Best Answer

Note: Make sure you have administration privileges and in user Access Rights you have Technical Features checked.

You need the following:

  • A new/modified/existing RML invoice template that should be saved in addons/account/report or anywhere you like.
  • a new Report Action
  • and an Action Binding for it.

Report Action

  • Go to Settings->Technical->Actions->Reports and search for invoice
  • click the More drop down list and select Duplicate to create a new identical entry, all you have to change is the Name and the Report File location

Action Binding

  • Go to Settings->Technical->Actions->Action Bindings
  • Again look up invoice
  • Duplicate it the same way you did for the report, but in Action (change only) write the name of the new report you just created earlier.

You are done, you will now have 2 options in the invoice Print drop down list.

You can have as many reports as you like and this works for all other types of reports, not just invoices.

PS: Make sure that the Action Binding for the new Report has the Qualifier set to client_print_multi

Update: You need a report python file to define the report service, this is an example for a secondary invoice report:

import time

from openerp.report import report_sxw

class account_invoice_secondary(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context=None):
        super(account_invoice_secondary, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            'time': time, 
        })

report_sxw.report_sxw( 'report.account.invoice.secondary', 'account.invoice', 'account/report/account_invoice_secondary_report.rml', parser = account_invoice_secondary )

Make sure to configure your report to have the service name account.invoice.secondary

name your file account_invoice_secondary_report.py and put it in account/report/ and lastly, import it in accounts/report/__init__.py

Restart your server and it should work.

Avatar
Discard

Hi, just wondering how you sorted it out. I followed step by step the whole procedure, and still the same first rml report is used, whatever the line i am using in the Print drop down list.

Did you change the Report File field in your new report? Because it should be different from the default one.

Yes, this was the first field value changed. Does it work on your side with two different Report files ?

It should, is your server on a Windows machine?

Nope, this is a Linux one

Hello. Looking now to the script from the module, i seems the module is able to process only one single entry (the first one) within the Settings - Technical/Actions/Reports record set. Hence, it cannot work the way i was expecting. And the only way i can imagine now is to manage the Security tab so that i make sure that a User can "see" only one entry within the set, and so should the expected behavior be ensured.

Did you make sure that the corresponding Action Binding has the Qualifier set to client_print_multi ?

Yes, i did. As i am not able to illustrate the module script which keep the only first occurrence for processing, there is nothing much i can provide, else than a suspicion on the script from the module. Thanks.

I have followed your instructions to the letter, but I still have only one option under my dropdown. I am using Windows, does this work differently for this OS?

It should work for Windows, please make sure that the Action Binding for the new Report has the Qualifier set to client_print_multi

Well I tried numerous times but haven't got it set up yet. :(

To recapitulate, there are two things which I am not entirely certain of; based on your description. For "Action Bindings" you say "look up Invoice"; do you mean the binding "Invoice" (account.analytic.account) or "account.invoice" (account.invoice)? [I already tried both, but want to be sure now]

Also for the "Action (change only)" field, I am not sure if I did it right. I made a new record with: Name = account_print_invoice_FR.rml, Type of action = ir.actions.report.xml. Do I need to select an existing record, which one?

I already had the qualifier set to client_print_multi, as you recommended higher up in the thread.

UPDATE: I can't edit the above comment, but I figured I should use "ir.actions.act_window" as type for the action instead of what I specified earlier. I also guess I should use "Invoice" (account.analytic.account), rather than "account.invoice"; because otherwise it will result in view errors on the invoices. HOWEVER: it still doesn't work. :/ I can't figure out what I'm doing wrong, as I've done it over 10 times by now - and am convinced my settings appear to be configured correctly.

What is the name of the report you are trying to print?

currenrtly invoiceFR.rml

I tried this solution and It worked perfect for me!

Many, Many thanks for your answer Karim!

If anybody want to know my exact steps please let me know.

With Kind regards,

Michael Bos

Ps. I made a brand new incoming shipment document, with print options and all.

the same like the old report, Kindly Michael let me know how i can do it

thanks it works for me

I have two invoices: have account_print_invoice.rml and account_print_invoice_new.rml I duplicated invoice records in Reports and Action Bindings. The name in Reports is Invoice New and Report File is account/report/account_print_invoice_new.rml The name in Action Bindings is Invoice New and Action Reference is ir.actions.report.xml,334 – which links to Reports / Invoice New. There are two options under Invoice / Print button: Invoice and Invoice New, which is correct. The PROBLEM is both print account_print_invoice_new.rml. I can not print the default account_print_invoice.rml anymore. Why???

I have the very same problem as 62552; both print the same form; I am using v7 for Windows and just cant figure out WHY!

same problem with 62552, 57672, I'm using ubuntu 12.04 , openerp v7. Anyone know how to solve this?

This is really nice solution but i got a problem (Report has not been downloaded Detail: URL seems to be an unsupported one) when i try to modify new report through openoffice (modify existing report).

Michael Bos let us know how do yo do it?

I am sorry for my late reaction. I am not nearby a real computer untill the weekend. I will then post this as a solution. Thank you!

Hello Thanks it's work for me , but the problem in traslation i can not translate my second invoice which directory is same as invoice directory

Best Answer

hi all,

we spent a lot of time figuring out how to make multiple layouts working. finally we did it and we wan't to share our experiences with you.

for a detailed documentation about creating multiple sale order layouts have a look at the following link. this documentation may also be used to create other additional layouts/reports.

10 seconds later: when trying to post this answer I received: "Could not post, because your karma is insufficient to publish links"

therefore: please go to www.onestep2.at/en -> Support -> Knowledge database -> OpenERP - FAQ -> OpenERP7 - Multiple sale order, invoice layouts, reports

we used a lot of images for documentation purposes. therefore we're not able to do a simple copy/paste to this forum.

direct link to the documentation article at oneStep2: www.onestep2.at/en/forum/openerp7-multiple-sale-order-invoice-layouts-reports

kind regards, sandra oneStep2

Avatar
Discard

Thank's Sandra. I follow your steps but when I duplicate the action binding I can't see the action (change only) previusly created. I don't have Quotation / Order / Other_layout because It isn't an action it's an action report. Thanks in advance

Hi, yes, it is an action, but it can be selected if you have previously created this new report...did you follow step by step our documentation?

Hello Thanks it's work for me , but the problem in traslation i can not translate my second invoice which directory is same as invoice directory

Best Answer

I created a step by step guide with screenshots on how to do this using Odoo v8. I struggled with this for a long time (being new to Odoo myself) and I hope this guide will help save others the same frustration I went through.

 

Here's the guide to Create Multiple Invoice Templates in Odoo v8:
http://www.askmpa.com/creating-multiple-invoice-templates-in-odoo-v8/

Avatar
Discard

link is dead

Still working here, Pascal: http://www.askmpa.com/creating-multiple-invoice-templates-in-odoo-v8/ Is there an error you're getting?

Best Answer

Friends i too faced the same problem and got a solution. 

We can create a duplicate invoice from the existing one. check this link : http://www.askmpa.com/creating-multiple-invoice-templates-in-odoo-v8/

Thank you and Enjoy

Avatar
Discard
Best Answer

I have noticed that when you use the default invoices, it will be translated into the language of the language you have defined the user. I have not checked what will happen if you have a customer/company in language A and the invoice address is with someone in language B.

I expect that it will use the language depending on whom you send the various reports/orders.

In order for the documents to be translated, you have to load / import the appropriate language.

Settings -> Load a Translation.

After this, you can specify another language on the user, so the system might try to translate (using strings in the database, don't expect magic) the standard documents.

If you have customized documents and/or modified text, you have to add those strings to the database as well. I have not done that yet, so I cannot give you any answers/hints regarding this issue.

Avatar
Discard

This is really a nice tutorial but I got problem (Report has not been downloaded Detail: URL seems to be an unsupported one) when I tried to modify new report through openoffice(modify existing report). I just copy purchase_requisition.rml file and paste somewhere else and rename this file comparative_statement.rml and again paste this file in report folder of purchase requisition and follow the procedure that you have mentioned above, now I am able to see two option under print button both are working but my question is how to modify new report comparative statement?

Hello Thanks it's work for me , but the problem in traslation i can not translate my second invoice which directory is same as invoice directory

Best Answer

Thanks for this great enhancement How can I print customer detail on POS Receipt/tickets

Avatar
Discard
Best Answer

I have two invoices: have account_print_invoice.rml and account_print_invoice_new.rml I duplicated invoice records in Reports and Action Bindings. The name in Reports is Invoice New and Report File is account/report/account_print_invoice_new.rml The name in Action Bindings is Invoice New and Action Reference is ir.actions.report.xml,334 – which links to Reports / Invoice New. There are two options under Invoice / Print button: Invoice and Invoice New, which is correct. The PROBLEM is both print account_print_invoice_new.rml. I can not print the default account_print_invoice.rml anymore. Why???

I can confirm this bug is lasting for months ... The two reports print the same thing, when they're created as explained by Karim

Avatar
Discard

prueba modificando los ficheros: __init__.py y account_print_invoice_new.py

Hello Thanks it's work for me , but the problem in traslation i can not translate my second invoice which directory is same as invoice directory

Best Answer

It is not that much complex to define multiple invoices for the invoice, you might not have seen https://www.odoo.com/apps/7.0/l10n_in_tax_retail_invoice/ module that already support printing of multiple invoices with configuration. of course if your own custom format installed it will detect and print up on the configuration

May be it is not direct solution but it gives you best example to keep and print invoices in multiple layouts.

Avatar
Discard
Best Answer

I found this article for Odoo 8 using multiple QWeb reports: http://odoo.guide/multiple-report-layout-step-by-step/

It worked for me in testing environment. But I'm not sure if one should use direct table manipulation via SQL statements in production systems.

Avatar
Discard