Odoo Help

0

field.related for country

By
Shokri Alnajjar
on 8/19/14, 8:39 AM 934 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--
3218
| 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

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: 8/19/14, 8:39 AM
Seen: 934 times
Last updated: 3/16/15, 8:10 AM