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.

0

field.related for country

By
Shokri Alnajjar
on 8/19/14, 8:39 AM 732 views

I'm trying to add a many2one coulumn in stock.picking that refers to res.country

class stock_picking(osv.Model):

    _inherit = 'stock.picking'

    _columns = {

                       'x_country':fields.many2one('res.country','Country of Origin'),

}

and display the user's selection in stock.move with related field 

'x_country':fields.related('picking_id', 'x_country', type='char' ,relation='stock.picking', store=True, string='Country of Origin'),

but the system is displaying this  browse_record(res.country,12) instead of the country name 

any solutions ??

2

Prakash

--Prakash--
3173
| 5 4 7
Bikaner, India
--Prakash--

OpenERP Devloper at SunARC Technology

Prakash
On 8/19/14, 8:45 AM

Change your code type char into many2one

'x_country':fields.related('picking_id', 'x_country', type='many2one' ,relation='stock.picking', store=True, string='Country of Origin')

thanks man , i had to change the type and relation and it worked

Shokri Alnajjar
on 8/19/14, 9:05 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

1 follower(s)

Stats

Asked: 8/19/14, 8:39 AM
Seen: 732 times
Last updated: 3/16/15, 8:10 AM