IRC logs of #tryton for Wednesday, 2011-11-09 #tryton log beginning Wed Nov 9 00:00:01 CET 2011
2011-11-09 06:14 <zxq9> Is it possible to display field data from multiple models in the same tree view?
2011-11-09 06:16 <zxq9> Specifically, using a many2many junction table, I need the junctions/references to carry some information also.
2011-11-09 06:17 <zxq9> Like a "parents" table and a "children" table, connected by a many2many junction table which can say if the child relationship to a parent is "stepchild" or "daughter" or "ward" or whatever.
2011-11-09 06:18 <zxq9> In the tree view and the form within the parent form, I want to be able to display the child's name and the relationship type.
2011-11-09 06:29 <zxq9> Oops. The 2.2 documentation still has notebook, tabpos listed as working.
2011-11-09 10:25 <zxq9> How to display fields from several modules/models in a single form or tree view?
2011-11-09 10:34 <zxq9> Specifically, I need to include information about a relationship from a junction table in a form. So people can set things like type of family relationship (mother, daughter, etc.) and similar data.
2011-11-09 10:35 <zxq9> I can create the fields in a many2many junction table, but I can't seem to display or manipulate the information from a form in the client. ?
2011-11-09 10:55 <udono> zxq9: you can 'carry' a finit set of fields from other models to a model with fields.Function.
2011-11-09 10:56 <zxq9> Maybe this is what I need. Seems strange you can't just display a view that represents a multiple join, though.
2011-11-09 10:56 <udono> zxq9: when you create views for the many2many junction table, all fields used there can be shown.
2011-11-09 10:58 <udono> zxq9: It is hard for me to answer this kind of questions without seen the code.
2011-11-09 10:58 <udono> This I do not understand "Seems strange you can't just display a view that represents a multiple join"
2011-11-09 11:00 <zxq9> For example, if I want to make a tree view that has information from 'parents' table, then an information field from the junction table 'parent-child' like "daughter" or "step-son", then information from the 'children' table in one tree view.
2011-11-09 11:01 <zxq9> That joins three tables in a single tree view. This is what I need to do, to define or categorize the relationship inside the junction table.
2011-11-09 11:11 <udono> zxq9: For this kind of views I would use Function fields. But this depends on the exact model design and on how many data needed to be retrieved with function fields. Function fields tend to be slow on big data amount or complex calculations, specially in tree views.
2011-11-09 11:17 <zxq9> That's sort of strange -- this is a very basic database function (definition/categorization of many2many relationships). I wonder why this is so slow/difficult in Tryton?
2011-11-09 11:17 <zxq9> It seems like there must be some other way. (?.?)
2011-11-09 11:18 <zxq9> Anyway, to get things working I'll play with function fields. Thanks for your help, Udo!
2011-11-09 11:31 <bechamel> zxq9: you can build a model on top of a custom db query, like the HoursEmployee model in timesheet/
2011-11-09 11:44 <zxq9> bechamel: Seems odd that this is necessary (Tryton is full of features, but not this one?), but it may be the best way. Thank you for the reference!
2011-11-09 12:28 <udono> zxq9: as said earlier, without code example it is hard to help.
2011-11-09 12:39 <zxq9> udono: OK, I have a very simple example:
2011-11-09 12:40 <zxq9> In this case, the model drivers.vehicle has a field called 'purpose' which defines the relationship between the driver and vehicle.
2011-11-09 12:41 <zxq9> How can I display this in the driver form and tree so that the user can set and use this information? Does this require a custom SQL query or a Function() type field?
2011-11-09 13:04 <udono> zxq9: line 30-33
2011-11-09 13:17 <zxq9> There is no "name" field in drivers.vehicle, it is referenced from vehicle.vehicle.
2011-11-09 13:18 <zxq9> Adding the purpose field to the xml doesn't change anything. I'll try adding a name field to drivers.vehicle and see if that works.
2011-11-09 13:20 <zxq9> Adding a name field to drivers.vehicle, and adding the "name" and "purpose" fields to the XML does not change anything on the tree view or the form.
2011-11-09 13:23 <zxq9> Revised example (also corrected for plural names):
2011-11-09 13:24 <zxq9> This example does not show me "purpose" from driver.vehicle -- which is what I need to be able to do. I feel like I'm just missing something very simple here again that is not well documented (but probably works fine).
2011-11-09 13:26 <zxq9> Hi sharoon.
2011-11-09 13:26 <udono> zxq9: did you update the database for the module? Did you try it on a fresh database?
2011-11-09 13:27 <zxq9> Yes
2011-11-09 13:27 <udono> zxq9: Sure you did try it on a fresh database?
2011-11-09 13:27 <zxq9> I'll do it (again) just now.
2011-11-09 13:28 <bechamel> zxq9: in your xml there are no view for driver.vehicle
2011-11-09 13:29 <udono> bechamel: line 29-31
2011-11-09 13:31 <bechamel> oh yes, sorry
2011-11-09 13:31 <zxq9> You mean a ir.ui.view definition?
2011-11-09 13:33 <bechamel> zxq9: yes but I didn't read correctly the xml
2011-11-09 13:36 <bechamel> zxq9: the problem is that m2m doesnt works like that
2011-11-09 13:36 <zxq9> m2m doesn't permit reference definitions?
2011-11-09 13:36 <zxq9> ?!?
2011-11-09 13:37 <bechamel> zxq9: when you put the field vehicule in the view of Driver, the client will show you the content of the Vehicule model
2011-11-09 13:37 <bechamel> not the content of "Driver - Vehicule"
2011-11-09 13:37 <zxq9> Is there no way to access junction table definition data?
2011-11-09 13:38 <bechamel> zxq9: you must use a one2many
2011-11-09 13:38 <zxq9> As in, there is no way to add data to the reference itself?
2011-11-09 13:38 <zxq9> That is not possible for a case like this, though.
2011-11-09 13:39 <bechamel> zxq9: keep your model as they are
2011-11-09 13:39 <zxq9> For example, the ferry driver of a crane truck is not the same person as the crane pilot on the work site. They are both assigned the same vehicle.
2011-11-09 13:39 <bechamel> just change the defintion of the vehicule field
2011-11-09 13:39 <udono> zxq9: you can use a one2many with widget="many2many"
2011-11-09 13:40 <bechamel> udono: I don't think this will give the correct behaviour
2011-11-09 13:40 <bechamel> zxq9: udono: here it is a real o2m
2011-11-09 13:40 <zxq9> And this will allow multiple vehicles driven by multiple people categorized by purpose?
2011-11-09 13:40 <bechamel> one "driver" - many "driver vehicule"
2011-11-09 13:41 <zxq9> How is the reverse relationship defined, then? How do I find how many drivers touch a single vehicle?
2011-11-09 13:41 <bechamel> zxq9: yes the tables will stay exactly the same
2011-11-09 13:41 <bechamel> it's just the display that will change
2011-11-09 13:42 <zxq9> let me try this.
2011-11-09 13:42 <bechamel> when tryton show a m2m field it's the "target" table that is displayed, not the intermediate one that support the relation
2011-11-09 13:42 <bechamel> and here you want to show the relation table
2011-11-09 13:43 <zxq9> ok. I think I see what you mean. I'm still thinking like making SQL queries.
2011-11-09 13:43 <cedk> there is no mystery, you must use a One2Many
2011-11-09 13:44 <zxq9> From driver.driver to driver.vehicle?
2011-11-09 13:45 <bechamel> zxq9: yes
2011-11-09 13:46 <zxq9> To handle the opposite relationship do I need to set a One2Many from vehicle.vehicle (as in driver = fields.One2Many('driver.vehicle', 'driver', 'Drivers')?)
2011-11-09 13:49 <bechamel> afk
2011-11-09 13:52 <nicoe> just make a o2m relation between your driver and the relation table
2011-11-09 13:53 <nicoe> is 'driver.vehicle' the relation table ?
2011-11-09 13:53 <zxq9> Yes
2011-11-09 13:53 <zxq9> I'm playing with it now.
2011-11-09 13:53 <nicoe> then it's ok
2011-11-09 13:54 <zxq9> I think I understand this now. Still unsure about the reverse relationship (viewing the relationships from the vehicle side).
2011-11-09 13:54 <zxq9> Thanks for your patience, everyone. You've really helped me a lot here.
2011-11-09 13:58 <zxq9> Out of curiosity, inside the actual database did Tryton create more than 3 tables to handle this relationship? Or just exactly 3?
2011-11-09 14:01 <udono> zxq9: check the database yourself. You can try with psql or pgadmin3.
2011-11-09 14:01 <zxq9> I will
2011-11-09 14:51 <sharoon> zxq9: hi
2011-11-09 15:11 <sharoon> cedk: if you think search would be a relevant topic, we could discuss this at the workshop
2011-11-09 15:11 <sharoon> cedk: i have tried the sphinx integration with tryton and I don't think sphinx is a right fit for us or for any application with an ORM and large set of data
2011-11-09 15:12 <sharoon> cedk: for example it can do delta updates only for SQL data sources
2011-11-09 15:12 <sharoon> cedk: i think SOLR is a better candidate and i could make a POC by then
2011-11-09 15:21 <bechamel> sharoon: there is also xapian, which doesn't have this delta problem
2011-11-09 15:22 <bechamel> and it's easier to deploy, as it's just a library
2011-11-09 15:22 <sharoon> bechamel: ok, never used it
2011-11-09 15:23 <sharoon> bechamel: i would really prefer a separate server which is independent of tryton and is realtime for the purpose, however we could discuss the pros and cons
2011-11-09 15:25 <bechamel> sharoon: afais xapian is "realtime" if realtime means that it's not needed to reconstruct the index periodically
2011-11-09 15:25 <sharoon> bechamel: thats what i meant by realtime
2011-11-09 16:01 <cedk> sharoon: xapian is activated on roundup
2011-11-09 16:01 <sharoon> cedk: won, thats cool, but we have around 2 k records right ?
2011-11-09 16:01 <sharoon> cedk: how do you find the performance ?
2011-11-09 16:01 <sharoon> cedk: and is it schema less ?
2011-11-09 16:02 <cedk> sharoon: don't know it yet enough
2011-11-09 16:03 <bechamel> sharoon: cedk:
2011-11-09 16:04 <sharoon> bechamel: will not fit our needs :( Xapian uses unsigned 32-bit ints for document ids
2011-11-09 16:05 <cedk> sharoon: what is used in PostgreSQL?
2011-11-09 16:06 <bechamel> "Xapian uses unsigned 32-bit ints for document ids, so you're limited to just over 4 billion" -> 4 billion is not enough ?
2011-11-09 16:06 <cedk> bechamel: what is the limit of pg
2011-11-09 16:07 <sharoon> cedk: not about 32 bit IDS, we use strings in some cases as IDs
2011-11-09 16:07 <cedk> sharoon: not in Tryton
2011-11-09 16:07 <sharoon> cedk: the nosql database especially don't come with anything like an integer id
2011-11-09 16:07 <sharoon> cedk: you are right, not in tryton
2011-11-09 16:08 <bechamel> sharoon: cedk: I think those 32-bit int are internal to xapian, no ?
2011-11-09 16:09 <sharoon> bechamel: i think just like sphinx, it should be an unique document identifier and used also in updates of existing records
2011-11-09 16:22 <bechamel> cedk: in postres an integer (what we use for the id col) is 4 bytes (32 bits), see
2011-11-09 16:25 <cedk> bechamel: ok so it is compatible :-)
2011-11-09 16:26 <bechamel> cedk: I think this is wrong to compare those ids with pg ids
2011-11-09 16:27 <bechamel> cedk: xapian is used to index websites, pdf's and mails, and those stuff doesn't have any integer id, but an url
2011-11-09 16:27 <bechamel> so xapian must provide a way to store an external identifier like an url
2011-11-09 16:29 <cedk> bechamel: no, the issue is that xapian should be able to manage as much as postgresql can have of records
2011-11-09 16:32 <bechamel> cedk: if it was a problem one can imagine to use several xapian dbs
2011-11-09 16:33 <bechamel> but maybe we will create several db anyway (one per table)
2011-11-09 16:33 <cedk> bechamel: no because we must index at a least one table per index
2011-11-09 16:35 <bechamel> cedk: ?
2011-11-09 16:36 <cedk> bechamel: the goal of xapian will be to replace search with "ilike"
2011-11-09 16:36 <cedk> bechamel: so you must index at least all records of a table for a columns
2011-11-09 16:38 <bechamel> cedk: yes but we can create one xapian db per tryton model
2011-11-09 16:38 <cedk> bechamel: yes so the goal is to be able to index all the records of a table
2011-11-09 16:42 <bechamel> sharoon, cedk: by the way, it shouldn't be difficult to support several search engine, just like we support several rdbms
2011-11-09 16:43 <cedk> bechamel: not sure because there is no general query language as there is SQL
2011-11-09 16:43 <sharoon> bechamel: i support that too, i think
2011-11-09 16:44 <sharoon> cedk: I think the goal should be just define a pluggable search APIs where the default is the standard search of tryton using postgres alone
2011-11-09 16:44 <sharoon> cedk: currently this is difficult to do
2011-11-09 16:53 <cedk> sharoon, bechamel: I don't think it is doable
2011-11-09 16:53 <cedk> or it will reduce the performence
2011-11-09 16:54 <sharoon> cedk: i have a proposal for the same without affecting performance significantly
2011-11-09 16:54 <sharoon> cedk: we can discuss when we are there
2011-11-09 16:55 <cedk> I even think that once there is a good integration, xapian will be a required dependency
2011-11-09 16:57 <bechamel> cedk: there are no standard for full text search, but we don't complex stuff
2011-11-09 16:57 <bechamel> cedk: just the equivalent of "ilike *word*"
2011-11-09 16:58 -!- pjstevns( has left #tryton
2011-11-09 16:58 <cedk> bechamel: no I think we can do more

Generated by 2.17.3 by Marius Gedminas - find it at!