Odoo Help

0

Odoo 8: How do I add supplier to a sale order, the pdf file (QWeb)?

By
matrix
on 11/29/16, 5:44 PM 367 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!

2
Laurent OLIVIER
On 11/30/16, 4:06 AM

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

0
matrix
On 11/30/16, 1:23 PM

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>

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 ?

Laurent OLIVIER
on 12/1/16, 12:45 AM

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)

matrix
on 12/1/16, 1:08 PM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 11/29/16, 5:44 PM
Seen: 367 times
Last updated: 11/30/16, 11:25 PM