IRC logs of #tryton for Thursday, 2014-01-09

chat.freenode.net #tryton log beginning Thu Jan 9 00:00:01 CET 2014
2014-01-09 04:11 <iamnoob> 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.
2014-01-09 05:48 <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.
2014-01-09 05:52 <sharoonthomas> trytonnoob: can you paste your code somewhere ? (like gist.github.com)
2014-01-09 05:55 <trytonnoob> sharoonthomas: ok thanks, will put it on pastebin brb
2014-01-09 05:59 <trytonnoob> sharoonthomas: hi here the pastebin --> http://pastebin.com/mpwFsyZc
2014-01-09 06:02 <sharoonthomas> trytonnoob: is selectedstocknumber a many2one ?
2014-01-09 06:02 <trytonnoob> sharoonthomas: yes its a many2one
2014-01-09 06:03 <sharoonthomas> trytonnoob: and the complete error message ?
2014-01-09 06:03 <trytonnoob> sharoonthomas: Traceback (most recent call last):
2014-01-09 06:03 <trytonnoob> File "/trytond/protocols/jsonrpc.py", line 123, in _marshaled_dispatch
2014-01-09 06:03 <trytonnoob> response['result'] = dispatch_method(method, params)
2014-01-09 06:03 <trytonnoob> File "/trytond/protocols/jsonrpc.py", line 156, in _dispatch
2014-01-09 06:03 <trytonnoob> res = dispatch(*args)
2014-01-09 06:03 <trytonnoob> File "/trytond/protocols/dispatcher.py", line 163, in dispatch
2014-01-09 06:03 <trytonnoob> result = rpc.result(meth(inst, *args, **kwargs))
2014-01-09 06:03 <trytonnoob> File "/trytond/modules/Goods_Receipts/Goods_Receipts_Transfer.py", line 461, in on_change_pendingrppp
2014-01-09 06:03 <trytonnoob> print dir(xxx.prnrline.selectedstocknumber.category)
2014-01-09 06:03 <trytonnoob> AttributeError: 'tuple' object has no attribute 'selectedstocknumber'
2014-01-09 06:04 <trytonnoob> sharoonthomas: wait i pasted the wrong one. ill use pastebin for the error massage ,
2014-01-09 06:04 <sharoonthomas> trytonnoob: xxx.prnrline is returning a tuple instead of the many2one that you expected
2014-01-09 06:05 <sharoonthomas> trytonnoob: s/many2one/activerecord of the many2one
2014-01-09 06:06 <trytonnoob> sharoonthomas: here is the correct error message : http://pastebin.com/sYxa2stq
2014-01-09 06:09 <sharoonthomas> trytonnoob: does the upr.upr model have the field selectedstocknumber ?
2014-01-09 06:09 <sharoonthomas> trytonnoob: also is this on an on change ?
2014-01-09 06:10 <trytonnoob> sharoonthomas: yes the selectedstocknumber is a many2One field of the model upr.upr
2014-01-09 06:11 <sharoonthomas> trytonnoob: and this is happening on on_change ?
2014-01-09 06:11 <trytonnoob> sharoonthomas: yes the error happened inside the on_change of a many2many field
2014-01-09 06:12 <sharoonthomas> trytonnoob: is the field for which on_change is written a second level record (like sale lines in a sale) ?
2014-01-09 06:12 <trytonnoob> sharoonthomas: 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)
2014-01-09 06:13 <sharoonthomas> trytonnoob: 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 fields
2014-01-09 06:14 <trytonnoob> sharoonthomas: actually i think the model where it errors is a 4th level.
2014-01-09 06:14 <sharoonthomas> trytonnoob: sending you an example
2014-01-09 06:14 <sharoonthomas> trytonnoob: https://github.com/tryton/sale/blob/develop/sale.py#L972
2014-01-09 06:14 <trytonnoob> sharoonthomas: thank you ill read it up, brb
2014-01-09 06:22 <trytonnoob> sharoonthomas: im new to this part, so i need it to make it like --> on_change = ['selectedstocknumber.category'] ?
2014-01-09 06:25 <sharoonthomas> trytonnoob: _parent_<many2onefield>.field_name
2014-01-09 06:31 <trytonnoob> sharoonthomas: i tried it out, and its not giving me the error now. but it returns a 'False' if i try this ---> print self.selectedstocknumber.category
2014-01-09 06:31 <trytonnoob> sharoonthomas: i needed to get the value thats currently selected by that fields.selections
2014-01-09 06:33 <sharoonthomas> trytonnoob: 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 https://github.com/tryton/trytond/blob/develop/trytond/model/model.py#L365
2014-01-09 06:33 <sharoonthomas> trytonnoob: 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 side
2014-01-09 06:35 <trytonnoob> sharoonthomas: ok thanks for the help. ill try my best to learn this part of tryton. thanks!
2014-01-09 06:36 <sharoonthomas> trytonnoob: np, you could share what you learn on the tryton documentation project here: http://tryton-documentation.readthedocs.org/en/latest/index.html
2014-01-09 06:37 <trytonnoob> sharoonthomas: ok thanks again! ill start studying what you taught me.
2014-01-09 08:36 <trytonnoob> hi! 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?
2014-01-09 08:36 <trytonnoob> seperate* sorry typo
2014-01-09 08:37 <trytonnoob> tryton client cant* show it. sorry typo
2014-01-09 09:03 <jeancavallo> trytonnoob: Are you sure that the value you entered is valid ?
2014-01-09 09:04 <jeancavallo> trytonnoob: Incidentally, do you use proteus or are you manipulating the database directly ?
2014-01-09 09:05 <trytonnoob> jeancavallo: yes im inserting the record directly
2014-01-09 09:07 <jeancavallo> trytonnoob: 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.
2014-01-09 09:07 <jeancavallo> trytonnoob: Regarding your problem, it really looks like the value you entered for your field is not valid
2014-01-09 09:08 <jeancavallo> trytonnoob: can you try creating an record with the client and selecting the value you tried to set with your manual insert ?
2014-01-09 09:09 <trytonnoob> jeancavallo: 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 selection
2014-01-09 09:09 <jeancavallo> trytonnoob: well that's it :)
2014-01-09 09:10 <trytonnoob> jeancavallo: i tried what you said. and it saves the record properly now
2014-01-09 09:11 <jeancavallo> trytonnoob: You mean creating it through the client ?
2014-01-09 09:11 <trytonnoob> jeancavallo: 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?
2014-01-09 09:12 <trytonnoob> jeancavallo: 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 blank
2014-01-09 09:12 <trytonnoob> without* sorry typo again
2014-01-09 09:13 <jeancavallo> trytonnoob: Have a look here for proteus : http://hg.tryton.org/tryton-tools/file/b89c0531f870/tryton_demo.py It is a script creating and populating a test database using proteus
2014-01-09 09:14 <jeancavallo> trytonnoob: You can also check out the test rst files, which usually use proteus. you can get proteus here : http://hg.tryton.org/proteus
2014-01-09 09:15 <trytonnoob> jeancavallo: ok thanks alot! will need to read it first. its new to me :)
2014-01-09 09:15 <jeancavallo> trytonnoob: 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 ?
2014-01-09 09:16 <trytonnoob> jeancavallo: ok brb will check it now
2014-01-09 09:22 <trytonnoob> jeancavallo: 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!
2014-01-09 09:23 <trytonnoob> jeancavallo: 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!
2014-01-09 09:24 <jeancavallo> trytonnoob: You're welcome !
2014-01-09 10:50 -!- jeancavallo(~giovanni@APuteaux-551-1-108-203.w92-132.abo.wanadoo.fr) has left #tryton
2014-01-09 15:41 -!- WUD(~WUD@122.177.49.48) has left #tryton
2014-01-09 16:04 -!- strebitz(~sebastian@91.183.59.105) has left #tryton
2014-01-09 16:53 <jvblasco> hi everyone
2014-01-09 16:53 <jvblasco> i'm back, after a month or so disconnected
2014-01-09 16:53 <jvblasco> ^^
2014-01-09 16:54 <nicoe> jvblasco: welcome back then
2014-01-09 18:06 <pokoli> cedk: about sepa module, would you mind having xml validation on tests?
2014-01-09 18:15 <cedk> pokoli: I don't like too much because it is overkill
2014-01-09 18:15 <cedk> pokoli: it is like if html template engine validate their output
2014-01-09 18:19 <pokoli> cedk: IMHO it's good to prevent errors on templates
2014-01-09 18:19 <pokoli> cedk: how do you test that the result xml is correct?
2014-01-09 18:20 <pokoli> cedk: I will understant that's overkill on production code, but not on tests
2014-01-09 18:23 <cedk> pokoli: testing is about comparing result with expected result
2014-01-09 18:24 <pokoli> cedk: yes, and expected result is a valid xml :)
2014-01-09 18:24 <cedk> pokoli: moreover there are a big gap between SEPA standard and real life implementation
2014-01-09 18:25 <cedk> pokoli: expected result is human generated
2014-01-09 18:26 <pokoli> cedk: I will belive all banks in europe the first thing that will do when recieve a SEPA file is validating against it's xsd
2014-01-09 18:26 <pokoli> cedk: that's why i think we need to test it
2014-01-09 18:31 <cedk> pokoli: and I already read that's not the cases
2014-01-09 18:31 <cedk> pokoli: or thy validate with their own xsd
2014-01-09 18:32 <pokoli> cedk: and their own xsd is based on the standard, isn't it?
2014-01-09 18:33 <pokoli> cedk: forget xsd validation by the moment, will introduce it later if needed
2014-01-09 18:37 <cedk> pokoli: I don't mind to have tests that use xsd validation as test
2014-01-09 18:37 <cedk> pokoli: but not to validate every generated XML in production
2014-01-09 18:39 <pokoli> cedk: ok, so i will try to introduce a test that generate the files and validates it against their xsd
2014-01-09 18:56 <pokoli>
2014-01-09 19:27 -!- vcardon(~vcardon@LNeuilly-152-23-15-185.w193-252.abo.wanadoo.fr) has left #tryton
2014-01-09 19:35 -!- vcardon(~vcardon@LNeuilly-152-23-15-185.w193-252.abo.wanadoo.fr) has left #tryton
2014-01-09 20:47 -!- b0r7(~b0r7@p5B2CD44E.dip0.t-ipconnect.de) has left #tryton
2014-01-09 22:45 -!- lukio(~lukio@host126.186-109-85.telecom.net.ar) has left #tryton
2014-01-09 22:45 -!- pablovannini(~pablo@host126.186-109-85.telecom.net.ar) has left #tryton

Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!