This question has been flagged
5 Replies
19165 Views

I am looking for a way to display the delivery address on the invoice layout. So far everything I've tried through the report editor isn't working as intended. I have tried referring to the o.sale model, but it seems the values can not be found.

I have come across many posts describing a similiar problem. I'll refer to the links below to ask my question.

Is there a module for v7 which I can install/find and use to display the Delivery Address on my invoices? Or do I have to write my own code, like suggested in the last link?

I'm a bit of a novice at writing code, so before I get started on this - I just wanted to inform if there was a quciker/better way to accomplish this?

A reference to the Sale Address Multi Partner module

The Module for 6.1

An answer to a problem similar to mine, involving writing code arround self.pool.get('res.partner').address_get

Avatar
Discard
Author Best Answer

I settled for a work-arround. I used the note-field to display my delivery address, and change it's position and format using the OpenERP report designer. It sounds rather crude, but it actually works quite well.

I'll update my answer with a screenshot later. Either way, I "fixed" this problem.

Avatar
Discard
Best Answer

I created issue #2421 (https://github.com/odoo/odoo/issues/2421) and pull request # 2380 (https://github.com/odoo/odoo/pull/2380) to resolve this for v8.

Avatar
Discard
Best Answer

Hi

I solved it like that:

created a custom field in account_invoice table like that:

class account_invoice(osv.osv):

_inherit = 'account.invoice'
_name = 'account.invoice'

_columns = {
  'x_shipping_id': fields.many2one('res.partner', 'Shipping Address'),
}

and then send field-value to invoice when invoice is created like that:

class sale_order(osv.osv):

_name = 'sale.order'
_inherit = 'sale.order'

def _prepare_invoice(self, cr, uid, order, lines, context=None):

    res = super(sale_order, self)._prepare_invoice(cr, uid, order, lines, context=context)
    res.update({
               'x_shipping_id': order.partner_shipping_id.id,
               })
    return res

finally the shipping-address can be added easely on invoice-report

Avatar
Discard

This is almost exactly what http://v6apps.openerp.com/addon/6739 does - I think I like you version better.

Hello René, I went through your code but i did not get that where exactly i have to write this code and where exactly have to create file - sale_order . Please elaborate your ans in detail as I am new to openerp and python . Actually I created an additional field and successfully display on Quotation and Sale Order but not able to display on Account Invoice . Field is selection field F.Y.I I am using Openerp v7 . Please help me to display my additional field on invoice

Best Answer

HI, you can try this: lp:~scigghia/account-invoicing/adding_account_invoice_shipping_address_7

Avatar
Discard
Best Answer

When you go to the settings of openERP, at the option 'Sales' (under Configuration) you can tick the option 'Allow setting a discount on the sales order lines'. This allows you to specify different delivery address for an order, but by default it will give the same address as the address of the customer.

Avatar
Discard
Author

I'm sorry but I fail to see the correlation between allowing discounts, and being able to display my delivery address in the Invoice form. I still tried your method though, but all I gained was the field in which I can configure a discount per invoice/order-line.

To clarify: I can already choose an invoice- and delivery-address in my quotations and orders. I have accomplished this by activating the option to have a different invoice- and delivery-address under Settings --> Sales.

What I can not do is show this delivery address, which is showing on my quotations perfectly, on the invoices

Sorry I misunderstood your question. Thought you needed to display the different addresses. I also copied the wrong line, it had to be something you found on the same page, talking about different addresses.