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

Hello, 


is there a way to modify the quotation and invoicing to hide the parent company?

default view: "Parent Company, Customer Name"

I need it to be something similar to this:  " Customer Name" 

                                                                          " Parent company, shipping address" 


is there a way to do it? 


Thanks.

Avatar
Discard
Author

Forgot to mention , I need this modification for the PDF report, the model it self I have no problem, with the design

Best Answer

This should get you far enough along to make it work.

sale.report_saleorder_document is the report you want to inherit and override for changing the way the Customer (Partner) is shown.


The QWEB directive that prints the Customer information is:

<div t-field="doc.partner_id" 
t-options="{'widget': 'contact', 'fields': ['address', 'name'], 'no_marker': True}"/>


By default Odoo will show Company, Customer with the address - that's how the template for the widget is defined.

There are two changes you will need to make:

1. Remove the name field from the fields key.  This shows the address WITHOUT the name.

<div t-field="doc.partner_id" 
t-options="{'widget': 'contact', 'fields': ['address'], 'no_marker': True}"/>

2. Show the specific name(s) of the Customer.

<div t-field="doc.partner_id.name"/>
<div><span t-field="doc.partner_id.company_name"/>:</div/>

For a final result of:

<div t-field="doc.partner_id.name"/>
<div><span t-field="doc.partner_id.company_name"/>:
<span t-field="doc.partner_id"
t-options="{'widget': 'contact', 'fields': ['address'], 'no_marker': True}"/>


Note that the quote characters have to be escaped - you will see this in the original Odoo XML, with the original QWEB snippet looking like this:

<span t-field="doc.partner_id" 
t-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;], &quot;no_marker&quot;: True}"/>


Your finished report would then look like this:



Avatar
Discard
Author

Thanks Ray for you detailed answer, I followed your instructions,

as below

[code]

<div class="col-xs-5 col-xs-offset-1">

<div t-field="doc.partner_id.name"/>

<div><span t-field="doc.company_name"/>

<span t-field="doc.partner_id" t-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;], &quot;no_marker&quot;: True}"/>

<p t-if="doc.partner_id.vat"><t t-esc="doc.company_id.country_id.vat_label or 'TIN'"/>: <span t-field="doc.partner_id.vat"/></p>

</div>

</div></div>

[/code]

but for some reason I get an error while trying to print the report. your help is appreciated.

doc.partner_id.company_name - not doc.company_name. This was my fault, I've updated my post. Each time you get an error, look at the bottom of the traceback and you will see what the problem is.

Author

Thanks Ray I really appreciate your help..

,, I'm almost there ,, bear with me plz..

so now the end result came

Client Name

*Company name is missing * :

Address

so I believe something wrong with

<div><span t-field="doc.partner_id.company_name"/>:

Thanks a lot

I just tried again and if the Company Name is blank, it could be because the Customer doesn't belong to a Company (has no parent_id). Is your CLIENT an Individual that shows below the COMPANY when you open the COMPANY Customer record?

Author

yes,

when I access the company profile from " Contacts Module" I see the client name in the bottom of the Company with the rest of clients under the same company

Can you export the COMPANY and CLIENT records and post the values? Choose these fields: Name, Company Name, Display Name, Address Type, Company Type, Related Company, Parent name, Is a Company, Commercial Entity and Company Name Entity.

Author

Hello Ray,

please find this picture , contains the details,

https://imgur.com/a/rRA6meW

for some reason, company_name is empty, this is why it doesn't show in the report, although this person is already added under this parent company :/

https://imgur.com/a/rRA6meW

is there a way to fill the company_name from odoo? or I just do it in Excel and re-import them again?

Regards,

Enter both into Odoo via the UI, then export in the same way so you can see which of these fields Odoo expects to have values. Then, make sure your import sheet matches the export.

Author

Thanks a lot Ray, I'm sure fixing this missing cell ( Company_name) will solve the problem.

sorry for all the hassle :)

I'll do the same steps for invoice too ,, much appreciated !

Author

Just tried it ! 100% Thanks again Ray!