This question has been flagged
8 Replies
3809 Views

I would like the invoices PDF reports not to display the default code of articles in the article's names.


On a PDF invoice :

Description

[REF TEST] Test

screenshot: https://ibb.co/VY1XZWd


As a comparison, on a sales quotation PDF reports, the default code of articles does not show :

Description

Test

screenshot: https://ibb.co/xGf2Tjt


I would like the same on invoices PDF reports


I'm using Odoo 11 Community Edition

Avatar
Discard
Author

I have updated my post with screenshots so it is easier to understand what I'm looking for

Best Answer

Simple :

find report_saleorder_document report into odoo reports menu.
find code of qweb report code <span t-field="line.name"/> replace it will <td><span t-field="line.product_id.name"/></td>

only report name will come.

This you can do from odoo front end also and create new module and inherit report_saleorder_document report into it and change code.

Avatar
Discard
Best Answer

Change From:

<td name="account_invoice_line_name"><span t-field="line.name"/></td>


Change To:

<td name="account_invoice_line_name"><span t-field="line.product_id.name"/></td>

Avatar
Discard
Best Answer

Hi,

this is because product ref and name are in the same field in sale.order.line model, like : 


'product_id': [152, '[LCLN1131-03] Maxi traversable 15 x 60 cm']

as @Bhaviraj Brahmkshatriya said, edit the report template and use a regex to remove the brackets and its content


Avatar
Discard
Author Best Answer

Thanks Bhaviraj !

So I tried what you said:

Under report_invoice_document, I changed the line:

<td><span t-field="l.name"/></td>
By:
<td><span t-field="l.product_id.name"/></td>

See here: https://ibb.co/7bjn7r6

After reloading Odoo under a private window and printing a PDF invoice, here is the result: https://ibb.co/LxYTKjC

So I still have the default_code appearing inside [] brackets. I would like it to disappear. Any idea why it didn't work?

Avatar
Discard

It works fine as i checked, But make sure, report is not loading from attachment. as report configuration is there, which gives options that old reports which are printed load from there.

Author

When I click on Print invoice: https://ibb.co/PTYV3xb

When I click on invoice under attachement: https://ibb.co/G5PSCM8

It is the same, default_code inside [] brackets is still here.

Are you sure you checked for report_invoice_document ? Because in your first answer you were talking about report_salesorder_document