IRC logs of #tryton for Wednesday, 2014-02-19

chat.freenode.net #tryton log beginning Wed Feb 19 00:00:01 CET 2014
-!- redDave_(~quassel@83.70.138.18) has joined #tryton00:58
-!- cedk(~ced@gentoo/developer/cedk) has joined #tryton01:04
-!- martynushka(o7j3fl9gj7@unaffiliated/martynushka) has joined #tryton01:28
-!- digitalsatori(~Thunderbi@116.234.234.90) has joined #tryton02:12
-!- jcm(~jcm@cxr69-10-88-172-230-130.fbx.proxad.net) has joined #tryton02:21
-!- redDave(~quassel@83.70.138.18) has joined #tryton03:40
-!- breno(~breno@190.237.8.53) has joined #tryton04:32
-!- yangoon1(~mathiasb@p549F16C7.dip0.t-ipconnect.de) has joined #tryton06:01
-!- defyasdf(~defyasdf@ec2-54-234-60-70.compute-1.amazonaws.com) has joined #tryton06:19
-!- frispete(~frispete@p54A93A72.dip0.t-ipconnect.de) has joined #tryton06:40
-!- udono(~udono@ip-109-90-114-182.unitymediagroup.de) has joined #tryton07:20
-!- sharoonthomas(~sharoonth@122.177.202.244) has joined #tryton07:38
-!- pobsteta(~Thunderbi@4cb54-3-88-160-87-54.fbx.proxad.net) has joined #tryton07:44
-!- grasbauer(~jan@ipservice-092-208-143-080.pools.arcor-ip.net) has joined #tryton07:51
-!- mfladischer(~fladische@2a01:4f8:191:4a4:f8c1:98ff:fe1b:f56c) has joined #tryton08:09
-!- vernichon(~Thunderbi@gex01-1-78-234-55-95.fbx.proxad.net) has joined #tryton08:19
-!- corro(~corro@46.22.23.85) has joined #tryton08:28
-!- digitalsatori(~Thunderbi@114.92.211.41) has joined #tryton09:03
-!- grasbauer1(~jan@dslb-092-078-089-071.pools.arcor-ip.net) has joined #tryton09:08
-!- jvblasco(~seba@62.43.196.37.static.user.ono.com) has joined #tryton09:13
-!- jvblasco(~seba@62.43.196.37.static.user.ono.com) has joined #tryton09:23
jvblascomorning everyone09:23
defyasdfmorning09:29
-!- nicoe(~nicoe@109.133.138.125) has joined #tryton09:40
-!- littlebit(~Thunderbi@ulmg-5d8442ee.pool.mediaWays.net) has joined #tryton09:42
-!- digitalsatori(~Thunderbi@114.92.211.41) has joined #tryton09:49
-!- grasbauer(~jan@dslb-092-078-089-071.pools.arcor-ip.net) has joined #tryton09:55
corroIs anyone experienced in stock management in Tryton? What's the intended strategy for assigning goods to outgoing shipments once they are purchased?09:55
-!- cedk(~ced@gentoo/developer/cedk) has joined #tryton10:07
-!- strebitz(~sebastian@91.183.59.105) has joined #tryton10:18
-!- jeancavallo(~giovanni@LVelizy-156-46-68-52.w80-12.abo.wanadoo.fr) has joined #tryton10:49
-!- Telesight(~anthony@77-175-168-222.FTTH.ispfabriek.nl) has joined #tryton10:51
-!- jeancavallo(~giovanni@LVelizy-156-46-68-52.w80-12.abo.wanadoo.fr) has left #tryton11:06
-!- jeancavallo(~giovanni@LVelizy-156-46-68-52.w80-12.abo.wanadoo.fr) has joined #tryton11:07
-!- sharoonthomas(~sharoonth@122.177.202.244) has joined #tryton11:24
-!- sharoonthomas(~sharoonth@122.177.202.244) has joined #tryton12:03
-!- grasbauer(~jan@dslb-092-078-089-071.pools.arcor-ip.net) has joined #tryton12:21
-!- smarro(~sebastian@200.107.230.29) has joined #tryton12:31
-!- vcardon(~vcardon@LNeuilly-152-23-15-185.w193-252.abo.wanadoo.fr) has joined #tryton12:35
-!- nicoe(~nicoe@2001:6f8:3aa:0:b699:baff:fe56:2328) has joined #tryton12:41
jvblascocan anyone point me some code making use of function fields? Not the field definition, the usage of the field.13:47
jvblascoi'm trying to understand how do function fields exactly work, they seem powerfull but i cannot figure out how to use them just from the API documentation.13:48
meanmiciojvblasco : check the patient age in GNU Health13:49
jvblascomeanmicio: where i find the code? i mean, do u have any public repo i can check?13:54
jvblascowhere can i*13:54
jeancavallojvblasco: Have a look here : http://hg.tryton.org/modules/account/file/a1176be9fa2d/party.py#l5713:55
meanmiciojvblasco : http://health.gnu.org or the mercurial repo http://hg.savannah.gnu.org/hgweb/health/13:55
jeancavallojvblasco: Function fields are useful to display / search calculated data based on the stored columns of the model13:56
jeancavallojvblasco: To use them in your code, they are supposed to behave as normal fields, except for the fact that they cannot be set (unless you define the setter function)13:56
jvblascojeancavallo: but can i use them like normal fields. eg: Party.my_function_field?13:57
jeancavallojvblasco: yes13:57
jvblascojeancavallo: and display them in views without problems?13:57
jeancavallojvblasco: A few limitations : no setting (unless explicitely allowed in the field definition), not calculated while the record is not saved13:57
jeancavallojvblasco: As I said, if you display the view on an already existing record, no problem13:59
jeancavallojvblasco: If you want your function field to be calculated even though the record is not yet saved, the best approach is to use an on_change_with on your field, and use it as the getter of the function field.14:00
jvblascojeancavallo: ic14:00
jvblascojeancavallo: and do i need to implement the getter to be able to use it like a normal field?14:01
jeancavallojvblasco: Function fields are very powerful, but there are some tricks to know :)14:01
jeancavallojvblasco: Well, if you don't tryton will have no way to know what is the value of your field14:01
jeancavallojvblasco: And I think the getter is mandatory ;)14:02
jeancavallojvblasco: The setter / searcher are not though14:02
jvblascojeancavallo: i will need to experiment with that14:02
jeancavallojvblasco: Good luck14:03
jvblascojeancavallo: it REALLY looks powerfull14:03
jeancavallojvblasco: The link I sent you is some of the best use you can have14:03
jeancavallojvblasco: The getter is a classmethod (it can be an instance method as well), so the computation is done at the database level for lists of records14:03
jeancavallojvblasco: It is a little complex though.14:04
jeancavallojvblasco: Another example is "rec_name". When you override get_rec_name, you override the getter of the function field "rec_name" (sort of)14:05
jvblascojeancavallo: i already realized about complexity14:05
jvblascojeancavallo: so, to check my understanding, in the link with the def get_receivable_payable(cls, parties, names): i guess parties are party instances, and names are the name of the fields u want to use?14:06
jvblascojeancavallo: i don't really understand the method signature14:06
jeancavallojvblasco: That's it14:08
jeancavallojvblasco: You can use the same method as a getter for multiple fields (hence the "name" parameter14:08
jvblascojeancavallo: i will try to implement one for a use case i have around the code, i hope to be able to with that explanation14:10
jvblascojeancavallo: i think i understand them a little better now ;)14:10
jvblascojeancavallo: thnx so much for all the help14:10
jeancavallojvblasco: np14:13
-!- Streward(~quassel@85.183.31.24) has joined #tryton14:35
-!- littlebit(~Thunderbi@ulmg-5d8442ee.pool.mediaWays.net) has joined #tryton14:46
-!- vernichon(~Thunderbi@gex01-1-78-234-55-95.fbx.proxad.net) has joined #tryton15:29
-!- pablovannini(~pablo@181.47.181.28) has joined #tryton15:45
jvblascojeancavallo: u said that usually function fields are implemented as classmethods, but that sometimes can be implemented as instance methods, how do i know which one is the best way for a precise impelmentation?15:57
jeancavallojvblasco: It is the opposite15:58
jeancavallojvblasco: Usually they are implemented as instance method15:58
jvblascojeancavallo: i c, and how do i know when a classmethod is more convenient?15:59
jeancavallojvblasco: The use of classmethod is for when the computation is rather db intensive (aggregates...), so it is more efficient to to it by groups15:59
jvblascojeancavallo: i c, 1000 thnx ;)15:59
jeancavallojvblasco: The example I sent earlier is db intensive, so it is a classmethod16:00
jeancavallojvblasco: Bottom line is : classmethod when you have performance issues can help16:00
jvblascojeancavallo: ok, not my case right now, i hope ;)16:01
corrojvblasco: also getter instance methods can often also be used as on_change method at the same time. this can be an advantage (less duplication).16:01
jvblascocorro, jeancavallo: that could be usefull for realtime view value rendering, as jean was sugesting b4?16:02
jeancavallojvblasco: yeah16:02
jvblascojeancavallo, corro: i c16:03
jeancavallojvblasco: my_field = fields.Function(fields.Char('Party Name', on_change_with=['party']), 'on_change_with_my_field')16:03
jvblascoomg16:03
jeancavallojvblasco: Just do not forget to add a name=None parameter in the on_change_with_my_field definition so it is both callable as a on_change_with and as a function field getter16:03
jvblascojeancavallo: i c16:04
jvblascobtw the getter signature is getter(self, models, names), in case of instance methods what will i receive to models when i try to use the fields as a regular field?16:05
jvblascoand do i receive instances, or just the class?16:05
jvblascosry about this but those fields, as powerfull as they are, they are rather complex too16:05
jvblascoin the example i see it receives parties, but i can't figure out how those parties list is generated16:07
jeancavallojvblasco: It is automatic. You should never have to call the getter manually16:09
jeancavallojvblasco: and the signature for instance methods is : def my_getter(self, name) where name will be the field calling the getter16:10
-!- strebitz(~sebastian@91.183.59.105) has left #tryton16:10
jvblascoso no models in the call?16:13
jvblascoi guess it's because the example b4 is a classmethod and not an instance one16:16
jvblascocould it be?16:16
jeancavallojvblasco: If you mean the party.receivable / payable, yes16:16
jvblascoand what do i need to return in the getter function? i mean the structure. In my case i'm making a Function field for a boolean field16:34
cedkjvblasco: http://doc.tryton.org/3.0/trytond/doc/ref/models/fields.html?highlight=function#trytond.model.fields.Function.getter16:35
jvblascocedk: but i don't know from those docs the structure of the value i need to return16:36
jvblascocedk: if i return a boolean and exception is rised16:36
jvblascocedk: TypeError: 'bool' object has no attribute '__getitem__'16:37
jeancavallojvblasco: What is the exception ? You should return the type corresponding to the main field (integers for M2O !)16:37
cedkjvblasco: the doc is pretty clear about the return16:37
jeancavallojvblasco: It means you are using a classmethod, so it's expected to return a dict matching ids and values16:38
cedkjvblasco: but of course it is abvious that the value is the value16:38
jvblascocedk, jeancavallo: so in a definition: fields.Function(fields.Boolean('Blackout') the getter i guess must return a boolean, doesn't it?16:40
jvblascoi'm implementing the getter as an instance method with def get_blackout(self, names): signature16:42
cedkjvblasco: names -> name16:42
jvblascojeancavallo, cedk: that was the issue, thnx so much both of you for the help16:45
jvblascocedk: btw, u were right, in the documentation is clear the return value16:53
-!- grasbauer(~jan@dslb-092-078-089-071.pools.arcor-ip.net) has joined #tryton17:19
-!- rafiu(~Adium@host81-139-178-190.in-addr.btopenworld.com) has joined #tryton17:34
-!- grasbauer(~jan@dslb-092-078-089-071.pools.arcor-ip.net) has joined #tryton17:49
jvblascoi'm trying to figure out what tuples does the searcher need to return, but i cannot seem to18:59
jvblascoi created a model Website with a m2o relation to a party, the party has a o2m relation to the website model19:00
jvblascothe website model has a blackout boolean field19:00
jvblascothe party has a Function field that checks if any of his websites is in blackout19:00
jvblascoif any one of those is, then the field sets to True19:01
jvblascoif not to false19:01
jvblascobut i want to search if a party has a blackout19:01
jvblascousing the function field, what means a searcher needs to be implemented19:01
jvblascobut i can't figure out the list of tuples the searcher needs to return19:02
jvblascofor example: Party.search([('blackout', '=', True)])19:03
jvblascowhat will the tupple the searcher returns contain?19:03
jvblasco[('party.id', '=', party.id)]?19:05
jvblascofor parties that have a web with blackout = True?19:05
jvblascoi don't really get what is done with that list of tuples, or what it is for19:05
jvblascosry for the text wall19:07
cedkjvblasco: http://doc.tryton.org/3.0/trytond/doc/ref/models/fields.html?highlight=function#trytond.model.fields.Function.searcher19:08
jvblascobut i don't understand what does the domain it returns contain19:09
cedkjvblasco: read the domain doc19:10
-!- grasbauer(~jan@dslb-092-078-089-071.pools.arcor-ip.net) has joined #tryton19:16
-!- zodman(~zodman@foresight/developer/zodman) has joined #tryton19:18
-!- cjbarnes18(~craig@host31-54-129-199.range31-54.btcentralplus.com) has joined #tryton19:45
-!- chitrank(~chitrank@113.193.107.176) has joined #tryton20:28
chitrankHello Tryton developers20:28
-!- cjbarnes18(~craig@host31-54-129-199.range31-54.btcentralplus.com) has joined #tryton20:37
-!- grasbauer1(~jan@dslb-092-078-089-071.pools.arcor-ip.net) has joined #tryton20:55
-!- pobsteta(~Thunderbi@4cb54-3-88-160-87-54.fbx.proxad.net) has joined #tryton21:11
-!- pobsteta(~Thunderbi@4cb54-3-88-160-87-54.fbx.proxad.net) has joined #tryton21:13
-!- frispete(~frispete@p54A93A72.dip0.t-ipconnect.de) has joined #tryton21:50
-!- yangoon1(~mathiasb@p549F16C7.dip0.t-ipconnect.de) has left #tryton21:54
-!- yangoon(~mathiasb@p549F16C7.dip0.t-ipconnect.de) has joined #tryton22:27
-!- smarro(~sebastian@201.251.135.150) has joined #tryton22:42
-!- swayf(~swayf@188-193-123-49-dynip.superkabel.de) has joined #tryton22:47

Generated by irclog2html.py 2.11.0 by Marius Gedminas - find it at mg.pov.lt!