IRC logs of #tryton for Friday, 2014-05-02

chat.freenode.net #tryton log beginning Fri May 2 00:00:01 CEST 2014
alisonken1lap3server would be trytond - client would be tryton00:27
alisonken1lap3ephase: ^^00:27
-!- ephase(~ephase@83-93-190-109.dsl.ovh.fr) has joined #tryton00:40
-!- meanmicio(~lfm@172.Red-83-38-121.dynamicIP.rima-tde.net) has joined #tryton01:32
-!- meanmicio(~lfm@fsf/member/meanmicio) has joined #tryton01:32
-!- frispete(~frispete@p54A93949.dip0.t-ipconnect.de) has joined #tryton06:40
-!- yangoon1(~mathiasb@p549F3781.dip0.t-ipconnect.de) has joined #tryton07:02
-!- mar(~marius@v100.nfq.lt) has joined #tryton07:34
-!- sharoonthomas(~sharoonth@118.91.181.18) has joined #tryton08:08
-!- pobsteta(~Thunderbi@37.163.223.196) has joined #tryton08:23
-!- sharoonthomas_(~sharoonth@198.61.199.179) has joined #tryton08:24
pokolis08:39
-!- mar(~marius@v100.nfq.lt) has joined #tryton08:43
-!- jeancavallo(~giovanni@bob75-9-88-181-2-176.fbx.proxad.net) has joined #tryton08:47
pokolitable09:03
-!- mar(~marius@v100.nfq.lt) has joined #tryton09:10
marAttributeError: 'account.invoice' Model has no attribute 'state': {'currency': Pool().get('currency.currency')(1)}09:20
marwhy do I get this error, invoice definately has "state"09:20
marI'm doing: http://pastebin.com/jJa60EqG09:21
-!- mar(~marius@v100.nfq.lt) has joined #tryton09:42
pokolimar: which version you are?09:43
mar2.8.409:44
marwhat I am trying to do is to add new functionality into InvoiceLine09:45
marI have relation InvoiceLine -> many LineMove objects09:45
marI define it as:     line_moves = fields.One2Many('trytonlt.line_move', 'invoice_line', 'Line moves', on_change_with=['quantity'])09:45
marand on quantity change I want to update objects in that relation09:46
maro I define:     def on_change_with_line_moves(self):09:46
pokolimar: I'm not sure, but maybe self.invoice is the id of the invoice and not the object?09:47
marself.invoice is account.invoice,None09:47
marand it seems that it not "initialized" with default values, etc09:47
marmaybe it's some proteus thing again?09:48
pokolimar: sure :)09:48
pokolimar: it sound like the same problem than yesterday :P09:48
marit's the same testcase ;)09:48
-!- sharoonthomas(~sharoonth@118.91.181.18) has joined #tryton09:49
marpokoli, http://pastebin.com/2qcfXdCq09:50
maryesterdays problem was what I accessed invoice line directly, not from invoice09:51
-!- nicoe(~nicoe@2001:6f8:3aa:0:b699:baff:fe56:2328) has joined #tryton09:51
pokolimar: I can not see anything wrong :S09:52
mardoes my on_change_with sound correct?09:53
pokolimar: in my eyes yes09:54
pokolimar: have you tested it from the tryton client?09:54
marnope09:54
marwhat does my on_change_with_line_moves should return?09:55
marself.line_moves ?09:55
pokolimar: the value of the line_moves field you want09:55
marso line_moves is relation, so I should return [] or something, right?09:56
pokolimar: it's a One2Many, so a list of values to create/update/remove09:56
marso basically     def on_change_with_line_moves(self):09:57
mar        return self.line_moves09:57
marshould work, right?09:57
marhttp://pastebin.com/qGsdqsgv09:58
pokolimar: no09:58
pokoliI'm tryton to find and example no core modules09:59
pokolimar: http://hg.tryton.org/modules/production/file/3eea8c2eb0c7/production.py#l25510:00
pokolimar: basically a dict, where the keys are the operations (add, update, remove, delete) and depending on the key you return a diferent value10:01
mar{'relation_column': dict(keys=(add,update..))}10:02
marright?10:02
marso if I want no changes:     def on_change_with_line_moves(self):10:02
mar        return {}10:02
pokolimar: for remove you return the ids to remove, for add a list of values to add, for update the [ids], and the values to write10:02
pokolimar: the example is an on_change, you're on on_change_with so you must return the dict directly10:03
marso if I want to update some line_move I do10:03
pokolie10:03
mar{line_moves: {id: {update_key: update_value}}?10:04
pokolimar: [('write', ([ids]: {update_key: update_value}))]10:06
pokolimar: but I'm wondering if it's not easier to do it on invoice posting10:07
marso do I need to specify column?10:12
marreturn {'line_moves': changes_dict}10:15
marchanges_dict.keys() == ['add', 'remove', ...]10:16
marchanges_dict['write'] = [ ('id', {key: value}),  ]10:16
marwright?10:16
marand how do I check if object is "saved"? self.id is not None?10:17
-!- sharkcz(~sharkcz@server.danny.cz) has joined #tryton10:24
marI still don't get it10:32
mar        print invoice_line10:32
mar        invoice_line.quantity = Decimal('12.')10:32
mardef on_change_with_line_moves(self):10:32
mar        print self10:32
maroutput is:10:32
mar<account.invoice.line(1)>10:32
maraccount.invoice.line,None10:32
marwhy on_change_with_move_lines self.id == None?10:32
-!- udono1(~udono@ip-176-199-172-92.unitymediagroup.de) has joined #tryton10:34
marpokoli, ?10:36
-!- lfm(~lfm@44.Red-81-38-120.dynamicIP.rima-tde.net) has joined #tryton10:37
pokolimar: no column because you are using on_change_with10:37
pokolimar:10:38
pokoliACTION is reading all the comments 10:38
pokolimar: don't understand why you need to save10:39
mari don't need to save it10:41
marI need to check current line_moves and change those according to change in quantity10:42
marand self.line_moves is not existing :/10:42
-!- yangoon(~mathiasb@p549F3781.dip0.t-ipconnect.de) has joined #tryton10:45
pokolimar: and what do you have to change?10:45
marself.line_move[0].quantity = self.quantity10:46
marfor example10:46
-!- uranus(~uranus@ool-182fa854.dyn.optonline.net) has joined #tryton10:53
pokolijust return {'write', ([line_move[0].id], {'quantity': self.quantity})}11:01
marbut self.line_moves is non existant :/11:06
marAttributeError: 'account.invoice.line' Model has no attribute 'line_moves': {'currency': Pool().get('currency.currency')(1), 'type': u'line', 'invoice': Pool().get('account.invoice')(**{'currency': 1}), 'unit_price': Decimal('5000.0000'), 'quantity': 12.0}11:07
marany ideas, pokoli?11:15
pokolimar: can you explain why you need to change line_moves in on_change?11:15
pokolimar: and why you cant do it in create/write?11:16
marbecause I have InvoiceLine(quantity=13, line_moves=[move1, move2]11:16
marmove1, move2.quantity == 1311:16
mari change InvoiceLine.quantity = 1211:16
marand I want to update move1.quantity and move2.quantity = 1211:17
marso I need move1 and move2.pk?11:17
marmove2.id11:17
mardoes it sound wrong?11:18
marmaybe I'm missing some depends=...?11:19
maryou're suggesting I do this in11:27
marInvoiceLine.write(cls, records, values) ?11:27
pokolimar: yes11:27
pokolimar: and also for create11:28
marI just need it for update11:30
marit's complicated, because write takes many records :/11:31
pokolimar: you simply need a loop on each record and make calcs inside the loop11:32
pokolicedk: ping11:33
marwhat if I need to throw validation error?11:33
marand what if I need to write different values on different records?11:33
marsplit writes?11:34
pokolimar: first question: better to use check11:34
pokolimar: second question just call super() when you need11:34
-!- lfm_(~lfm@110.Red-81-38-119.dynamicIP.rima-tde.net) has joined #tryton11:34
marso I get write([record1, record2], {quantity: 12.00})11:35
marand now I ant to write11:35
marrecord1: line_moves[0].quantity = 1211:35
marrecord2[1].quantity = 1311:35
marso I to .write([record1], record1_values) and .write([record2], record2_values)?11:36
mar*so I do11:36
pokolimar: but you need to write on InvoiceLine or on line_move?11:36
maron InvoiceLine11:37
maroops11:37
maron LineMove11:37
mari don't need to change InvoiceLine, just throw validation error if I can't write it on LineMove11:37
pokolimar: so Just get the model from the pool and perform any writes you need11:40
-!- vernichon(~Thunderbi@gex01-1-78-234-55-95.fbx.proxad.net) has joined #tryton11:40
marin write method?11:48
-!- rpit(~ralf@dslb-088-070-150-066.pools.arcor-ip.net) has joined #tryton11:48
cedkpokoli: pong11:49
pokolicedk: can I push to www.tryton.org? And if I push there is something I need to do to update the website?11:51
pokolimar: yes11:51
cedkpokoli: no you can't11:52
pokolicedk: so I send you the patches by email?11:53
cedkpokoli: yes11:54
pokolicedk: ok, thanks :)11:55
marpokoli, what about validation? can I throw user error in write()?11:56
pokolimar: better to use validate http://doc.tryton.org/3.2/trytond/doc/ref/models/models.html?highlight=validate#trytond.model.ModelStorage.validate11:57
marbut I need to do this validation only when changing quantity11:59
marI probably won't know if that's the case in validate?12:00
cedkmar: validation on changing event is wrong, validation is about data integrity12:04
-!- pobsteta(~Thunderbi@37.163.36.40) has joined #tryton12:07
-!- lfm_(~lfm@230.Red-83-40-188.dynamicIP.rima-tde.net) has joined #tryton13:12
-!- asoleh(~asoleh@36.70.65.253) has joined #tryton13:40
-!- jeancavallo(~giovanni@bob75-9-88-181-2-176.fbx.proxad.net) has joined #tryton14:01
-!- refnode(~refnode@refnode.com) has joined #tryton14:46
-!- marius_(~marius@v100.nfq.lt) has joined #tryton14:53
-!- marius_(~marius@v100.nfq.lt) has joined #tryton15:48
-!- marius_(~marius@v100.nfq.lt) has joined #tryton15:55
-!- mariomop(~quassel@181.95.253.176) has joined #tryton16:09
-!- pobsteta(~Thunderbi@37.163.36.40) has joined #tryton16:10
-!- alisonken1lap3(~alisonken@18.18.ultimate-int.uia.net) has joined #tryton16:25
-!- marius_(~marius@v100.nfq.lt) has joined #tryton16:37
-!- digitalsatori(~Thunderbi@116.234.181.110) has joined #tryton17:02
-!- Telesight(~anthony@77-175-159-159.FTTH.ispfabriek.nl) has joined #tryton18:33
-!- gremly(~gremly@190.85.36.58) has joined #tryton19:03
-!- Telesight1(~anthony@77-175-159-159.FTTH.ispfabriek.nl) has joined #tryton19:09
-!- Telesight(~anthony@77-175-159-159.FTTH.ispfabriek.nl) has joined #tryton19:52
-!- marius_(~marius@84.240.20.35) has joined #tryton21:14

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