It is currently Tue May 22, 2012 11:24 pm

All times are UTC + 2 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: [SOLVED] Show related record from other object
PostPosted: Wed Jun 01, 2011 5:26 pm 
Offline

Joined: Thu Mar 10, 2011 4:30 pm
Posts: 145
Hi, I try to customize openerp to my business.

The concept example:
I need object to store info about my projects-works.
So I make an object named x_project and all the related fields.

In addion I need an object task to store task info.
So I make an object named x_task and all the related fields.

But any task related to some project.
So I make a field (x_project_of_task) to object x_task to relate the task to project. I use many2one field type and the appropriate object (x_project) to relation objet. So all work OK.

That I need is to view-access all the tasks of one project from the project view-form. I try some cases but I have problem. I use many2manh relationship but with this method I need to choose task from the project view, not automatically view the tasks of the certain project.

Some help on this?


Last edited by tarasiadis on Thu Jun 16, 2011 10:55 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Show related record from other object
PostPosted: Thu Jun 02, 2011 3:41 am 
Offline

Joined: Wed Jan 27, 2010 6:21 pm
Posts: 797
Location: Auckland, NZ
if a task is only related to one project then you should be using

one2many in project class and many2one in task class.

_________________
Graeme


Top
 Profile  
 
 Post subject: Re: Show related record from other object
PostPosted: Sun Jun 05, 2011 9:48 pm 
Offline

Joined: Thu Mar 10, 2011 4:30 pm
Posts: 145
Thanks for your answer.
OK a task is only related to one project so I am using one2many in project class and many2one in task class. Then I add the field to project view to present the task list of project and when I edit or create a new project, a warning raised as below:
---
Warning
Traceback (most recent call last): File "netsvc.pyo", line 489, in dispatch File "service\web_services.pyo", line 599, in dispatch File "osv\osv.pyo", line 122, in wrapper File "osv\osv.pyo", line 176, in execute File "osv\osv.pyo", line 167, in execute_cr File "osv\orm.pyo", line 2940, in read File "osv\orm.pyo", line 3060, in _read_flat File "osv\fields.pyo", line 474, in get TypeError: coercing to Unicode: need string or buffer, list found
---
So I can't check I I make something whong. Maybe because when I remove the field from view all are OK.

Please some help to solve my prob.
Thanks.


Top
 Profile  
 
 Post subject: Re: Show related record from other object
PostPosted: Mon Jun 06, 2011 6:44 am 
Offline

Joined: Wed Jan 27, 2010 6:21 pm
Posts: 797
Location: Auckland, NZ
At a geuss you haven't reinstalled your module. Or you are pointing your relations to the wrong place. Basically the error means that some field in your view is expecting a string, but is receiving a list. One2many relations are in essence lists. But your module wants a string.

_________________
Graeme


Top
 Profile  
 
 Post subject: Re: Show related record from other object
PostPosted: Mon Jun 06, 2011 9:54 am 
Offline

Joined: Thu Mar 10, 2011 4:30 pm
Posts: 145
I hve not install any custom module. I just create my objects from admin panel, then I edit them and I create fiels for any object. I sthat method wrong? The only right method is to create new custom module?


Top
 Profile  
 
 Post subject: Re: Show related record from other object
PostPosted: Mon Jun 06, 2011 10:12 am 
Offline

Joined: Wed Jan 27, 2010 6:21 pm
Posts: 797
Location: Auckland, NZ
Sorry I don't know, most people don't try to create anything involving relations from admin interface and prefer custom modules.

_________________
Graeme


Top
 Profile  
 
 Post subject: Re: Show related record from other object
PostPosted: Mon Jun 06, 2011 11:14 am 
Offline

Joined: Thu Mar 10, 2011 4:30 pm
Posts: 145
OK I try something like http://openerp.tv/display.php?rnd=NDk=
and it seems to works.
I will try to create a new module. Thanks.


Top
 Profile  
 
 Post subject: Re: Show related record from other object
PostPosted: Thu Jun 16, 2011 10:55 am 
Offline

Joined: Thu Mar 10, 2011 4:30 pm
Posts: 145
OK I try to develop a module from start, with its class, view etc and all is ok.
Thanks for help.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 2 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:

Protected by Anti-Spam ACP