Skip to Content
Menu
This question has been flagged
2 Replies
3735 Views

Hello odoo Family,



I am really new to odoo and qweb but I have to modify the standard account.invoice report for our company. I am familiar with HTML, so qweb itself is not a problem, however I really struggle with implementing additional data to the report. We use odoo version 9.0e.


This is my situation:

We have several warehouses in odoo. Each of them has a unique image (logo) attached to it's address (res.partner?). This logo should also appear in the account.invoice report when the products of that report are linked to that specific warehouse.

I think I'm doing something terribly wrong here, but this what I have so far:

<img t-if="o.invoice_line_ids[0].product_id.warehouse_id.partner_id.image" t-att-src="'data:image/png;base64,%s' % o.invoice_line_ids[0].product_id.warehouse_id.partner_id.image" align="right" style="max-height: 20px;"/>I don't think that I can load the stock model that easily in qweb's account.invoice model? I am only using the first product of the report to identify the warehouse because this always works in our environment.

So my initial question here is:

How can I get the image of the warehouse of the first product in the report?




The second thing is the following:

How can I get the shipping address and the billing address of the specific order. Everything I tried din't work out as expected and I get despaired of this more and more...


Best reagards,


Timo

Avatar
Discard
Best Answer

I'm using v10 and currently working on creating account_invoice report. Regarding your 2nd question here is a piece of code that puts billing address in my report:

<div class="col-xs-6">        							
    <strong>Billing Address:</strong>
    <div t-if="o.partner_id.parent_id">
        <span t-field="o.partner_id.parent_id"/>
    </div>
    <div t-field="o.partner_id.name"/>
    <div t-field="o.partner_id.street"/>
    <div t-field="o.partner_id.street2"/>  
    <div>
        <span t-field="o.partner_id.city"/><span t-if="o.partner_id.state_id.code">, </span><span t-field="o.partner_id.state_id.code"/> <span t-field="o.partner_id.zip"/>
    </div>
    <div t-if="o.partner_id.country_id.code != 'US'">
        <span t-field="o.partner_id.country_id"/> </div>
    <div t-field="o.partner_id.vat"/>
</div>

it takes address from 'res.partner' form.

But I'm having a problem with the shipping address. For some reason it puts exactly the same info as in Billing address. So my billing address = shipping address now.

However, here is a code that works for the shipping address in v8:

<div class="col-xs-6" t-if="o.address_shipping_id">							
    <strong>Shipped Address:</strong>
    <div t-if="o.address_shipping_id.parent_id">
        <span t-field="o.address_shipping_id.parent_id"/>
    </div>
    <div t-field="o.address_shipping_id.name"/>
    <div t-field="o.address_shipping_id.street"/>
    <div t-field="o.address_shipping_id.street2"/>  
    <div>
        <span t-field="o.address_shipping_id.city"/><span t-if="o.address_shipping_id.state_id.code">, </span><span t-field="o.address_shipping_id.state_id.code"/> <span t-field="o.address_shipping_id.zip"/>
    </div>
    <div t-if="o.address_shipping_id.country_id.code != 'US'">
        <span t-field="o.address_shipping_id.country_id"/>
    </div>
</div>

 double check the IDs, because 'address_shipping_id' doesn't exist in v10 and I'm not sure if it does in v9.

Hope it'll help.

Avatar
Discard
Author Best Answer

To be honest I can't find a customer invoice form, I guess you mean the account.invoice form. There doesn't appear anything at all unfortunately :-(.


I am really confused right now...


Best regards,

Timo

Avatar
Discard

I created a custom module just to create this report. For my shipping address I used 'partner_shipping_id', which I guess exists in v9.

<div t-field="o.partner_shipping_id.name"/>

<div t-field="o.partner_shipping_id.street"/>

<div t-field="o.partner_shipping_id.street2"/>

<div t-field="o.partner_shipping_id.street3"/>

<div>

<span t-field="o.partner_shipping_id.city"/><span t-if="o.partner_shipping_id.state_id.code">, </span><span t-field="o.partner_shipping_id.state_id.code"/> <span t-field="o.partner_shipping_id.zip"/>

</div>

But still my both addresses are the same on the report. I think I'm using wrong IDs.

What exactly you don't know how? How to add shipping address to your report or create a module?

So to make things work I went to Sales->Configuration->Settings and in Quotation and Sales I switched from Invoicing and shipping addresses are always the same (Example: services companies) to Display 3 fields on sales orders: customer, invoice address, delivery address

After you made those changes in the sales settings it added a "Delivery Address" to Customer Invoice form. Hover over that field in the developer mode and look at its id. What does it show?

@T. Gundacker, in v10 you can get to this form in several ways: 1) Accounting module -> Sales menu -> Customer invoices -> Create new; 2) in developer mode in the drop-down box click on Open View then in the search box type in "account.invoice.form" and you will see the list of views, click on the one with the "account.invoice_form" external ID and it will open this form for you. After that you'll be able to see the id of "Delivery Address" field.

I'm sure in v9 it's pretty similar.

Related Posts Replies Views Activity
0
Apr 24
329
1
Aug 23
2757
2
Apr 18
17875
4
Aug 17
20048
1
Oct 15
5649