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

chat.freenode.net #tryton log beginning Fri May 2 00:00:01 CEST 2014
2014-05-02 00:27 <alisonken1lap3> server would be trytond - client would be tryton
2014-05-02 00:27 <alisonken1lap3> ephase: ^^
2014-05-02 00:40 -!- ephase(~ephase@83-93-190-109.dsl.ovh.fr) has joined #tryton
2014-05-02 01:32 -!- meanmicio(~lfm@172.Red-83-38-121.dynamicIP.rima-tde.net) has joined #tryton
2014-05-02 01:32 -!- meanmicio(~lfm@fsf/member/meanmicio) has joined #tryton
2014-05-02 06:40 -!- frispete(~frispete@p54A93949.dip0.t-ipconnect.de) has joined #tryton
2014-05-02 07:02 -!- yangoon1(~mathiasb@p549F3781.dip0.t-ipconnect.de) has joined #tryton
2014-05-02 07:34 -!- mar(~marius@v100.nfq.lt) has joined #tryton
2014-05-02 08:08 -!- sharoonthomas(~sharoonth@118.91.181.18) has joined #tryton
2014-05-02 08:23 -!- pobsteta(~Thunderbi@37.163.223.196) has joined #tryton
2014-05-02 08:24 -!- sharoonthomas_(~sharoonth@198.61.199.179) has joined #tryton
2014-05-02 08:39 <pokoli> s
2014-05-02 08:43 -!- mar(~marius@v100.nfq.lt) has joined #tryton
2014-05-02 08:47 -!- jeancavallo(~giovanni@bob75-9-88-181-2-176.fbx.proxad.net) has joined #tryton
2014-05-02 09:03 <pokoli> table
2014-05-02 09:10 -!- mar(~marius@v100.nfq.lt) has joined #tryton
2014-05-02 09:20 <mar> AttributeError: 'account.invoice' Model has no attribute 'state': {'currency': Pool().get('currency.currency')(1)}
2014-05-02 09:20 <mar> why do I get this error, invoice definately has "state"
2014-05-02 09:21 <mar> I'm doing: http://pastebin.com/jJa60EqG
2014-05-02 09:42 -!- mar(~marius@v100.nfq.lt) has joined #tryton
2014-05-02 09:43 <pokoli> mar: which version you are?
2014-05-02 09:44 <mar> 2.8.4
2014-05-02 09:45 <mar> what I am trying to do is to add new functionality into InvoiceLine
2014-05-02 09:45 <mar> I have relation InvoiceLine -> many LineMove objects
2014-05-02 09:45 <mar> I define it as: line_moves = fields.One2Many('trytonlt.line_move', 'invoice_line', 'Line moves', on_change_with=['quantity'])
2014-05-02 09:46 <mar> and on quantity change I want to update objects in that relation
2014-05-02 09:46 <mar> o I define: def on_change_with_line_moves(self):
2014-05-02 09:47 <pokoli> mar: I'm not sure, but maybe self.invoice is the id of the invoice and not the object?
2014-05-02 09:47 <mar> self.invoice is account.invoice,None
2014-05-02 09:47 <mar> and it seems that it not "initialized" with default values, etc
2014-05-02 09:48 <mar> maybe it's some proteus thing again?
2014-05-02 09:48 <pokoli> mar: sure :)
2014-05-02 09:48 <pokoli> mar: it sound like the same problem than yesterday :P
2014-05-02 09:48 <mar> it's the same testcase ;)
2014-05-02 09:49 -!- sharoonthomas(~sharoonth@118.91.181.18) has joined #tryton
2014-05-02 09:50 <mar> pokoli, http://pastebin.com/2qcfXdCq
2014-05-02 09:51 <mar> yesterdays problem was what I accessed invoice line directly, not from invoice
2014-05-02 09:51 -!- nicoe(~nicoe@2001:6f8:3aa:0:b699:baff:fe56:2328) has joined #tryton
2014-05-02 09:52 <pokoli> mar: I can not see anything wrong :S
2014-05-02 09:53 <mar> does my on_change_with sound correct?
2014-05-02 09:54 <pokoli> mar: in my eyes yes
2014-05-02 09:54 <pokoli> mar: have you tested it from the tryton client?
2014-05-02 09:54 <mar> nope
2014-05-02 09:55 <mar> what does my on_change_with_line_moves should return?
2014-05-02 09:55 <mar> self.line_moves ?
2014-05-02 09:55 <pokoli> mar: the value of the line_moves field you want
2014-05-02 09:56 <mar> so line_moves is relation, so I should return [] or something, right?
2014-05-02 09:56 <pokoli> mar: it's a One2Many, so a list of values to create/update/remove
2014-05-02 09:57 <mar> so basically def on_change_with_line_moves(self):
2014-05-02 09:57 <mar> return self.line_moves
2014-05-02 09:57 <mar> should work, right?
2014-05-02 09:58 <mar> http://pastebin.com/qGsdqsgv
2014-05-02 09:58 <pokoli> mar: no
2014-05-02 09:59 <pokoli> I'm tryton to find and example no core modules
2014-05-02 10:00 <pokoli> mar: http://hg.tryton.org/modules/production/file/3eea8c2eb0c7/production.py#l255
2014-05-02 10:01 <pokoli> mar: basically a dict, where the keys are the operations (add, update, remove, delete) and depending on the key you return a diferent value
2014-05-02 10:02 <mar> {'relation_column': dict(keys=(add,update..))}
2014-05-02 10:02 <mar> right?
2014-05-02 10:02 <mar> so if I want no changes: def on_change_with_line_moves(self):
2014-05-02 10:02 <mar> return {}
2014-05-02 10:02 <pokoli> mar: for remove you return the ids to remove, for add a list of values to add, for update the [ids], and the values to write
2014-05-02 10:03 <pokoli> mar: the example is an on_change, you're on on_change_with so you must return the dict directly
2014-05-02 10:03 <mar> so if I want to update some line_move I do
2014-05-02 10:03 <pokoli> e
2014-05-02 10:04 <mar> {line_moves: {id: {update_key: update_value}}?
2014-05-02 10:06 <pokoli> mar: [('write', ([ids]: {update_key: update_value}))]
2014-05-02 10:07 <pokoli> mar: but I'm wondering if it's not easier to do it on invoice posting
2014-05-02 10:12 <mar> so do I need to specify column?
2014-05-02 10:15 <mar> return {'line_moves': changes_dict}
2014-05-02 10:16 <mar> changes_dict.keys() == ['add', 'remove', ...]
2014-05-02 10:16 <mar> changes_dict['write'] = [ ('id', {key: value}), ]
2014-05-02 10:16 <mar> wright?
2014-05-02 10:17 <mar> and how do I check if object is "saved"? self.id is not None?
2014-05-02 10:24 -!- sharkcz(~sharkcz@server.danny.cz) has joined #tryton
2014-05-02 10:32 <mar> I still don't get it
2014-05-02 10:32 <mar> print invoice_line
2014-05-02 10:32 <mar> invoice_line.quantity = Decimal('12.')
2014-05-02 10:32 <mar> def on_change_with_line_moves(self):
2014-05-02 10:32 <mar> print self
2014-05-02 10:32 <mar> output is:
2014-05-02 10:32 <mar> <account.invoice.line(1)>
2014-05-02 10:32 <mar> account.invoice.line,None
2014-05-02 10:32 <mar> why on_change_with_move_lines self.id == None?
2014-05-02 10:34 -!- udono1(~udono@ip-176-199-172-92.unitymediagroup.de) has joined #tryton
2014-05-02 10:36 <mar> pokoli, ?
2014-05-02 10:37 -!- lfm(~lfm@44.Red-81-38-120.dynamicIP.rima-tde.net) has joined #tryton
2014-05-02 10:37 <pokoli> mar: no column because you are using on_change_with
2014-05-02 10:38 <pokoli> mar:
2014-05-02 10:38 <pokoli> ACTION is reading all the comments
2014-05-02 10:39 <pokoli> mar: don't understand why you need to save
2014-05-02 10:41 <mar> i don't need to save it
2014-05-02 10:42 <mar> I need to check current line_moves and change those according to change in quantity
2014-05-02 10:42 <mar> and self.line_moves is not existing :/
2014-05-02 10:45 -!- yangoon(~mathiasb@p549F3781.dip0.t-ipconnect.de) has joined #tryton
2014-05-02 10:45 <pokoli> mar: and what do you have to change?
2014-05-02 10:46 <mar> self.line_move[0].quantity = self.quantity
2014-05-02 10:46 <mar> for example
2014-05-02 10:53 -!- uranus(~uranus@ool-182fa854.dyn.optonline.net) has joined #tryton
2014-05-02 11:01 <pokoli> just return {'write', ([line_move[0].id], {'quantity': self.quantity})}
2014-05-02 11:06 <mar> but self.line_moves is non existant :/
2014-05-02 11:07 <mar> AttributeError: '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}
2014-05-02 11:15 <mar> any ideas, pokoli?
2014-05-02 11:15 <pokoli> mar: can you explain why you need to change line_moves in on_change?
2014-05-02 11:16 <pokoli> mar: and why you cant do it in create/write?
2014-05-02 11:16 <mar> because I have InvoiceLine(quantity=13, line_moves=[move1, move2]
2014-05-02 11:16 <mar> move1, move2.quantity == 13
2014-05-02 11:16 <mar> i change InvoiceLine.quantity = 12
2014-05-02 11:17 <mar> and I want to update move1.quantity and move2.quantity = 12
2014-05-02 11:17 <mar> so I need move1 and move2.pk?
2014-05-02 11:17 <mar> move2.id
2014-05-02 11:18 <mar> does it sound wrong?
2014-05-02 11:19 <mar> maybe I'm missing some depends=...?
2014-05-02 11:27 <mar> you're suggesting I do this in
2014-05-02 11:27 <mar> InvoiceLine.write(cls, records, values) ?
2014-05-02 11:27 <pokoli> mar: yes
2014-05-02 11:28 <pokoli> mar: and also for create
2014-05-02 11:30 <mar> I just need it for update
2014-05-02 11:31 <mar> it's complicated, because write takes many records :/
2014-05-02 11:32 <pokoli> mar: you simply need a loop on each record and make calcs inside the loop
2014-05-02 11:33 <pokoli> cedk: ping
2014-05-02 11:33 <mar> what if I need to throw validation error?
2014-05-02 11:33 <mar> and what if I need to write different values on different records?
2014-05-02 11:34 <mar> split writes?
2014-05-02 11:34 <pokoli> mar: first question: better to use check
2014-05-02 11:34 <pokoli> mar: second question just call super() when you need
2014-05-02 11:34 -!- lfm_(~lfm@110.Red-81-38-119.dynamicIP.rima-tde.net) has joined #tryton
2014-05-02 11:35 <mar> so I get write([record1, record2], {quantity: 12.00})
2014-05-02 11:35 <mar> and now I ant to write
2014-05-02 11:35 <mar> record1: line_moves[0].quantity = 12
2014-05-02 11:35 <mar> record2[1].quantity = 13
2014-05-02 11:36 <mar> so I to .write([record1], record1_values) and .write([record2], record2_values)?
2014-05-02 11:36 <mar> *so I do
2014-05-02 11:36 <pokoli> mar: but you need to write on InvoiceLine or on line_move?
2014-05-02 11:37 <mar> on InvoiceLine
2014-05-02 11:37 <mar> oops
2014-05-02 11:37 <mar> on LineMove
2014-05-02 11:37 <mar> i don't need to change InvoiceLine, just throw validation error if I can't write it on LineMove
2014-05-02 11:40 <pokoli> mar: so Just get the model from the pool and perform any writes you need
2014-05-02 11:40 -!- vernichon(~Thunderbi@gex01-1-78-234-55-95.fbx.proxad.net) has joined #tryton
2014-05-02 11:48 <mar> in write method?
2014-05-02 11:48 -!- rpit(~ralf@dslb-088-070-150-066.pools.arcor-ip.net) has joined #tryton
2014-05-02 11:49 <cedk> pokoli: pong
2014-05-02 11:51 <pokoli> cedk: can I push to www.tryton.org? And if I push there is something I need to do to update the website?
2014-05-02 11:51 <pokoli> mar: yes
2014-05-02 11:52 <cedk> pokoli: no you can't
2014-05-02 11:53 <pokoli> cedk: so I send you the patches by email?
2014-05-02 11:54 <cedk> pokoli: yes
2014-05-02 11:55 <pokoli> cedk: ok, thanks :)
2014-05-02 11:56 <mar> pokoli, what about validation? can I throw user error in write()?
2014-05-02 11:57 <pokoli> mar: better to use validate http://doc.tryton.org/3.2/trytond/doc/ref/models/models.html?highlight=validate#trytond.model.ModelStorage.validate
2014-05-02 11:59 <mar> but I need to do this validation only when changing quantity
2014-05-02 12:00 <mar> I probably won't know if that's the case in validate?
2014-05-02 12:04 <cedk> mar: validation on changing event is wrong, validation is about data integrity
2014-05-02 12:07 -!- pobsteta(~Thunderbi@37.163.36.40) has joined #tryton
2014-05-02 13:12 -!- lfm_(~lfm@230.Red-83-40-188.dynamicIP.rima-tde.net) has joined #tryton
2014-05-02 13:40 -!- asoleh(~asoleh@36.70.65.253) has joined #tryton
2014-05-02 14:01 -!- jeancavallo(~giovanni@bob75-9-88-181-2-176.fbx.proxad.net) has joined #tryton
2014-05-02 14:46 -!- refnode(~refnode@refnode.com) has joined #tryton
2014-05-02 14:53 -!- marius_(~marius@v100.nfq.lt) has joined #tryton
2014-05-02 15:48 -!- marius_(~marius@v100.nfq.lt) has joined #tryton
2014-05-02 15:55 -!- marius_(~marius@v100.nfq.lt) has joined #tryton
2014-05-02 16:09 -!- mariomop(~quassel@181.95.253.176) has joined #tryton
2014-05-02 16:10 -!- pobsteta(~Thunderbi@37.163.36.40) has joined #tryton
2014-05-02 16:25 -!- alisonken1lap3(~alisonken@18.18.ultimate-int.uia.net) has joined #tryton
2014-05-02 16:37 -!- marius_(~marius@v100.nfq.lt) has joined #tryton
2014-05-02 17:02 -!- digitalsatori(~Thunderbi@116.234.181.110) has joined #tryton
2014-05-02 18:33 -!- Telesight(~anthony@77-175-159-159.FTTH.ispfabriek.nl) has joined #tryton
2014-05-02 19:03 -!- gremly(~gremly@190.85.36.58) has joined #tryton
2014-05-02 19:09 -!- Telesight1(~anthony@77-175-159-159.FTTH.ispfabriek.nl) has joined #tryton
2014-05-02 19:52 -!- Telesight(~anthony@77-175-159-159.FTTH.ispfabriek.nl) has joined #tryton
2014-05-02 21:14 -!- marius_(~marius@84.240.20.35) has joined #tryton

Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!