IRC logs of #tryton for Wednesday, 2013-11-27

chat.freenode.net #tryton log beginning Wed Nov 27 00:00:02 CET 2013
martinguzmanHi all! I'm using Tryton client 3.0.1 and I had this error: Unsupported operand type(s) for *: 'float' and 'Decimal' when the client is trying to display a Numeric field... Here is the error traceback: http://pastebin.com/u4VCVwkH.17:44
martinguzmanIs this a bug or I'm doing something incorrectly?17:44
martinguzmanI fixed it by casting to a float number the factor parameter...17:44
martinguzmanI replaced the return statement of get_client on FloatField class (tryton/gui/window/view_form/model/field.py):17:44
martinguzmanreturn locale.format('%.*f', (digit, value * factor), True)17:44
martinguzmanby:17:44
martinguzmanreturn locale.format('%.*f', (digit, value * float(factor)), True)17:44
martinguzmanand that fixed the problem, but I'm not sure if it can have some implications...17:44
cedkmartinguzman: already fixed by changeset 0118233a9c3417:51
cedkmartinguzman I think17:51
martinguzmancedk: I don't think so.. If you see the traceback the problem is that the factor parameter on the get_client method on FloatField is a Decimal type (because of the get_client method on NumericField)18:01
martinguzmanon NumericField class the get_client method is returning: return super(NumericField, self).get_client(record, factor=Decimal(str(factor)))18:04
martinguzmanso the factor is receiving the get_client on FloatField is a Decimal type...18:04
cedkmartinguzman: where do you get that?18:10
martinguzmancedk: line 16-20 on the error traceback: http://pastebin.com/u4VCVwkH18:12
martinguzmanif you go to the source code on that lines you can what is happening..18:13
martinguzman*you can see what is happening..18:13
martinguzmancedk: the get_client method on NumericField is calling the super method... So this method is calling the get_client method on FloatField, but is sending the factor as a Decimal type...18:22
martinguzmanand the get_client method on FloatField is trying to multiply: value * factor (float type times Decimal type) and that causes the error..18:25
cedkmartinguzman: I don't see anything wrong in the client code so where do you have this issue?18:33
cedkmartinguzman: which module? Because the error is using a float/Decimal digit with a Decimal/float18:34
martinguzmancedk: I'm sure it is not on any module and its on the client source (tryton/gui/window/view_form/model/field.py)18:37
martinguzmango to the line 328 (return statement of get_client method on NumericField class)18:38
cedkmartinguzman: So you don't want to say where you get the error ?18:38
martinguzmanand this return statement is calling the super method (so it is calling the get_client FloatField method)18:38
martinguzmancedk: ??! I'm getting the error when the client is trying to display a NumericField on a tree view18:39
cedkmartinguzman: But which field ????18:39
martinguzmancedk: it is not on tryton module... it is on a module I wrote..18:40
cedkmartinguzman: so fix your module18:40
martinguzmanbut when i was using tryton 2.8 everything was working fine..18:40
martinguzmancedk: why are you so close?18:41
martinguzmancedk: i'm pretty sure I'm not doing anything wrong...18:42
martinguzmanjust see the line 328 and the line 310 on the field.py file...18:42
martinguzmanon 328 you are returning a factor=Decimal(str(factor))18:43
cedkmartinguzman: if you don't show your code, I can not help18:43
martinguzmancedk: ok, give me a moment and I'm going to try to replicate the error on a smaller module...18:47
-!- vcardon(~vcardon@LNeuilly-152-23-15-185.w193-252.abo.wanadoo.fr) has left #tryton19:47
-!- bechamel(~bch@host-85-201-156-169.brutele.be) has left #tryton22:03
martinguzmancedk: I figured out what was the problem... When I created the database, I had a float field and I created some example records.. Then I change the float field to a numeric field, so the client gave me that error... Sorry for all the inconvenience.. :)22:14

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