[Vtigercrm-developers] Inventory Record copying

Alan Lord alanslists at gmail.com
Thu Nov 2 15:22:42 GMT 2017


This gets a bit "weirder"...

If I trigger my custom workflow on the Quote from a save when it is open 
for Edit, the Sales Order is created and the line items in the Quote get 
copied into the new Sales Order.

If I trigger the workflow on the Quote from a save when in it is in 
Detail View (I just change the Quote Stage for example), the Sales Order 
is created, but this does not copy the line items.

Any ideas?

Al



On 02/11/17 14:21, Alan Lord wrote:
> I am trying to replicate what happens when a user clicks on the Generate 
> Sales Order button from within a quote, but in code, so it can be 
> triggered from a custom workflow function.
> 
> Most of it works using the basic principles in the Inventory Edit View 
> class, but what I can't get to work is the copying across of the line 
> items. Whilst there is are methods to getProducts() and 
> setRecordFieldvalues() there doesn't seem to be a solution to copying 
> the line items. I am loathe to use the Server API revise because it 
> fails to perform any final recalculations (see 
> http://code.vtiger.com/vtiger/vtigercrm/issues/683).
> 
> Anyone managed to do this successfully?
> 
> TIA
> 
> Al
> 
> NB: Simone, I have read your bug report above but can't see what you 
> mean. The if statement deals with the condition where $parentId could be 
> a single id (string) or an array of multiple ids so it uses a different 
> query. And I also fail to see how this would affect the calculation of 
> the totals anyway. The tests is not "wrong" as far as I can tell. 
> Although, if the $parentId is an array, then what gets passed into 
> vtws_runQueryAsTransaction() would be the array of parentIds inside 
> another array...
> 
> 
> Al
> 
> 
> 
> 
> 
> _______________________________________________
> http://www.vtiger.com/
> 




More information about the vtigercrm-developers mailing list