How can i create a cash sale for a sales order usi...
# suitescript
a
How can i create a cash sale for a sales order using suitscript.. A basic example would help
b
Copy code
record.transform({
    fromType: record.Type.SALES_ORDER,
    fromId: 'mySalesOrderInternalId',
    toType: record.Type.CASH_SALE,
}).save();
a
this one line would automatically create a cash sale ?
b
equivalent to clicking the bill button then save
unless your sales order creates an invoice when you bill it, in which case it errors
a
what if i need to modify the fields in cash sale newly created ..
using this code
b
record.transform returns a record.Record
my code just immediatly saves it
a
ok .. now i understood the whole thing .. Thanks
Is there any condition when an invoice is created or a cash sale is generated
for some orders when i click bill cash sale is generated while for some other orders an invoice is generated instead
b
fields on the sales order
if payment method is is set, then cash sale
else invoice
a
thanks
b
if there is only a payment method field and no terms field, it always creates a cash sale
a
if payment method is set and billing terms field is set as well . in that case