How to set null as default value for an 'Amount' field ?

481 views
Skip to first unread message

Nicolas Micoud

unread,
Jun 12, 2015, 4:56:33 AM6/12/15
to idem...@googlegroups.com
Hi,

In a table, i a got a field (type = Amount) in which user could write :
 - nothing
 - 0
 - any amount

I can't find a way to initialize the field with null. I always got '0.00' (I try to play with default logic (@SQL=... , -1) but the field is still initialized with 0.00.

Do you know how it can be done ?

Thanks,

Nicolas

Alan Lescano

unread,
Jun 12, 2015, 2:55:27 PM6/12/15
to idem...@googlegroups.com
Can't you use type = Costs+Prices?

Alan

--
You received this message because you are subscribed to the Google Groups "iDempiere" group.
To unsubscribe from this group and stop receiving emails from it, send an email to idempiere+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/idempiere/e6ab3de9-2775-48f5-84aa-99b748efc5a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nicolas Micoud

unread,
Jun 13, 2015, 8:17:10 AM6/13/15
to idem...@googlegroups.com
Hi Alan,

I try to set the field as 'Costs+Prices' but it doesn't change the behaviour.

Then, i try to write NULL in the default logic field... and it works !

Thanks,

Nicolas

Nicolas Micoud

unread,
Jun 13, 2015, 8:34:32 AM6/13/15
to idem...@googlegroups.com
It works but log complains :

13 juin 2015 14:26:16 org.compiere.model.GridField createDefault
GRAVE: XXX_MontantHT - null

(XXX_MontantHT is the name of my column)

The initialization to zero of a number field is hardcoded (see GridField.getDefault line 733).

What are the possibilities ? create a new kind of field (same as amount except for the initialization part) ?

Thanks

Nicolas

Hiep Lq

unread,
Jun 13, 2015, 9:07:38 AM6/13/15
to Mohemmed Bilal Ilyas
Hi Nicolas.
maybe it's for safe. if you has a record with amount = null. when you apply a calculator function with it (example sum) result is null.



For more options, visit https://groups.google.com/d/optout.



--
Lê Quý Hiệp
Email: hie...@hasuvimex.vn
Skype: admin.hasuvimex
Mobile: 0915277401

Company: Thanh Hoa Fishery Import - Export J.s.c  (HasuvimexDL 47
Add: Lot E, Le Mon Industrial Zone, Thanh Hoa, Vietnam

Nicolas Micoud

unread,
Jun 13, 2015, 9:32:54 AM6/13/15
to idem...@googlegroups.com
Hi Hiep,

You're probably right. Amount shouldn't be null. Until my use case comes :)

I think i will have to create a new kind of field and override its default value.

Nicolas

Carlos Antonio Ruiz Gomez

unread,
Jun 13, 2015, 10:21:28 AM6/13/15
to idem...@googlegroups.com
Nicolas, maybe we could check in GridField if the default is set explicitly to NULL then do not assign zero.

I think that can be useful.



On 13/06/15 a las 07:34, Nicolas Micoud wrote:

Nicolas Micoud

unread,
Jun 13, 2015, 3:24:05 PM6/13/15
to idem...@googlegroups.com
Hi Carlos,

Patch provided here : https://idempiere.atlassian.net/browse/IDEMPIERE-2678

Thanks

Nicolas

hideaki hagiwara

unread,
Aug 6, 2016, 6:06:55 AM8/6/16
to iDempiere
Hi, Nicolas.

I read your patch at IDEMPIERE-2678.

And I tried to set null as default value for an 'Amount' field and other numeric fields in Window.
But I could not set null as default value for an 'Amount' field and other numeric fields in Window.

I tried to set NULL at Default Logic Field of Column at Application Dictionary.
Is this understanding mistaken?

Please tell me How to set null as default value for an 'Amount' field. 

Carlos Antonio Ruiz Gómez

unread,
Aug 6, 2016, 4:12:36 PM8/6/16
to iDempiere
Hi Hideaki, I see what you mean, sorry I didn't understand in the ticket.
I think the refactoring from IDEMPIERE-2296 broke this feature.

Committed a fix here:

Regards,

Carlos Ruiz

hideaki hagiwara

unread,
Aug 7, 2016, 2:48:39 AM8/7/16
to iDempiere
Hi, Carlos.
I am very happy that you understood  what I want to say and you improved it very quickly.
:D

I confirmed it.
Thank you very much!

See you!

Neil Gordon

unread,
Aug 7, 2016, 5:53:55 AM8/7/16
to iDempiere
Thanks Carlos! Your fix was exactly what I was looking for.

-----
Neil Gordon
nTier Software Services
http://www.ntier.co.za
Twitter: @ngordon7000
Reply all
Reply to author
Forward
0 new messages