IRC logs of #tryton for Thursday, 2016-05-05 #tryton log beginning Thu May 5 00:00:02 CEST 2016
-!- niki_( has joined #tryton04:09
-!- jvblasco(~seba@ has joined #tryton04:16
-!- kstenger1( has joined #tryton04:19
-!- shrox(~shrox@ has joined #tryton04:48
-!- shrox(~shrox@ has joined #tryton05:46
-!- shrox(~shrox@ has joined #tryton06:17
-!- cedk(~ced@gentoo/developer/cedk) has joined #tryton07:16
-!- frispete( has joined #tryton07:40
-!- jvblasco(~seba@ has joined #tryton07:53
-!- jvblasco( has joined #tryton08:38
-!- shrox(~shrox@ has joined #tryton08:44
-!- ccaz( has joined #tryton09:14
-!- shrox(~shrox@ has joined #tryton09:23
-!- meigallodixital( has joined #tryton09:24
-!- Telesight( has joined #tryton10:04
-!- sisalp( has joined #tryton10:14
-!- jvblasco_( has joined #tryton11:04
-!- shrox(~shrox@ has joined #tryton11:09
-!- shrox(~shrox@ has joined #tryton11:16
-!- shrox(~shrox@ has joined #tryton11:45
-!- shrox(~shrox@ has joined #tryton12:08
-!- csotelo_at_work(~csotelo@ has joined #tryton12:46
-!- mariomop(~quassel@ has joined #tryton13:00
-!- shrox(~shrox@ has joined #tryton13:02
-!- shrox(~shrox@ has joined #tryton13:22
-!- smarro_(~sebastian@ has joined #tryton13:33
-!- shrox(~shrox@ has joined #tryton13:50
-!- shrox(~shrox@ has joined #tryton14:10
-!- shrox(~shrox@ has joined #tryton14:31
-!- seba__( has joined #tryton14:47
-!- shrox(~shrox@ has joined #tryton14:55
-!- clews( 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_( has joined #tryton15:14
-!- clews( has left #tryton15:14
-!- shrox(~shrox@ has joined #tryton15:35
pokoliclews_: which tryton version are you on?15:50
-!- lukio( has joined #tryton15:59
-!- kstenger( has joined #tryton16:04
clews_pokoli: according to what i found it should be something like {O2M: {'add': .... }}16:06
-!- shrox(~shrox@ 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 '' model has no attribute <one2many_field>16:18
-!- kstenger1( has joined #tryton16:21
-!- jvblasco_( 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@ 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:
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@ has joined #tryton16:54
clews_pokoli: 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 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_: 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@ 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@ 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( has joined #tryton18:06
-!- bvillasanti(~bvillasan@ has joined #tryton19:16
-!- shrox(~shrox@ has joined #tryton19:21
-!- lukio(~lukio@ has joined #tryton19:24
-!- shrox(~shrox@ has joined #tryton20:08
-!- shrox(~shrox@ has joined #tryton21:17
-!- leio(~leio@gentoo/developer/leio) has joined #tryton21:23
-!- lukio(~lukio@ has joined #tryton22:06
-!- lucas1984(beb0d127@gateway/web/freenode/ip. has joined #tryton23:20
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
lucas1984I is generating this error when you print the invoice23:22
lucas1984Error :<ProtocolError for localhost:8005/prueba2016: 500 Internal Server Error>23:23
-!- jvblasco(~seba@ has joined #tryton23:40
-!- JosDzG(~Thunderbi@ has joined #tryton23:50

Generated by 2.11.0 by Marius Gedminas - find it at!