IRC logs of #tryton for Thursday, 2016-05-05

chat.freenode.net #tryton log beginning Thu May 5 00:00:02 CEST 2016
-!- niki_(~niki@0x3e2c865f.mobile.telia.dk) has joined #tryton04:09
-!- jvblasco(~seba@185.39.42.129) has joined #tryton04:16
-!- kstenger1(~karla@r186-54-42-21.dialup.adsl.anteldata.net.uy) has joined #tryton04:19
-!- shrox(~shrox@182.56.121.50) has joined #tryton04:48
-!- shrox(~shrox@182.56.111.212) has joined #tryton05:46
-!- shrox(~shrox@182.56.78.158) has joined #tryton06:17
-!- cedk(~ced@gentoo/developer/cedk) has joined #tryton07:16
-!- frispete(~frispete@p54A909A5.dip0.t-ipconnect.de) has joined #tryton07:40
-!- jvblasco(~seba@185.39.42.129) has joined #tryton07:53
-!- jvblasco(~seba@2.47.14.62.static.jazztel.es) has joined #tryton08:38
-!- shrox(~shrox@182.56.94.75) has joined #tryton08:44
-!- ccaz(~ccr@ax313-1-82-66-159-99.fbx.proxad.net) has joined #tryton09:14
-!- shrox(~shrox@182.56.82.191) has joined #tryton09:23
-!- meigallodixital(~meigallod@249.135.116.91.static.reverse-mundo-r.com) has joined #tryton09:24
-!- Telesight(~anthony@4dae0c97.ftth.telfortglasvezel.nl) has joined #tryton10:04
-!- sisalp(~sisalpuse@boxoo.sisalp.net) has joined #tryton10:14
-!- jvblasco_(~seba@2.47.14.62.static.jazztel.es) has joined #tryton11:04
-!- shrox(~shrox@182.56.82.191) has joined #tryton11:09
-!- shrox(~shrox@182.56.82.191) has joined #tryton11:16
-!- shrox(~shrox@182.56.117.208) has joined #tryton11:45
-!- shrox(~shrox@182.56.80.184) has joined #tryton12:08
-!- csotelo_at_work(~csotelo@200.4.199.12) has joined #tryton12:46
-!- mariomop(~quassel@181.92.3.166) has joined #tryton13:00
-!- shrox(~shrox@182.56.106.130) has joined #tryton13:02
-!- shrox(~shrox@182.56.110.118) has joined #tryton13:22
-!- smarro_(~sebastian@181.16.7.104) has joined #tryton13:33
-!- shrox(~shrox@182.56.110.126) has joined #tryton13:50
-!- shrox(~shrox@182.56.122.55) has joined #tryton14:10
-!- shrox(~shrox@182.56.75.37) has joined #tryton14:31
-!- seba__(~seba@2.47.14.62.static.jazztel.es) has joined #tryton14:47
-!- shrox(~shrox@182.56.81.104) has joined #tryton14:55
-!- clews(~cch@www.lycee.asn-wien.ac.at) has joined #tryton15:08
clewsHi all, i have a question about updating a one2many field using on_change_with_*15:09
clewswhat should i return exactly? In fact i want to add a list of ids to the field.15:09
-!- clews_(~cch@www.lycee.asn-wien.ac.at) has joined #tryton15:14
-!- clews(~cch@www.lycee.asn-wien.ac.at) has left #tryton15:14
-!- shrox(~shrox@182.56.86.115) has joined #tryton15:35
pokoliclews_: which tryton version are you on?15:50
clews_3.815:55
-!- lukio(~lukio@host126.186-109-85.telecom.net.ar) has joined #tryton15:59
-!- kstenger(~karla@r186-54-42-21.dialup.adsl.anteldata.net.uy) has joined #tryton16:04
clews_pokoli: according to what i found it should be something like {O2M: {'add': .... }}16:06
-!- shrox(~shrox@182.56.90.199) has joined #tryton16:08
pokoliclews_: this is the old version. On 3.8 version you should directly assign the records on the instance. So self.<one2many_field>.append(Instance) should do it16:09
clews_pokoli: thank, i'm trying it out...16:14
clews_pokoli: I get 'ticket.sale' model has no attribute <one2many_field>16:18
-!- kstenger1(~karla@r186-54-30-196.dialup.adsl.anteldata.net.uy) has joined #tryton16:21
-!- jvblasco_(~seba@2.47.14.62.static.jazztel.es) has joined #tryton16:24
pokoliclews_: you should change <one2manye_field> with the name of your field16:26
clews_pokoli: of course ;-) Did that...16:27
clews_pokoli: have: tickets = fields.One2Many('ticket.ticket', 'sale', "Tickets")16:28
pokoliclews_: sorry, so you should have the field name on the depends decorator of your on_change function16:28
pokoliclews_: otherwise the field is not accessible in the function16:28
pokoliclews_: And IRRC the append that I pointed eraly should not work as one2many are now tupples16:29
pokoliclews_: so you should create a new tuple with the previous values and the ones you want to add, and assign them to the fields16:30
clews_pokoli: yes, got 'tuple' object has no attribute 'append'16:30
pokoliclews_: sorry for the confusion :(16:31
clews_pokoli: okay... I'll investigate that... No problem thanks for help... :)16:31
-!- JosDzG(~Thunderbi@201.157.45.34) has joined #tryton16:34
pokoliclews_: basically: you have to something similar to: lines = list(self.lines); lines.append(new_line); self.lines = lines16:35
clews_pokoli: hmmm strange... Did that, but it creates me new empty records instead of adding them...16:45
clews_pokoli: did: lines = list(self.lines); lines.append(new_line); self.lines = tuple(lines)16:46
clews_pokoli: but dispatcher sends. [{'tickets': defaultdict(<type 'list'>, {'add': [(0, {}), (1, {})]})}]16:46
pokoliclews_: how you define the new_line? Could you please use pastebin to paste the full code?16:48
clews_pokoli: here is the code: http://pastebin.com/fibXY6Ep16:50
pokoliclews_: Just curious why you copy the tickets from reservation instead of using a functional field that returns the reservation tickets16:51
pokoliclews_: reservation.ticket Model is also ticket.ticket. If they are diferent models you need to create a new instance and copy data between both instances. So that would explain the {} in the return value16:53
-!- JosDzGx(~Thunderbi@201.157.45.34) has joined #tryton16:54
clews_pokoli: reservation.tickets is also ticket.ticket, yes16:55
clews_pokoli: i don't use a functional field, because on sale some tickets could be removed manually (without touching the reservation)....16:57
pokoliclews_: but you want the tickets to be releated to both models. So you have to copy them and assign them to ticket.sale16:57
pokoliclews_: so the on_change won't work as they are executed on a readonly transaction16:58
pokoliclews_: so you have to create new instances of ticket.ticket with the same values and return them16:58
clews_pokoli: okay... i see... In fact the number of tickets should be kept constant... Will have to work with a functional field and do the ticket update elsewhere...16:59
clews_pokoli: am i right?16:59
pokoliclews_: now, you can create new tickets via on_change17:00
pokoliclews_: BTW, i'm wondering if you should use Many2Many instead of One2Many17:00
pokoliclews_: as the same ticket can be referenced on reservation and ticket17:01
clews_pokoli: I've seen this as reservation<1-n>ticket and sale<1-n>ticket as separate entities....17:02
pokoliclews_: something like http://pastebin.com/8Ljr1ZZT will copy tickets from reservation to sale. But make sure to copy the tickets fields values on the commented linke17:03
clews_pokoli: each ticket can be reserver once and sold once only...17:03
pokoliclews_: what you say will work with a button.17:03
pokoliclews_: as buttons are not executed in a readonly transaction and you can relate all the tickets to both entities17:04
pokoliclews_: you can also use the add_remove attribute to allow the user to select existing tickets of the reservation17:05
clews_pokoli: Yep, will give the button a try ;-) Thanks a lot for your time! wasn't aware of this readonly transactions....17:05
pokoliclews_: http://doc.tryton.org/4.0/trytond/doc/ref/models/fields.html?highlight=add_remove#trytond.model.fields.One2Many.add_remove17:05
pokoliclews_: have a look at the add_remove with the reservation domain, for me it's the more trytonic way17:05
clews_pokoli: Yes, already have done this, because "free" tickets can also be sold.... Removed the add_remove for debugging and focusing on the problem....17:06
pokoliclews_:  but for me you first on_change code should also work. So it's strange that returns {} if they are the same model17:07
clews_pokoli: it's a module for a theatre, the handle a lot of tickets and need to sell them very quickly (reserved, non-reserved...) so i try to make it as easy and fast as possible...17:08
-!- shrox(~shrox@182.56.67.106) has joined #tryton17:09
clews_pokoli: Perhaps cedric will have the answer... I could post that on google groups?17:10
pokoliACTION was reading the code17:10
pokoliclews_: Yes please post in the mailing list. As I see that on_change only return the changed values of the target_records, but in your case nothing is changed so it always returns {}.17:12
pokoliclews_: not sure if you full understand the problem, but the key of all is the double relation (which is not a common pattern)17:14
clews_pokoli: I see the special use i make... The proper way on selling one ticket less than made on a reservation would be to change the reservation first17:18
clews_pokoli: and then make the sale process using only a functional field and the reference to the reservation...17:19
clews_pokoli: but i fear that there would be too much steps for the cashier... most of the time there are 5-10 people waiting in a line ;-)17:20
clews_pokoli: My button function is on the way and should do the trick ;-) Thanks again for your patience and time...17:22
pokoliclews_: button is one click more but it will do the trick17:23
pokoliclews_: but i'm waiting for your post on the mailing list to discuss which is the correct behaviour with your special case :)17:25
-!- shrox(~shrox@182.56.70.180) has joined #tryton17:32
clews_pokoli: Posted... And my button is working like a charm ;-)17:36
pokoliclews_: So lets wait for another reply (diferent than mine), to know if your users can save the button extra-click :)17:44
-!- perilla(~perilla@corp-190-57-169-210-cue.puntonet.ec) has joined #tryton18:06
-!- bvillasanti(~bvillasan@190.105.73.145) has joined #tryton19:16
-!- shrox(~shrox@182.56.115.21) has joined #tryton19:21
-!- lukio(~lukio@186.19.70.16) has joined #tryton19:24
-!- shrox(~shrox@182.56.83.126) has joined #tryton20:08
-!- shrox(~shrox@182.56.73.72) has joined #tryton21:17
-!- leio(~leio@gentoo/developer/leio) has joined #tryton21:23
-!- lukio(~lukio@186.19.70.16) has joined #tryton22:06
-!- lucas1984(beb0d127@gateway/web/freenode/ip.190.176.209.39) has joined #tryton23:20
lucas1984Hola23:21
lucas1984Consulta23:21
lucas1984me esta generando este error al imprimir la factura23:21
kstengerhola lucas, este canal es para ingles, podes entrar en #tryton-es para espaƱol23:21
lucas1984ok23:21
lucas1984hello23:22
lucas1984Query23:22
lucas1984I is generating this error when you print the invoice23:22
lucas1984Error :<ProtocolError for localhost:8005/prueba2016: 500 Internal Server Error>23:23
lucas1984None23:23
-!- jvblasco(~seba@185.39.42.129) has joined #tryton23:40
-!- JosDzG(~Thunderbi@201.157.45.34) has joined #tryton23:50

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