IRC logs of #tryton for Saturday, 2012-05-12 #tryton log beginning Sat May 12 00:00:02 CEST 2012
-!- __efx__( has left #tryton11:45
__efx__hello, I want to copy an entry in the database using proteus is it possible ?14:34
__efx__I tried something with the deepcopy but I have problem with the id field14:35
cedk__efx__: use copy method of Model14:36
__efx__cedk: thank you14:39
__efx__cedk: I tried to copy a party like that, Party = Model.get('') parties = Party.find() party = Party.copy(parties[0].id)14:52
__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 arguments14:54
__efx__and this way it works Party.copy(party[0].id,party[0]._fields)14:56
cedk__efx__: copy takes a list of ids16:20
cedk__efx__: oops, no copy can also work with single id16:21
cedk__efx__: you must pass the context to copy16:22
__efx__what is "the context"16:26
cedk__efx__: it is a dictionary that define the execution context16:31
__efx__the result of config.set_trytond(...16:32
cedk__efx__: the proteus config contains a default context16:34
__efx__cedk: and how do I access to the context16:37
__efx__because for now I can copy only like that Party.copy(, my_party._fields)16:37
cedk__efx__: most of the time just: config.context is enough16:38
__efx__cedk: ok thank you again :) so this is correct Party.copy(parties[0].id,config.context)16:40
__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 patient16:42
__efx__I tried to add a required=False in the field that causes the validate error but still the same problem16:44
__efx__does anyone has an idea of why I have this problem?16:45
cedk__efx__: it is a bug in GNU Health16:46
__efx__I think the problem is on this line :16:48
__efx__    psc = fields.One2Many('gnuhealth.patient.psc', 'name',16:48
__efx__        'Pediatric Symptoms Checklist', required=False)16:48
__efx__because the validate exception is Exception: ('ValidateError', 'Field "name" doesn\'t exist on "gnuhealth.patient.psc"')16:49
smarro__efx__: can you fill a bug in
__efx__yes, sure I will do that16:52
smarro__efx__: thanks!16:52
__efx__is there an easy way to correct that ?16:54
__efx__smarro : can you verify the link you gave me ?16:55
smarro__efx__: what version of trytond and gnuhealth are you running?16:56
__efx__2.2 and the last version of gnuhelath17:01
__efx__of gnuhealth17:04
smarro__efx__: ok, i can confirm the bug, using tryton client also17:07
__efx__smarro : it is the first time I post a bug so maybe it will not be clear17:11
smarro__efx__: ok, don't worry, it's fine17:17
-!- Mayank(~mayank@ has left #tryton18:35
__efx__now that I corrected the last error I got a KeyError: 'gnuhealth.patient.admission' during copying a patient :(21:19
__efx__Is a name field mandatory in tryton models ?21:44
cedk__efx__: depends of the Model22:23
__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 patient22:27
cedk__efx__: I don't understand22:29
__efx__when I was trying to copy a patient I had exception saying that a field called "name" was required in an other model22:31
__efx__I added this field22:31
cedk__efx__: what have you added?22:34
__efx__cedk : I added : name = fields.Char('name', states={'invisible':True, 'required': False})22:36
cedk__efx__: it should not be necessary22:36
__efx__in class PatientPrescriptionOrder and22:36
__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 time22:37

Generated by 2.11.0 by Marius Gedminas - find it at!