Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How can I add the shipping address to invoice report?

By
Erick Dyck
on 9/3/13, 10:29 AM 4,064 views

Hey guys,

i have a problem with adding the shipping/delivery address from the sale_order to the invoice report. I already saw this post (link below) and edited the files as descripted, but it doesn't worked for me. Can someone please help me? I use openERP version 7. Best regards

Dyck

Link: help.openerp.com/question/10304/how-can-i-display-the-delivery-address-on-the-invoice

Hi, have you check in settings/sales/ check Allow a different address for delivery and invoicing.

le_dilem
on 9/3/13, 10:39 AM

Yes, this option is checked.

Erick Dyck
on 9/3/13, 10:43 AM

the delivery address is indicated on the order, no use to put in the invoice.

le_dilem
on 9/3/13, 11:50 AM
0
kaynis
On 9/3/13, 12:05 PM

You can create a module that inherits invoice and add the shipping address field to the invoice this way. After, you can edit the print out from invoice with Open Office report editor to include the field you just added. That should do it

        'deli_add': fields.many2one('res.partner.address', 'Delivery Address', select=True) add this to the columns of python code

and add to the form view of the module you want this field to show just after the invoice address field

        <field name="deli_add" />

this will give you your field and you will be able to select the shipping address but it will not auto fill when you select a client name. This should give you an idea of what you need to do.

Remember you have to reload the server when you make changes to .py files and upgrade when you make changes to the xml files for new changes to take effect

kaynis
on 9/3/13, 2:33 PM

Many thanks to you, that looks right :D I will check it tomorrow when I'm at work. Maybe it's the xml file, I forgot them. I will post tomorrow if it works or not.

Erick Dyck
on 9/3/13, 4:11 PM
0
Erick Dyck
On 9/3/13, 12:25 PM

I skipped the step to create a module and edited for testing the file addons/account/account_invoice.py. There I added this piece of code:

'partner_shipping_id': fields.many2one('res.partner', 'Delivery Address'),

Then I added following line in the account_print_invoice.rml:

<para style="tableAngebotContent">[[ display_address(o.partner_shipping_id) or 'No delivery address' ]]</para>

Now it's funny. Neither the street of the shipping address nor the text 'No delivery address' are visible. Is the code wrong or did I forgot something? Best regards

Dyck

this is a very wrong move because if you mess up a base module the application may not open properly anymore. would advise to build a module with inherited invoice view and add you field there. You have to understand that there is an on_change function on the address in the python code and you need to add the shipping address to be affected by this function. Thus, the on_change function of address in invoice module should also change the shipping address which will also affect the view. This is why it is better to create a module of your own to incorporate all this

kaynis
on 9/3/13, 1:17 PM

I know it's not good to edit base modules. How I already wrote, only for testing. The openERP is installed on a developmentserver, so if it crashes, who cares ;). For me, it's important to know, what is wrong with the code above. When I get it to work, then we do it the "clean way". But thanks for your answer.

Erick Dyck
on 9/3/13, 1:38 PM

Ok then. Firstly, I believe you need to make changes to the _view.xml file to make your field visible in a module on webclient. The xml file manages the view. If your field is not declared in the xml then you will not see it eg <field name="name" position="after"> <field name="partner_shipping_id"/></field> or something like that need to be somewhere in the xml form view. That determine where the field is displayed since you said you cannot see your field

kaynis
on 9/3/13, 1:56 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 9/3/13, 10:29 AM
Seen: 4064 times
Last updated: 3/16/15, 8:10 AM