chat.freenode.net #tryton log beginning Thu May 5 00:00:02 CEST 2016 | ||
2016-05-05 04:09 -!- niki_(~niki@0x3e2c865f.mobile.telia.dk) has joined #tryton | ||
2016-05-05 04:16 -!- jvblasco(~seba@185.39.42.129) has joined #tryton | ||
2016-05-05 04:19 -!- kstenger1(~karla@r186-54-42-21.dialup.adsl.anteldata.net.uy) has joined #tryton | ||
2016-05-05 04:48 -!- shrox(~shrox@182.56.121.50) has joined #tryton | ||
2016-05-05 05:46 -!- shrox(~shrox@182.56.111.212) has joined #tryton | ||
2016-05-05 06:17 -!- shrox(~shrox@182.56.78.158) has joined #tryton | ||
2016-05-05 07:16 -!- cedk(~ced@gentoo/developer/cedk) has joined #tryton | ||
2016-05-05 07:40 -!- frispete(~frispete@p54A909A5.dip0.t-ipconnect.de) has joined #tryton | ||
2016-05-05 07:53 -!- jvblasco(~seba@185.39.42.129) has joined #tryton | ||
2016-05-05 08:38 -!- jvblasco(~seba@2.47.14.62.static.jazztel.es) has joined #tryton | ||
2016-05-05 08:44 -!- shrox(~shrox@182.56.94.75) has joined #tryton | ||
2016-05-05 09:14 -!- ccaz(~ccr@ax313-1-82-66-159-99.fbx.proxad.net) has joined #tryton | ||
2016-05-05 09:23 -!- shrox(~shrox@182.56.82.191) has joined #tryton | ||
2016-05-05 09:24 -!- meigallodixital(~meigallod@249.135.116.91.static.reverse-mundo-r.com) has joined #tryton | ||
2016-05-05 10:04 -!- Telesight(~anthony@4dae0c97.ftth.telfortglasvezel.nl) has joined #tryton | ||
2016-05-05 10:14 -!- sisalp(~sisalpuse@boxoo.sisalp.net) has joined #tryton | ||
2016-05-05 11:04 -!- jvblasco_(~seba@2.47.14.62.static.jazztel.es) has joined #tryton | ||
2016-05-05 11:09 -!- shrox(~shrox@182.56.82.191) has joined #tryton | ||
2016-05-05 11:16 -!- shrox(~shrox@182.56.82.191) has joined #tryton | ||
2016-05-05 11:45 -!- shrox(~shrox@182.56.117.208) has joined #tryton | ||
2016-05-05 12:08 -!- shrox(~shrox@182.56.80.184) has joined #tryton | ||
2016-05-05 12:46 -!- csotelo_at_work(~csotelo@200.4.199.12) has joined #tryton | ||
2016-05-05 13:00 -!- mariomop(~quassel@181.92.3.166) has joined #tryton | ||
2016-05-05 13:02 -!- shrox(~shrox@182.56.106.130) has joined #tryton | ||
2016-05-05 13:22 -!- shrox(~shrox@182.56.110.118) has joined #tryton | ||
2016-05-05 13:33 -!- smarro_(~sebastian@181.16.7.104) has joined #tryton | ||
2016-05-05 13:50 -!- shrox(~shrox@182.56.110.126) has joined #tryton | ||
2016-05-05 14:10 -!- shrox(~shrox@182.56.122.55) has joined #tryton | ||
2016-05-05 14:31 -!- shrox(~shrox@182.56.75.37) has joined #tryton | ||
2016-05-05 14:47 -!- seba__(~seba@2.47.14.62.static.jazztel.es) has joined #tryton | ||
2016-05-05 14:55 -!- shrox(~shrox@182.56.81.104) has joined #tryton | ||
2016-05-05 15:08 -!- clews(~cch@www.lycee.asn-wien.ac.at) has joined #tryton | ||
2016-05-05 15:09 <clews> Hi all, i have a question about updating a one2many field using on_change_with_* | ||
2016-05-05 15:09 <clews> what should i return exactly? In fact i want to add a list of ids to the field. | ||
2016-05-05 15:14 -!- clews_(~cch@www.lycee.asn-wien.ac.at) has joined #tryton | ||
2016-05-05 15:14 -!- clews(~cch@www.lycee.asn-wien.ac.at) has left #tryton | ||
2016-05-05 15:35 -!- shrox(~shrox@182.56.86.115) has joined #tryton | ||
2016-05-05 15:50 <pokoli> clews_: which tryton version are you on? | ||
2016-05-05 15:55 <clews_> 3.8 | ||
2016-05-05 15:59 -!- lukio(~lukio@host126.186-109-85.telecom.net.ar) has joined #tryton | ||
2016-05-05 16:04 -!- kstenger(~karla@r186-54-42-21.dialup.adsl.anteldata.net.uy) has joined #tryton | ||
2016-05-05 16:06 <clews_> pokoli: according to what i found it should be something like {O2M: {'add': .... }} | ||
2016-05-05 16:08 -!- shrox(~shrox@182.56.90.199) has joined #tryton | ||
2016-05-05 16:09 <pokoli> clews_: 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 it | ||
2016-05-05 16:14 <clews_> pokoli: thank, i'm trying it out... | ||
2016-05-05 16:18 <clews_> pokoli: I get 'ticket.sale' model has no attribute <one2many_field> | ||
2016-05-05 16:21 -!- kstenger1(~karla@r186-54-30-196.dialup.adsl.anteldata.net.uy) has joined #tryton | ||
2016-05-05 16:24 -!- jvblasco_(~seba@2.47.14.62.static.jazztel.es) has joined #tryton | ||
2016-05-05 16:26 <pokoli> clews_: you should change <one2manye_field> with the name of your field | ||
2016-05-05 16:27 <clews_> pokoli: of course ;-) Did that... | ||
2016-05-05 16:28 <clews_> pokoli: have: tickets = fields.One2Many('ticket.ticket', 'sale', "Tickets") | ||
2016-05-05 16:28 <pokoli> clews_: sorry, so you should have the field name on the depends decorator of your on_change function | ||
2016-05-05 16:28 <pokoli> clews_: otherwise the field is not accessible in the function | ||
2016-05-05 16:29 <pokoli> clews_: And IRRC the append that I pointed eraly should not work as one2many are now tupples | ||
2016-05-05 16:30 <pokoli> clews_: so you should create a new tuple with the previous values and the ones you want to add, and assign them to the fields | ||
2016-05-05 16:30 <clews_> pokoli: yes, got 'tuple' object has no attribute 'append' | ||
2016-05-05 16:31 <pokoli> clews_: sorry for the confusion :( | ||
2016-05-05 16:31 <clews_> pokoli: okay... I'll investigate that... No problem thanks for help... :) | ||
2016-05-05 16:34 -!- JosDzG(~Thunderbi@201.157.45.34) has joined #tryton | ||
2016-05-05 16:35 <pokoli> clews_: basically: you have to something similar to: lines = list(self.lines); lines.append(new_line); self.lines = lines | ||
2016-05-05 16:45 <clews_> pokoli: hmmm strange... Did that, but it creates me new empty records instead of adding them... | ||
2016-05-05 16:46 <clews_> pokoli: did: lines = list(self.lines); lines.append(new_line); self.lines = tuple(lines) | ||
2016-05-05 16:46 <clews_> pokoli: but dispatcher sends. [{'tickets': defaultdict(<type 'list'>, {'add': [(0, {}), (1, {})]})}] | ||
2016-05-05 16:48 <pokoli> clews_: how you define the new_line? Could you please use pastebin to paste the full code? | ||
2016-05-05 16:50 <clews_> pokoli: here is the code: http://pastebin.com/fibXY6Ep | ||
2016-05-05 16:51 <pokoli> clews_: Just curious why you copy the tickets from reservation instead of using a functional field that returns the reservation tickets | ||
2016-05-05 16:53 <pokoli> clews_: 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 value | ||
2016-05-05 16:54 -!- JosDzGx(~Thunderbi@201.157.45.34) has joined #tryton | ||
2016-05-05 16:55 <clews_> pokoli: reservation.tickets is also ticket.ticket, yes | ||
2016-05-05 16:57 <clews_> pokoli: i don't use a functional field, because on sale some tickets could be removed manually (without touching the reservation).... | ||
2016-05-05 16:57 <pokoli> clews_: but you want the tickets to be releated to both models. So you have to copy them and assign them to ticket.sale | ||
2016-05-05 16:58 <pokoli> clews_: so the on_change won't work as they are executed on a readonly transaction | ||
2016-05-05 16:58 <pokoli> clews_: so you have to create new instances of ticket.ticket with the same values and return them | ||
2016-05-05 16:59 <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... | ||
2016-05-05 16:59 <clews_> pokoli: am i right? | ||
2016-05-05 17:00 <pokoli> clews_: now, you can create new tickets via on_change | ||
2016-05-05 17:00 <pokoli> clews_: BTW, i'm wondering if you should use Many2Many instead of One2Many | ||
2016-05-05 17:01 <pokoli> clews_: as the same ticket can be referenced on reservation and ticket | ||
2016-05-05 17:02 <clews_> pokoli: I've seen this as reservation<1-n>ticket and sale<1-n>ticket as separate entities.... | ||
2016-05-05 17:03 <pokoli> clews_: 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 linke | ||
2016-05-05 17:03 <clews_> pokoli: each ticket can be reserver once and sold once only... | ||
2016-05-05 17:03 <pokoli> clews_: what you say will work with a button. | ||
2016-05-05 17:04 <pokoli> clews_: as buttons are not executed in a readonly transaction and you can relate all the tickets to both entities | ||
2016-05-05 17:05 <pokoli> clews_: you can also use the add_remove attribute to allow the user to select existing tickets of the reservation | ||
2016-05-05 17:05 <clews_> pokoli: Yep, will give the button a try ;-) Thanks a lot for your time! wasn't aware of this readonly transactions.... | ||
2016-05-05 17:05 <pokoli> clews_: http://doc.tryton.org/4.0/trytond/doc/ref/models/fields.html?highlight=add_remove#trytond.model.fields.One2Many.add_remove | ||
2016-05-05 17:05 <pokoli> clews_: have a look at the add_remove with the reservation domain, for me it's the more trytonic way | ||
2016-05-05 17:06 <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.... | ||
2016-05-05 17:07 <pokoli> clews_: but for me you first on_change code should also work. So it's strange that returns {} if they are the same model | ||
2016-05-05 17:08 <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... | ||
2016-05-05 17:09 -!- shrox(~shrox@182.56.67.106) has joined #tryton | ||
2016-05-05 17:10 <clews_> pokoli: Perhaps cedric will have the answer... I could post that on google groups? | ||
2016-05-05 17:10 <pokoli> ACTION was reading the code | ||
2016-05-05 17:12 <pokoli> clews_: 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 {}. | ||
2016-05-05 17:14 <pokoli> clews_: not sure if you full understand the problem, but the key of all is the double relation (which is not a common pattern) | ||
2016-05-05 17:18 <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 first | ||
2016-05-05 17:19 <clews_> pokoli: and then make the sale process using only a functional field and the reference to the reservation... | ||
2016-05-05 17:20 <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 ;-) | ||
2016-05-05 17:22 <clews_> pokoli: My button function is on the way and should do the trick ;-) Thanks again for your patience and time... | ||
2016-05-05 17:23 <pokoli> clews_: button is one click more but it will do the trick | ||
2016-05-05 17:25 <pokoli> clews_: but i'm waiting for your post on the mailing list to discuss which is the correct behaviour with your special case :) | ||
2016-05-05 17:32 -!- shrox(~shrox@182.56.70.180) has joined #tryton | ||
2016-05-05 17:36 <clews_> pokoli: Posted... And my button is working like a charm ;-) | ||
2016-05-05 17:44 <pokoli> clews_: So lets wait for another reply (diferent than mine), to know if your users can save the button extra-click :) | ||
2016-05-05 18:06 -!- perilla(~perilla@corp-190-57-169-210-cue.puntonet.ec) has joined #tryton | ||
2016-05-05 19:16 -!- bvillasanti(~bvillasan@190.105.73.145) has joined #tryton | ||
2016-05-05 19:21 -!- shrox(~shrox@182.56.115.21) has joined #tryton | ||
2016-05-05 19:24 -!- lukio(~lukio@186.19.70.16) has joined #tryton | ||
2016-05-05 20:08 -!- shrox(~shrox@182.56.83.126) has joined #tryton | ||
2016-05-05 21:17 -!- shrox(~shrox@182.56.73.72) has joined #tryton | ||
2016-05-05 21:23 -!- leio(~leio@gentoo/developer/leio) has joined #tryton | ||
2016-05-05 22:06 -!- lukio(~lukio@186.19.70.16) has joined #tryton | ||
2016-05-05 23:20 -!- lucas1984(beb0d127@gateway/web/freenode/ip.190.176.209.39) has joined #tryton | ||
2016-05-05 23:21 <lucas1984> Hola | ||
2016-05-05 23:21 <lucas1984> Consulta | ||
2016-05-05 23:21 <lucas1984> me esta generando este error al imprimir la factura | ||
2016-05-05 23:21 <kstenger> hola lucas, este canal es para ingles, podes entrar en #tryton-es para espaƱol | ||
2016-05-05 23:21 <lucas1984> ok | ||
2016-05-05 23:22 <lucas1984> hello | ||
2016-05-05 23:22 <lucas1984> Query | ||
2016-05-05 23:22 <lucas1984> I is generating this error when you print the invoice | ||
2016-05-05 23:23 <lucas1984> Error :<ProtocolError for localhost:8005/prueba2016: 500 Internal Server Error> | ||
2016-05-05 23:23 <lucas1984> None | ||
2016-05-05 23:40 -!- jvblasco(~seba@185.39.42.129) has joined #tryton | ||
2016-05-05 23:50 -!- JosDzG(~Thunderbi@201.157.45.34) has joined #tryton |
Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!