IRC logs of #tryton for Wednesday, 2011-11-23

chat.freenode.net #tryton log beginning Wed Nov 23 00:00:01 CET 2011
2011-11-23 00:06 <pheller> cedk: ok, fixed the remaining occurrences of mac os recognition tests on the code review
2011-11-23 04:24 -!- ciupicri(~ciupicri@unaffiliated/ciupicri) has joined #tryton
2011-11-23 11:28 -!- heg(~heg@dyn.144-85-146-007.dsl.vtx.ch) has left #tryton
2011-11-23 12:53 <zxq9> How do I use a <with="varname = 0"> type assignment in an ODT file? I'm getting a syntax error.
2011-11-23 12:58 <zxq9> nm, problem isn't with assignment, its improperly trying to push/pop...
2011-11-23 13:03 <nicoe> zxq9: I don't understand
2011-11-23 13:09 <zxq9> nicoe: 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 statement
2011-11-23 13:10 <zxq9> nicoe: like <with="vals.append(item.value)"> </with> but I'm doing something wrong somewhere.
2011-11-23 13:11 <cedk> zxq9: why do you try to program with a templating engine?
2011-11-23 13:11 <nicoe> zxq9: Why do you need that ?
2011-11-23 13:11 <zxq9> cedk: Because this is for form input
2011-11-23 13:11 <zxq9> for report
2011-11-23 13:12 <nicoe> I don't understand why you need to put logic in the template
2011-11-23 13:12 <cedk> zxq9: don't understand
2011-11-23 13:12 <zxq9> Because 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">
2011-11-23 13:13 <cedk> zxq9: any way, why do you process data in template and not in report code?
2011-11-23 13:13 <nicoe> why not ? you do a for each and on each you do something only if they match ...
2011-11-23 13:14 <nicoe> or maybe you're trying to paginate the stuff
2011-11-23 13:14 <zxq9> nicoe: 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.
2011-11-23 13:14 <zxq9> And then its not compliant with the government form.
2011-11-23 13:16 <zxq9> cedk: I think I don't understand, exactly. Maybe there is a place I can do this I don't know of yet.
2011-11-23 13:16 <cedk> zxq9: so iter on [:3]
2011-11-23 13:16 <cedk> zxq9: yes it is in the report
2011-11-23 13:17 <nicoe> maybe 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 want
2011-11-23 13:17 <zxq9> cedk: How about for columns which are embedded within a larger table already?
2011-11-23 13:17 <zxq9> nicoe: I think this is what I need to do, and I think its what cedk meant above.
2011-11-23 13:17 <cedk> zxq9: the simple is to no do any loop at all
2011-11-23 13:18 <cedk> zxq9: just fill: value[0] ... value[1] .. value[2]
2011-11-23 13:18 <cedk> zxq9: that's the simplest way to follow a strict template
2011-11-23 13:18 <zxq9> cedk: 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.
2011-11-23 13:19 <cedk> zxq9: filter
2011-11-23 13:19 <cedk> zxq9: or create a function field that returns what you need
2011-11-23 13:19 <zxq9> cedk: Is there a way to have code execute on selecting a specific report type?
2011-11-23 13:20 <zxq9> cedk: So I can populate my fields only when generating a report?
2011-11-23 13:20 <nicoe> no
2011-11-23 13:20 <zxq9> cedk: 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.
2011-11-23 13:21 <cedk> zxq9: it doesn't
2011-11-23 13:21 <nicoe> function fields are cached so they won't be computed twice
2011-11-23 13:22 <zxq9> Even computing it just the first time can take too much time if it is for every form.
2011-11-23 13:23 <cedk> zxq9: it is only at request
2011-11-23 13:23 <zxq9> Only at request for the specific report, or at request for the view?
2011-11-23 13:24 <nicoe> I think the easiest way for you to do what you want is to use a filter on the list of the references
2011-11-23 13:25 <nicoe> or a function called from the template on the list
2011-11-23 13:25 <zxq9> Within the report or within the form view?
2011-11-23 13:25 <nicoe> the report of course
2011-11-23 13:25 <zxq9> nicoe: The function called from the template might be better.
2011-11-23 13:28 <zxq9> I 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.
2011-11-23 13:28 <zxq9> But if there is less than 4 elements this should not produce an error.
2011-11-23 13:28 <cedk> for me Function fields will be the best in term of preformence because it will be able to work on a list of ids
2011-11-23 13:28 <zxq9> And if less than 4 elements should leave the blank spot on the form, not shorten the form template.
2011-11-23 13:28 <cedk> zxq9: don't use loop
2011-11-23 13:29 <zxq9> cedk: So I would define a method in the module code for this, and call it from the template?
2011-11-23 13:41 <cedk> zxq9: yes
2011-11-23 13:41 <cedk> zxq9: but a function field
2011-11-23 13:53 <grasbauer> Yiihaaa - 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)
2011-11-23 13:57 <cedk> grasbauer: great
2011-11-23 15:45 <udono> Hello, is depends declaration needed in field definitions for values in on_change or on_change_with?
2011-11-23 15:46 <cedk> udono: I don't think
2011-11-23 15:47 <zxq9> udono: I have used it a lot without lately.
2011-11-23 15:48 <cedk> udono: indeed it is
2011-11-23 15:48 <zxq9> ?
2011-11-23 15:48 <udono> cedk: ups... so test_depends seems not complete
2011-11-23 15:50 <udono> zxq9: yes, I have not detected problems with more fields then needed in depends. But I am unsure if it slows down...
2011-11-23 15:50 <cedk> udono: no because it is not required to have on_change values in depends
2011-11-23 15:51 <udono> cedk: ok.
2011-11-23 15:55 <zxq9> udono: 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.
2011-11-23 15:56 <zxq9> udono: There may be a better way of doing this, but its easy to read later.
2011-11-23 16:05 <udono> zxq9: ah, ok I meant this test_depends: http://hg.tryton.org/trytond/file/dd6d9aa5ee21/trytond/tests/test_tryton.py#l186 but you are right, anyways.
2011-11-23 16:10 <udono> cedk: Thanks
2011-11-23 16:21 <pheller> cedk: how might I go about enumerating the menu tree for a given user via proteus?
2011-11-23 16:21 <pheller> cedk: is there a specific model on which I should find() all instances, and only those valid for that user will be returned?
2011-11-23 16:21 <cedk> pheller: I don't understand the question
2011-11-23 16:22 <pheller> cedk: the menu, as shown on the left side of the GTK client - how can I retrieve that menu via proteus?
2011-11-23 16:22 <cedk> pheller: yes do a search on ir.ui.menu
2011-11-23 16:22 <nicoe> use ir.ui.menu
2011-11-23 16:23 <pheller> cedk, nicoe: ok - and the return values will only be those which are valid for the user under which I do the find() ?
2011-11-23 16:23 <cedk> pheller: yes
2011-11-23 16:31 <pheller> cedk: ok, is there a condition I can pass to menu which will only return the root items?
2011-11-23 16:31 <cedk> pheller: ('parent', '=', False)
2011-11-23 16:32 <pheller> cedk: ah, perfect. thanks
2011-11-23 16:45 <zxq9> Is 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.
2011-11-23 16:46 <zxq9> Also, 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).
2011-11-23 16:46 <zxq9> form == ODT template*
2011-11-23 16:47 <nicoe> zxq9: no the scope of the with is between the <with> </with> if I remember correctly
2011-11-23 16:47 <cedk> zxq9: look at Genshi doc
2011-11-23 16:48 <zxq9> nicoe: 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.
2011-11-23 16:49 <nicoe> of course "_ = foo.append('something')" works I suppose
2011-11-23 16:49 <zxq9> For example: <with vars="a = [1, 2, 3]"> <a[1]> <with vars="a[1] = 500"> <a[1]> </when> </when>
2011-11-23 16:49 <zxq9> GIves the output "2 2"
2011-11-23 16:49 <nicoe> Those are genshi questions
2011-11-23 16:50 <nicoe> you should debug the genshi code generated first
2011-11-23 16:54 <zxq9> nicoe: 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?"
2011-11-23 16:56 <zxq9> Which 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. :-S
2011-11-23 16:57 <zxq9> So now I'm stuck trying to get lots of things into ODTs via Relatorio that maybe wasn't really supposed to go there (grrrr...)
2011-11-23 17:01 <nicoe> zxq9: IMHO it is easier to change python code than to change odt template
2011-11-23 17:02 <zxq9> nicoe: I REALLY agree with you.
2011-11-23 17:03 <zxq9> nicoe: 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.
2011-11-23 17:04 <zxq9> nicoe: 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.
2011-11-23 17:05 <zxq9> nicoe: (well, this kind of argument where I am very out-ranked)
2011-11-23 17:50 <pheller> cedk: it seems proteus only supports a single concurrent server connection. Could it be extended to support multiple concurrent connections?
2011-11-23 18:03 <cedk> pheller: why not but it will be complicated
2011-11-23 18:42 -!- ciupicri(~ciupicri@unaffiliated/ciupicri) has joined #tryton
2011-11-23 18:50 <pheller> cedk: 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.
2011-11-23 18:52 <cedk> pheller: we will accept such patch but it should not complicate the single connection usage
2011-11-23 18:53 <pheller> cedk: would it be acceptable if the syntax became: serverA = Proteus(), serverA.config.set_xmlrpc(), party = serverA.Model.get('party.party') ?
2011-11-23 18:55 <cedk> pheller: I think it could be possible to be smarter
2011-11-23 18:57 <pheller> cedk: maybe with a context manager?
2011-11-23 18:58 <cedk> pheller: I think context manager will be to complicate in this case
2011-11-23 18:58 <cedk> pheller: but it could be with an optional param
2011-11-23 18:58 <cedk> pheller: or yes with contextmanager and storing context in class
2011-11-23 18:59 <pheller> cedk: ok, I'll think about this.
2011-11-23 19:26 <zxq9> For 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?
2011-11-23 19:26 <zxq9> Or is switching the context entirely the only way?
2011-11-23 19:30 -!- ciupicri(~ciupicri@unaffiliated/ciupicri) has joined #tryton
2011-11-23 19:37 <grasbauer> just another design inspired by a css-error: http://grasbauer.com/test2/
2011-11-23 19:38 <grasbauer> http://grasbauer.com/test2/trytond/doc/index.html you have a always visible navigation on the left side
2011-11-23 19:45 <grasbauer> need to fix, that the selected item in the topnavigation is highlighted
2011-11-23 19:46 <jcm> grasbauer: very nice, readable, and enlightned
2011-11-23 19:50 <grasbauer> and a scrolling sidebar would be nice - but I think that is a setting in sphinx already
2011-11-23 19:57 <smarro> grasbauer: i like both of them
2011-11-23 19:58 <grasbauer> smarro: what both?
2011-11-23 19:58 <smarro> grasbauer: the first design (test1, in black) and this (test2)
2011-11-23 19:59 <grasbauer> smarro: ah - ok. so we can add a themeswitcher :D
2011-11-23 20:00 <zxq9> Is 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?
2011-11-23 20:00 -!- ciupicri(~ciupicri@unaffiliated/ciupicri) has joined #tryton
2011-11-23 20:01 <smarro> grasbauer: :-)
2011-11-23 20:05 <grasbauer> zxq9: only a guess - set and reset the language ?
2011-11-23 20:06 <zxq9> grasbauer: Would this be unecessarily cumbersome if there were, say, 100 fields to do this on later? (a strong chance of this in the future)
2011-11-23 20:09 <zxq9> grasbauer: 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?
2011-11-23 20:09 <grasbauer> zxq9: but this is an strange use case.
2011-11-23 20:10 <zxq9> It 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... :-S
2011-11-23 20:11 <zxq9> grasbauer: 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.
2011-11-23 20:12 <zxq9> grasbauer: 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.
2011-11-23 20:12 <grasbauer> zxq9: ok
2011-11-23 20:12 <zxq9> grasbauer: 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.
2011-11-23 20:13 <cedk> zxq9: call setLang on BrowseRecord
2011-11-23 20:14 <zxq9> cedk: Like item.name.BrowseRecord(setLang='en_US') or something?
2011-11-23 20:16 <grasbauer> zxq9: 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 ...
2011-11-23 20:16 <cedk> zxq9: no, item.setLang('en_US')
2011-11-23 20:16 <cedk> zxq9: look at the invoice.odt
2011-11-23 20:19 <grasbauer> so long all - its time for taking a beer and watching champions league
2011-11-23 20:19 <zxq9> cedk: Ah, got it now. Two calls, then. One to set, one to access the field?
2011-11-23 20:20 <zxq9> cedk: Thanks a lot!

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