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. -- Cédric Krier B2CK SPRL Rue de Rotterdam, 4 4000 Liège Belgium Tel: +32 472 54 46 59 Email/Jabber: [email protected] Website: http://www.b2ck.com/
pgpEka7hiUGUJ.pgp
Description: PGP signature
