IRC logs of #tryton for Saturday, 2012-05-12 #tryton log beginning Sat May 12 00:00:02 CEST 2012
2012-05-12 11:45 -!- __efx__( has left #tryton
2012-05-12 14:34 <__efx__> hello, I want to copy an entry in the database using proteus is it possible ?
2012-05-12 14:35 <__efx__> I tried something with the deepcopy but I have problem with the id field
2012-05-12 14:36 <cedk> __efx__: use copy method of Model
2012-05-12 14:39 <__efx__> cedk: thank you
2012-05-12 14:52 <__efx__> cedk: I tried to copy a party like that, Party = Model.get('') parties = Party.find() party = Party.copy(parties[0].id)
2012-05-12 14:54 <__efx__> and I get a int is not itterable error, I thus tried to replace Party.copy(parties[0].id) by Party.copy([parties[0].id]) and it says that it needs 2 arguments
2012-05-12 14:56 <__efx__> and this way it works Party.copy(party[0].id,party[0]._fields)
2012-05-12 16:20 <cedk> __efx__: copy takes a list of ids
2012-05-12 16:21 <cedk> __efx__: oops, no copy can also work with single id
2012-05-12 16:21 <cedk>
2012-05-12 16:22 <cedk> __efx__: you must pass the context to copy
2012-05-12 16:26 <__efx__> what is "the context"
2012-05-12 16:26 <__efx__> ?
2012-05-12 16:31 <cedk> __efx__: it is a dictionary that define the execution context
2012-05-12 16:32 <__efx__> the result of config.set_trytond(...
2012-05-12 16:32 <__efx__> ?
2012-05-12 16:34 <cedk> __efx__: the proteus config contains a default context
2012-05-12 16:37 <__efx__> cedk: and how do I access to the context
2012-05-12 16:37 <__efx__> because for now I can copy only like that Party.copy(, my_party._fields)
2012-05-12 16:38 <cedk> __efx__: most of the time just: config.context is enough
2012-05-12 16:40 <__efx__> cedk: ok thank you again :) so this is correct Party.copy(parties[0].id,config.context)
2012-05-12 16:42 <__efx__> I try to copy a simple patient (that has only a sex and a link to a party, the 2 required fields) but I got a Validate Error on a model that has a one to many relation to patient
2012-05-12 16:44 <__efx__> I tried to add a required=False in the field that causes the validate error but still the same problem
2012-05-12 16:45 <__efx__> does anyone has an idea of why I have this problem?
2012-05-12 16:46 <cedk> __efx__: it is a bug in GNU Health
2012-05-12 16:48 <__efx__> I think the problem is on this line :
2012-05-12 16:48 <__efx__> psc = fields.One2Many('gnuhealth.patient.psc', 'name',
2012-05-12 16:48 <__efx__> 'Pediatric Symptoms Checklist', required=False)
2012-05-12 16:49 <__efx__> because the validate exception is Exception: ('ValidateError', 'Field "name" doesn\'t exist on "gnuhealth.patient.psc"')
2012-05-12 16:50 <smarro> __efx__: can you fill a bug in
2012-05-12 16:52 <__efx__> yes, sure I will do that
2012-05-12 16:52 <smarro> __efx__: thanks!
2012-05-12 16:54 <__efx__> is there an easy way to correct that ?
2012-05-12 16:55 <__efx__> smarro : can you verify the link you gave me ?
2012-05-12 16:55 <smarro> __efx__:
2012-05-12 16:56 <smarro> __efx__: what version of trytond and gnuhealth are you running?
2012-05-12 17:01 <__efx__> 2.2 and the last version of gnuhelath
2012-05-12 17:03 <__efx__> 1.45
2012-05-12 17:04 <__efx__> of gnuhealth
2012-05-12 17:07 <smarro> __efx__: ok, i can confirm the bug, using tryton client also
2012-05-12 17:11 <__efx__> smarro : it is the first time I post a bug so maybe it will not be clear
2012-05-12 17:17 <smarro> __efx__: ok, don't worry, it's fine
2012-05-12 18:35 -!- Mayank(~mayank@ has left #tryton
2012-05-12 21:19 <__efx__> now that I corrected the last error I got a KeyError: 'gnuhealth.patient.admission' during copying a patient :(
2012-05-12 21:44 <__efx__> Is a name field mandatory in tryton models ?
2012-05-12 22:23 <cedk> __efx__: depends of the Model
2012-05-12 22:27 <__efx__> I got the copy working on the patient model by adding invisible non required field called "name" in 2 models with Many2One relation to patient
2012-05-12 22:29 <cedk> __efx__: I don't understand
2012-05-12 22:31 <__efx__> when I was trying to copy a patient I had exception saying that a field called "name" was required in an other model
2012-05-12 22:31 <__efx__> I added this field
2012-05-12 22:34 <cedk> __efx__: what have you added?
2012-05-12 22:36 <__efx__> cedk : I added : name = fields.Char('name', states={'invisible':True, 'required': False})
2012-05-12 22:36 <cedk> __efx__: it should not be necessary
2012-05-12 22:36 <__efx__> in class PatientPrescriptionOrder and
2012-05-12 22:37 <__efx__> I know but since I need the copy and can not find where this request for the name field comes from.. in the mean time

Generated by 2.17.3 by Marius Gedminas - find it at!