IRC logs of #tryton for Thursday, 2014-01-09 #tryton log beginning Thu Jan 9 00:00:01 CET 2014
iamnoobHi, need help please. how can i put the selected value of an fields.selection to a string variable? it keeps on giving me error of -> tupple object has no attribute.04:11
trytonnoob Hi, need help please. how can i put the selected value of an fields.selection to a string variable? it keeps on giving me error of -> tupple object has no attribute.05:48
sharoonthomastrytonnoob: can you paste your code somewhere ? (like
trytonnoobsharoonthomas: ok thanks, will put it on pastebin brb05:55
trytonnoobsharoonthomas: hi here the pastebin -->
sharoonthomastrytonnoob: is selectedstocknumber a many2one ?06:02
trytonnoobsharoonthomas: yes its a many2one06:02
sharoonthomastrytonnoob: and the complete error message ?06:03
trytonnoobsharoonthomas: Traceback (most recent call last):06:03
trytonnoob  File "/trytond/protocols/", line 123, in _marshaled_dispatch06:03
trytonnoob    response['result'] = dispatch_method(method, params)06:03
trytonnoob  File "/trytond/protocols/", line 156, in _dispatch06:03
trytonnoob    res = dispatch(*args)06:03
trytonnoob  File "/trytond/protocols/", line 163, in dispatch06:03
trytonnoob    result = rpc.result(meth(inst, *args, **kwargs))06:03
trytonnoob  File "/trytond/modules/Goods_Receipts/", line 461, in on_change_pendingrppp06:03
trytonnoob    print dir(xxx.prnrline.selectedstocknumber.category)06:03
trytonnoobAttributeError: 'tuple' object has no attribute 'selectedstocknumber'06:03
trytonnoobsharoonthomas: wait i pasted the wrong one. ill use pastebin for the error massage ,06:04
sharoonthomastrytonnoob: xxx.prnrline is returning a tuple instead of the many2one that you expected06:04
sharoonthomastrytonnoob: s/many2one/activerecord of the many2one06:05
trytonnoobsharoonthomas: here is the correct error message :
sharoonthomastrytonnoob: does the upr.upr model have the field selectedstocknumber ?06:09
sharoonthomastrytonnoob: also is this on an on change ?06:09
trytonnoobsharoonthomas: yes the selectedstocknumber is a many2One field of the model upr.upr06:10
sharoonthomastrytonnoob: and this is happening on on_change ?06:11
trytonnoobsharoonthomas: yes the error happened inside the on_change of a many2many field06:11
sharoonthomastrytonnoob: is the field for which on_change is written a second level record (like sale lines in a sale) ?06:12
trytonnoobsharoonthomas: the system im making have this relationship   many2many --> many2many   --> many2many  --> many2many  --> many2One --> here im trying to get the value of fields.selections(which is category)06:12
sharoonthomastrytonnoob: if that is the case, the sale itself (the parent record) may not have been saved in the db. So an attribute like party of the sale to work it also has to be on the On-change fields06:13
trytonnoobsharoonthomas: actually i think the model where it errors is a 4th level.06:14
sharoonthomastrytonnoob: sending you an example06:14
trytonnoobsharoonthomas: thank you ill read it up, brb06:14
trytonnoobsharoonthomas: im new to this part, so i need it to make it like --> on_change = ['selectedstocknumber.category']  ?06:22
sharoonthomastrytonnoob: _parent_<many2onefield>.field_name06:25
trytonnoobsharoonthomas: i tried it out, and its not giving me the error now. but it returns a 'False' if i try this ---> print self.selectedstocknumber.category06:31
trytonnoobsharoonthomas: i needed to get the value thats currently selected by that fields.selections06:31
sharoonthomastrytonnoob: for on_change the remote model values are constructed as active records. You can see the __init__ method here and look at the special handling of the _parent_ fields in line 374
sharoonthomastrytonnoob: you can easily debug the values sent across in on change by enabling rpc debug on client and print active_record.__dict__ to see the record it constructs on the server side06:33
trytonnoobsharoonthomas:  ok thanks for the help. ill try my best to learn this part of tryton. thanks!06:35
sharoonthomastrytonnoob: np, you could share what you learn on the tryton documentation project here:
trytonnoobsharoonthomas: ok thanks again! ill start studying what you taught me.06:37
trytonnoobhi! need help please. i made a sepreta python program that inserts a record to a database that my trytond program use. now the problem is when it comes to fields.selection  it just show blank. but when i check that model  table by pgadmin. that field (for field.selections) is not empty. but tryton client can show it?08:36
trytonnoobseperate* sorry typo08:36
trytonnoobtryton client cant* show it. sorry typo08:37
jeancavallotrytonnoob: Are you sure that the value you entered is valid ?09:03
jeancavallotrytonnoob: Incidentally, do you use proteus or are you manipulating the database directly ?09:04
trytonnoobjeancavallo: yes im inserting the record directly09:05
jeancavallotrytonnoob: Usually, if you want to script the database you should use proteus. It allows to access tryton as the client would from a python script.09:07
jeancavallotrytonnoob: Regarding your problem, it really looks like the value you entered for your field is not valid09:07
jeancavallotrytonnoob: can you try creating an record with the client and selecting the value you tried to set with your manual insert ?09:08
trytonnoobjeancavallo: yeah i think thats what happen. when i try to open that record inside tryton client. the field.selection gives me an error of ...  the field category is not in the selection09:09
jeancavallotrytonnoob: well that's it :)09:09
trytonnoobjeancavallo: i tried what you said. and it saves the record properly now09:10
jeancavallotrytonnoob: You mean creating it through the client ?09:11
trytonnoobjeancavallo: though in my case. i need it to show with tryton having  error.   proteus is new to me btw. is there a tryton example for it?09:11
trytonnoobjeancavallo: i mean. after i inserted the record with my externam python program.. i open the record using the tryton client. then edit field.selection.  but if i dont edit it. it will just stay blank09:12
trytonnoobwithout* sorry typo again09:12
jeancavallotrytonnoob: Have a look here for proteus : It is a script creating and populating a test database using proteus09:13
jeancavallotrytonnoob: You can also check out the test rst files, which usually use proteus. you can get proteus here :
trytonnoobjeancavallo: ok thanks alot! will need to read it first. its new to me :)09:15
jeancavallotrytonnoob: Regarding your original problem, can you check that the value in the db after you edited the record with the client is the same that the one you entered with your script ?09:15
trytonnoobjeancavallo: ok brb will check it now09:16
trytonnoobjeancavallo: i had fixed my problem now. after checking if the value is the same as the one im expecting it. i notice that its not. made some few changes and it works now!09:22
trytonnoobjeancavallo: it seems saving a string type will do what i need. its just that some model's of mine needs to be adjusted too. again thanks alot for helping me solve my problem jean!09:23
jeancavallotrytonnoob: You're welcome !09:24
-!- jeancavallo( has left #tryton10:50
-!- WUD(~WUD@ has left #tryton15:41
-!- strebitz(~sebastian@ has left #tryton16:04
jvblascohi everyone16:53
jvblascoi'm back, after a month or so disconnected16:53
nicoejvblasco: welcome back then16:54
pokoli cedk: about sepa module, would you mind having xml validation on tests?18:06
cedkpokoli: I don't like too much because it is overkill18:15
cedkpokoli: it is like if html template engine validate their output18:15
pokolicedk: IMHO it's good to prevent errors on templates18:19
pokolicedk: how do you test that the result xml is correct?18:19
pokolicedk: I will understant that's overkill on production code, but not on tests18:20
cedkpokoli: testing is about comparing result with expected result18:23
pokolicedk: yes, and expected result is a valid xml :)18:24
cedkpokoli: moreover there are a big gap between SEPA standard and real life implementation18:24
cedkpokoli: expected result is human generated18:25
pokolicedk: I will belive all banks in europe the first thing that will do when recieve a SEPA file is validating against it's xsd18:26
pokolicedk: that's why i think we need to test it18:26
cedkpokoli: and I already read that's not the cases18:31
cedkpokoli: or thy validate with their own xsd18:31
pokolicedk: and their own xsd is based on the standard, isn't it?18:32
pokolicedk: forget xsd validation by the moment, will introduce it later if needed18:33
cedkpokoli: I don't mind to have tests that use xsd validation as test18:37
cedkpokoli: but not to validate every generated XML in production18:37
pokolicedk: ok, so i will try to introduce a test that generate the files and validates it against their xsd18:39
pokoli 18:56
-!- vcardon( has left #tryton19:27
-!- vcardon( has left #tryton19:35
-!- b0r7( has left #tryton20:47
-!- lukio( has left #tryton22:45
-!- pablovannini( has left #tryton22:45

Generated by 2.11.0 by Marius Gedminas - find it at!