Odoo Help

Welcome!

This community 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.

1

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

By
Kevin
on 10/5/15, 10:45 AM 358 views

Hi,

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.

1

Akhil P Sivan

--Akhil P Sivan--
3423
| 5 3 6
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

Hi,

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
_columns={

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

in your xml file:

<openerp>
<data>


<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"/>
</field>
</field>
</record>

</data>
</openerp>

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

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