Topic: Duplicate code in WriteOff in FA 2.3

In FA 2.3.x, lines 202-206 in sales/includes/db/sales_credit_db.inc:

add_stock_move_customer(ST_CUSTCREDIT,  $credit_line->stock_id,
        key($credit_note->trans_no), $credit_note->Location,
        $credit_note->document_date, $reference, -$credit_line->qty_dispatched,
        $curr_std_cost,  0, $price,
        $credit_line->discount_percent);

are duplicately executed for $credit_type WriteOff as it is present in lines 209-213 as well.

Committed in my repo's FAMods.

@joe: can update in upstream.

In FA 2.4, there appears to be no WriteOff distinction for the $credit_type and it stands committed.

Post's attachments

Duplicate code.png 25.3 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Duplicate code in WriteOff in FA 2.3

No this is not a duplicate code. This is an outgoing and an ingoing stamp with writeoff reference. These 2 transactions is not seen in the stock movements transactions.

So you will not see anything in the stock movements. Only when looking into the database.

This has been changed slightly in 2.4.

Due to no sideeffects in 2.3 as it is now, we will not change anything here.

/Joe

Re: Duplicate code in WriteOff in FA 2.3

Thanks for the insight @joe.

The WriteOff has both a positive and negative entry pair for quantity: $credit_line->qty_dispatched in the database. Restored code.