Page 1 of 1

Setting sales Order Line QuantityOrdered in LineAdded failed

PostPosted: Fri Aug 14, 2015 3:17 pm
by indikad
Hi anyone ,

is this a bug ?

I see its possible to change the QuantityOrdered in sales order line - within the event "SalesOrderLineAdded"
however my code below just gets ignored ( no errors just jiwa does not respond to it )
I can however edit other fields using similar syntax - but not this field.

I am on 7.0.127

Code: Select all
'--- none of the Two below works
Item.QuantityOrdered = decTotalCubicVol
Item.QuantityOrdered = 2


Thanks in advance.

Re: Setting sales Order Line QuantityOrdered in LineAdded fa  Topic is solved

PostPosted: Tue Aug 18, 2015 4:46 pm
by Mike.Sheen
indikad wrote:Hi anyone ,

is this a bug ?

I see its possible to change the QuantityOrdered in sales order line - within the event "SalesOrderLineAdded"
however my code below just gets ignored ( no errors just jiwa does not respond to it )
I can however edit other fields using similar syntax - but not this field.

I am on 7.0.127

Code: Select all
'--- none of the Two below works
Item.QuantityOrdered = decTotalCubicVol
Item.QuantityOrdered = 2


Thanks in advance.


That event is the same event as the SalesOrderLines.Added event and this is raised after adding the item to the sales order lines collection, but before the quantity is set - so if you do set the quantity in there then it will get overwritten.

Listen to the AddInventoryItemEnd event of the SalesOrderLines collection instead, and then you will be able to change the quantity fields and have the changes stick.

Re: Setting sales Order Line QuantityOrdered in LineAdded fa

PostPosted: Tue Aug 18, 2015 5:05 pm
by indikad
Thanks for this tip Mike.

I am setting few other fields too ( in Line added even) - such as the Cubic and userdefinedFloats. So I guess it would be a good idea to move all logic to the
AddInventoryItemEnd event ?

Re: Setting sales Order Line QuantityOrdered in LineAdded fa

PostPosted: Wed Aug 19, 2015 7:44 pm
by Mike.Sheen
indikad wrote:I am setting few other fields too ( in Line added even) - such as the Cubic and userdefinedFloats. So I guess it would be a good idea to move all logic to the
AddInventoryItemEnd event ?


You may not need to, but it would not do any harm to use that event instead - unless you have other handlers on the change event on a line which you may only want to be fired when a user is editing those fields - but there are ways to deal with that also (removing handlers at appropriate events and then re-adding them)