Odoo Help


Customer reference on Deliver Products tree view (V.7)?

on 10/5/15, 10:45 AM 769 views


Is it possible to add the sales order Customer Reference (client_order_ref) to the Deliver Products tree view on the Warehouse menu using the Edit TreeView option?

On the stock_move table there is a reference to the sales order line - sale_line_id and on the sales order line table there is a reference to the sales order header - order_id where the Customer reference is.  Is it possible to retrieve data from a parent table?

Thanks for any help.


Akhil P Sivan

--Akhil P Sivan--

| 5 4 7
Kochi, India
--Akhil P Sivan--

Interested in exploring Odoo both technically & functionality wise.

email-id : akhilpsivan01@gmail.com

Akhil P Sivan
On 10/5/15, 12:33 PM


Please try like this in your custom module:

in your py file:

from openerp.osv import fields, osv

class stock_move(osv.osv):
_inherit = 'stock.move'
def _get_customer_ref(self, cr, uid, ids,field_name, args, context=None):
sale_orders = self.pool.get('sale.order')
sale_order_line = self.pool.get('sale.order.line')
res = {}
for move in self.browse(cr, uid, ids, context=context):
sale_line = sale_order_line.browse(cr,uid, move.sale_line_id.id, context=None)
order = sale_orders.browse(cr,uid, sale_line.order_id.id, context=None)

res[move.id] = order.client_order_ref
return res

'customer_ref':fields.function(_get_customer_ref, type="char", string="Customer Reference")

in your xml file:


<record id="view_move_tree_reception_picking_inherited" model="ir.ui.view">
<field name="name">stock.move.tree2.inherited</field>
<field name="model">stock.move</field>
<field name="inherit_id" ref="stock.view_move_tree_reception_picking"/>
<field name="arch" type="xml">
<field name="origin" position="after">
<field name="customer_ref"/>


Hope this helps you.

How would this change for Odoo 9, as the above does not work and gives the Error details: Field `Customer_ref` does not exist?

Nigel Butler
on 3/8/16, 9:44 AM

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.


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

2 follower(s)


Asked: 10/5/15, 10:45 AM
Seen: 769 times
Last updated: 10/5/15, 12:33 PM