IRC logs of #tryton for Wednesday, 2011-11-23 #tryton log beginning Wed Nov 23 00:00:01 CET 2011
phellercedk: ok, fixed the remaining occurrences of mac os recognition tests on the code review00:06
-!- ciupicri(~ciupicri@unaffiliated/ciupicri) has joined #tryton04:24
-!- heg( has left #tryton11:28
zxq9How do I use a <with="varname = 0"> type assignment in an ODT file? I'm getting a syntax error.12:53
zxq9nm, problem isn't with assignment, its improperly trying to push/pop...12:58
nicoezxq9: I don't understand13:03
zxq9nicoe: I'm trying to iterate through a list of values, picking out ones that match a specific type and append() to a variable I declate in a <with=""> type statement13:09
zxq9nicoe: like <with="vals.append(item.value)"> </with> but I'm doing something wrong somewhere.13:10
cedkzxq9: why do you try to program with a templating engine?13:11
nicoezxq9: Why do you need that ?13:11
zxq9cedk: Because this is for form input13:11
zxq9for report13:11
nicoeI don't understand why you need to put logic in the template13:12
cedkzxq9: don't understand13:12
zxq9Because the report template (based on a government form) has only a certain number of spaces available, and that is set. You can't just <for each="whatever in objects">13:12
cedkzxq9: any way, why do you process data in template and not in report code?13:13
nicoewhy not ? you do a for each and on each you do something only if they match ...13:13
nicoeor maybe you're trying to paginate the stuff13:14
zxq9nicoe: Let's say the government form has exactly 3 spaces for professional reference information, which comes from other personal records. If the person's data actually has 10 professional references or just 1 professional reference, the template grows or shrinks.13:14
zxq9And then its not compliant with the government form.13:14
zxq9cedk: I think I don't understand, exactly. Maybe there is a place I can do this I don't know of yet.13:16
cedkzxq9: so iter on [:3]13:16
cedkzxq9: yes it is in the report13:16
nicoemaybe you should create a function in your python file and pass it to the template in order to transform the list to the exact size you want13:17
zxq9cedk: How about for columns which are embedded within a larger table already?13:17
zxq9nicoe: I think this is what I need to do, and I think its what cedk meant above.13:17
cedkzxq9: the simple is to no do any loop at all13:17
cedkzxq9: just fill: value[0] ... value[1] .. value[2]13:18
cedkzxq9: that's the simplest way to follow a strict template13:18
zxq9cedk: Yes, but when there are several categories of connections, like "personal reference" and "professional reference" and "family reference" I can't just iterate with no tests.13:18
cedkzxq9: filter13:19
cedkzxq9: or create a function field that returns what you need13:19
zxq9cedk: Is there a way to have code execute on selecting a specific report type?13:19
zxq9cedk: So I can populate my fields only when generating a report?13:20
zxq9cedk: The problem is that there are 12 different report types, some of them with 100's of fields for each person in large lists. If Tryton processes all of them every time that view is selected it will really slow down a lot.13:20
cedkzxq9: it doesn't13:21
nicoefunction fields are cached so they won't be computed twice13:21
zxq9Even computing it just the first time can take too much time if it is for every form.13:22
cedkzxq9: it is only at request13:23
zxq9Only at request for the specific report, or at request for the view?13:23
nicoeI think the easiest way for you to do what you want is to use a filter on the list of the references13:24
nicoeor a function called from the template on the list13:25
zxq9Within the report or within the form view?13:25
nicoethe report of course13:25
zxq9nicoe: The function called from the template might be better.13:25
zxq9I need to filter for type of relation by type, then insert a slice of that list (like up to 4 elements, for example) into the form.13:28
zxq9But if there is less than 4 elements this should not produce an error.13:28
cedkfor me Function fields will be the best in term of preformence because it will be able to work on a list of ids13:28
zxq9And if less than 4 elements should leave the blank spot on the form, not shorten the form template.13:28
cedkzxq9: don't use loop13:28
zxq9cedk: So I would define a method in the module code for this, and call it from the template?13:29
cedkzxq9: yes13:41
cedkzxq9: but a function field13:41
grasbauerYiihaaa - found a way to put the toctree of the current page to the sidebar - so you can define the subpages in a toctree directive - :hidden: if you don't want to show it on the page (dance)13:53
cedkgrasbauer: great13:57
udonoHello, is depends declaration needed in field definitions for values in on_change or on_change_with?15:45
cedkudono: I don't think15:46
zxq9udono: I have used it a lot without lately.15:47
cedkudono: indeed it is15:48
udonocedk: ups... so test_depends seems not complete15:48
udonozxq9: yes, I have not detected problems with more fields then needed in depends. But I am unsure if it slows down...15:50
cedkudono: no because it is not required to have on_change values in depends15:50
udonocedk: ok.15:51
zxq9udono: An "if vals['fieldname'] and vals['otherfieldname']:" test in the on_change[_with]() definition works fine to check if required field values are present or not.15:55
zxq9udono: There may be a better way of doing this, but its easy to read later.15:56
udonozxq9: ah, ok I meant this test_depends: but you are right, anyways.16:05
udonocedk: Thanks16:10
phellercedk: how might I go about enumerating the menu tree for a given user via proteus?16:21
phellercedk: is there a specific model on which I should find() all instances, and only those valid for that user will be returned?16:21
cedkpheller: I don't understand the question16:21
phellercedk: the menu, as shown on the left side of the GTK client - how can I retrieve that menu via proteus?16:22
cedkpheller: yes do a search on ir.ui.menu16:22
nicoeuse ir.ui.menu16:22
phellercedk, nicoe: ok - and the return values will only be those which are valid for the user under which I do the find() ?16:23
cedkpheller: yes16:23
phellercedk: ok, is there a condition I can pass to menu which will only return the root items?16:31
cedkpheller: ('parent', '=', False)16:31
phellercedk: ah, perfect.  thanks16:32
zxq9Is it possible in Relatorio to create or affect a variable from an external scope with an <if test=""> statement? Using <if test"True"> <with vars="foo = 1"> </if> causes foo to drop out of scope, so the </when> cannot close later.16:45
zxq9Also, yes, I have to do the logic in the form -- nobody in the company wants to make adjustments inside the module code every time a form changes (which is frequent).16:46
zxq9form == ODT template*16:46
nicoezxq9: no the scope of the with is between the <with> </with> if I remember correctly16:47
cedkzxq9: look at Genshi doc16:47
zxq9nicoe: I'm getting errors. And Genshi is behaving differently here, also. For example foo.append('something') has no effect, but "foo = foo + 'something" works fine.16:48
nicoeof course "_ = foo.append('something')" works I suppose16:49
zxq9For example: <with vars="a = [1, 2, 3]"> <a[1]> <with vars="a[1] = 500"> <a[1]> </when> </when>16:49
zxq9GIves the output "2 2"16:49
nicoeThose are genshi questions16:49
nicoeyou should debug the genshi code generated first16:50
zxq9nicoe: By the way, the previous question "Why don't you do the logic in the report code?" and the discussion about fields.Function() resulted in the answer "Why do you think web designers do logic in their pages?"16:54
zxq9Which I disagree with, but understand what they mean is to contain the report code in one place because it changes all the time, instead of making the module code bigger (in this case a lot bigger) because of the presence of forms. :-S16:56
zxq9So now I'm stuck trying to get lots of things into ODTs via Relatorio that maybe wasn't really supposed to go there (grrrr...)16:57
nicoezxq9: IMHO it is easier to change python code than to change odt template17:01
zxq9nicoe: I REALLY agree with you.17:02
zxq9nicoe: But I also really have a job. I think I can make two versions, one the required 100% in-ODT way and the other the field-access in ODT, logic in Python way and probably win my argument.17:03
zxq9nicoe: But not this week. So I need to make this work right now, so that I can get to that stage later. Comparisons of working implementations are the only things that win arguments where I work.17:04
zxq9nicoe: (well, this kind of argument where I am very out-ranked)17:05
phellercedk: it seems proteus only supports a single concurrent server connection.  Could it be extended to support multiple concurrent connections?17:50
cedkpheller: why not but it will be complicated18:03
-!- ciupicri(~ciupicri@unaffiliated/ciupicri) has joined #tryton18:42
phellercedk: I started working a little on making a gui client with proteus as the backend….  I want to incorporate the ability to connect to multiple servers simultaneously, that's why I asked.18:50
cedkpheller: we will accept such patch but it should not complicate the single connection usage18:52
phellercedk: would it be acceptable if the syntax became: serverA = Proteus(), serverA.config.set_xmlrpc(), party = serverA.Model.get('')  ?18:53
cedkpheller: I think it could be possible to be smarter18:55
phellercedk: maybe with a context manager?18:57
cedkpheller: I think context manager will be to complicate in this case18:58
cedkpheller: but it could be with an optional param18:58
cedkpheller: or yes with contextmanager and storing context in class18:58
phellercedk: ok, I'll think about this.18:59
zxq9For a bilingual report, where something like a job description must be output in two languages, what is the easiest way to access both values of a field?19:26
zxq9Or is switching the context entirely the only way?19:26
-!- ciupicri(~ciupicri@unaffiliated/ciupicri) has joined #tryton19:30
grasbauerjust another design inspired by a css-error:
grasbauer you have a always visible navigation on the left side19:38
grasbauerneed to fix, that the selected item in the topnavigation is highlighted19:45
jcmgrasbauer: very nice, readable, and enlightned19:46
grasbauerand a scrolling sidebar would be nice - but I think that is a setting in sphinx already19:50
smarrograsbauer: i like both of them19:57
grasbauersmarro: what both?19:58
smarrograsbauer: the first design (test1, in black) and this (test2)19:58
grasbauersmarro: ah - ok. so we can add a themeswitcher :D19:59
zxq9Is there any way to set the language context for a single field in a report different from the rest of the document? For example, to display an item name in two languages at on the same report?20:00
-!- ciupicri(~ciupicri@unaffiliated/ciupicri) has joined #tryton20:00
smarrograsbauer: :-)20:01
grasbauerzxq9: only a guess - set and reset the language ?20:05
zxq9grasbauer: Would this be unecessarily cumbersome if there were, say, 100 fields to do this on later? (a strong chance of this in the future)20:06
zxq9grasbauer: or load a bunch of variables with one langauage, then switch context and fill the report out with a mix of direct fields and the established variables?20:09
grasbauerzxq9: but this is an strange use case.20:09
zxq9It just seems like there is some way to access a specific language for one field at a time using a context setting method in the call... :-S20:10
zxq9grasbauer: Not really. It is pretty normal for multilingual fields to exist all over Asia. Especially in export and anything involving interaction with international military or trade.20:11
zxq9grasbauer: For example, to get a base pass to an American base to do construction work you have to supply a form with one half Japanese info and one half English info. Things like Job description, type of car you drive, etc.20:12
grasbauerzxq9: ok20:12
zxq9grasbauer: For export from almost anywhere here you have to fill out customs documents that have a local language declaration and another field next to it in English.20:12
cedkzxq9: call setLang on BrowseRecord20:13
zxq9cedk: Like'en_US') or something?20:14
grasbauerzxq9: this I meant with set and unset language - repeat the field and set the language temporarly. finally in such a use case I would add a explicit field for the second language ...20:16
cedkzxq9: no, item.setLang('en_US')20:16
cedkzxq9: look at the invoice.odt20:16
grasbauerso long all - its time for taking a beer and watching champions league20:19
zxq9cedk: Ah, got it now. Two calls, then. One to set, one to access the field?20:19
zxq9cedk: Thanks a lot!20:20

Generated by 2.11.0 by Marius Gedminas - find it at!