-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Al 16/06/13 15:15, En/na Cédric Krier ha escrit:
> On 16/06/13 13:36 +0200, Sergi Almacellas Abellana wrote:
>>> Hi All,
>>> 
>>> We use a module called party_event [1] on which we store
>>> diferent kinds of events (emails, calls, etc) related to a
>>> party. We also several modules (electronic_mail*) for sending
>>> and storing emails. Now if we want to show emails on the
>>> party_event module we have to create a new row in party_event
>>> table with the information of the email, so we are storing
>>> duplicate information. To avoid this we tried to override the
>>> serach method of the party_event adding information of the
>>> emails module. I paste the code:
>>> 
>>> @classmethod def search(cls, domain, offset=0, limit=None,
>>> order=None, count=False, query_string=False): ElectronicMail =
>>> Pool().get('electronic.mail') res = super(PartyEvent,
>>> cls).search(domain, offset, limit, order, count, query_string) 
>>> mails = ElectronicMail.search(domain, offset, limit, order,
>>> query_string) for mail in mails: event = cls() event.type =
>>> 'email' event.event_date = mail.date event.subject =
>>> mail.subject event.description = mail.get_email event.party =
>>> mail.party event.resource = 'electronic.mail,%s' % mail.id 
>>> event.user = mail.create_uid res.append(event) print res return
>>> res
>>> 
>>> With this code the client is showing the rows generated from 
>>> electronic.mail module but they fiels are always blank.
>>> 
>>> Could you please give me some advice on how to show the records
>>> proberly?
> This can not work because RPC uses ids and not instance to
> communicate. And as search and read are two different calls run in
> different transaction the ids must refered to row in tables.
> 
> For me, the issue is in the design of party_event. It should not be
> a table filled by different kind of events but a view shown
> different kind of events coming stored in different tables.
That would make sense for me. What you understand for view? A view in
the database or a view in the tryton framework. For me would make the
view in the tryton framework, as new tables can be added from diferent
modules. Can this be achived with tryton framework?

- -- 
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJRvebgAAoJEGRfwiQCVal5WB8H/A67fdnRyUSuHdJCIzK4HWUj
Tva8ssTsv2ipyaFTWHdgNM9bQ7C57BXsibFNL3Wmok1difETHsocoLMR99G48hMJ
W+cQGB8nkOknr3JD5pxX/6LTYWzfA6fctTKN4ciesLSLww7iUXivd90bjBH8iMuE
NQQLLzrgx6EsxHM0WfFWFg49w3vgmWi8xOwkndYpTRqlhqm01M9oh7Ciz5w1Edyg
RXDNJWLIapdKE/lA2LV6O5HhNAJKkDFv6sVbJaqDbMa6CoikVZ4Oed1v18YKN12T
Xv1M9mrwcTvZ3fUWAvDxLfeplr5qI9nOmmQDVe500meBVJU1pa9AbDUJp6ldBmI=
=Ja5P
-----END PGP SIGNATURE-----

Reply via email to