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

I'm new to Odoo, so I want to hear suggestions from you guys please. 

For some reasons we want to add supplier's name to our sale order (and potentially more fields from the purchase module), how can I do that?  

I was trying to do it from the GUI, so I went to Settings-->Technical-->Database Structure-->Models (sale.order), added a field called x_Supplier, set it to Many2One, set Object Relation to res.partner.

Could some of you experienced users let me know what am I missing?

Thanks in advance!

Avatar
Discard
Best Answer

Hi,

To add a field to a Qweb view from the GUI, you should go to Settings/Technical/Reports/Reports and then :

  • Search for 'sale.order' report,

  • Click on the link "Search for Qweb Views",

  • Open the view named : report_saleorder_document,

  • In the view, choose th place you want to insert your new field (x_Supplier)

  • For example, to insert it after  the Saleperson name, add this code after the div of Salepersonn

<div t-if="o.x_Supplier" class="col-xs-3">
            <strong>Supplier:</strong>
            <p t-field="o.x_Supplier"/>
</div>
  • Save the view.

  • Test by printing a Sale order .

Hope it helps

Avatar
Discard
Author Best Answer

Thank you Laurent OLIVIER.  I've tried that, but it did not work..  

I wanted to add next to the product description in the table, so I did below:  

When I tested it, the Supplier header showed up, but it's blank.  I guess the o.x_Supplier didn't work?

<table class="table table-condensed">                
<thead>
    <tr>
        <th>Description</th>
        <th>Supplier</th>
.
.
.
.
<tbody class="sale_tbody">
<tr t-foreach="o.order_line" t-as="l">
    <td>
    <span t-field="l.name"/>
    </td>
    <td>
    <span t-field="o.x_Supplier"/>
    </td>
Avatar
Discard

If the header shows up, it means that the field is correctly defined in the sale order.

But you try to print it in the sale order line.

How do you set the value of this x_Supplier field ? Is it in the sale order form view ?

Author

It is not in the sale order form view. Here's how I set x_Supplier:

Field Type: Many2One (I'm not sure if this is correct)

Object Relation: res.partner (not sure if this is correct either)

Related Posts Replies Views Activity
2
Nov 24
477
4
Feb 24
10166
1
Jan 24
370
2
Aug 23
1242
1
Jul 23
1272