cancel
Showing results for 
Search instead for 
Did you mean: 

Invoice Id is not stored into credit memo DB record

0 Kudos

Invoice Id is not stored into credit memo DB record

Feature request from ytorbyk, posted on GitHub Oct 03, 2016

Preconditions

  1. Magento 2.2.0-dev with sample data
  2. Braintree payment method is configured and enabled
  3. "Authorize" payment action is set for Braintree

Steps to reproduce

  1. Log in
  2. Add at least two product into the shopping cart
  3. Place order with Braintree payment method
  4. Go to admin panel
  5. Create two separate invoices (partial invoices) for the order
  6. Open each of them and create credit memo for each one

Expected result

  1. Invoices ID is stored into DB record for the each credit memo in "sales_creditmemo" DB table

Actual result

  1. Invoice ID field is always empty for both cases - credit memo is crated for order or for invoice.

P.S. As improvement it would be nice to have an ability to show Invoice ID in credit memo grid additionally to Order ID.

7 Comments
apiuser
New Member
Status changed to: Investigating
 
apiuser
New Member

Comment from ytorbyk, posted on GitHub Oct 06, 2016

Here is pull request for the issue https://github.com/magento/magento2/pull/6902

apiuser
New Member

Comment from SerhiyShkolyarenko, posted on GitHub Oct 20, 2016

@YTorbyk Thank you for your contribution to Magento! I performed all the steps you described, after step 5 i settled both transactions and continued step 6. I checked sales_creditmemo table and found that invoice_id field contains correct invoice id. Here is a data dump of my sales_creditmemo table:

INSERT INTO `sales_creditmemo` VALUES (1,1,0.0000,0.0000,0.0000,0.0000,1.0000,18.2000,0.0000,3.2000,15.0000,3.2000,0.0000,15.0000,0.0000,1.0000,0.0000,3.2000,0.0000,3.2000,0.0000,18.2000,0.0000,0.0000,0.0000,0.0000,1,NULL,NULL,NULL,2,1,2,1,'USD','USD','USD','USD','p068fdg0-refund','000000001','2016-10-20 15:00:53','2016-10-20 15:00:53',0.0000,0.0000,NULL,NULL,15.0000,15.0000,NULL,NULL,NULL),(2,1,0.0000,0.0000,0.0000,0.0000,1.0000,6.4000,0.0000,6.4000,0.0000,6.4000,0.0000,0.0000,0.0000,1.0000,0.0000,6.4000,0.0000,6.4000,0.0000,6.4000,0.0000,0.0000,0.0000,0.0000,1,NULL,NULL,NULL,2,1,2,2,'USD','USD','USD','USD','qqxfge0p-refund','000000002','2016-10-20 15:01:58','2016-10-20 15:01:58',0.0000,0.0000,NULL,NULL,0.0000,0.0000,NULL,NULL,NULL);

Am I doing anything wrong?

apiuser
New Member

Comment from ytorbyk, posted on GitHub Oct 30, 2016

@SerhiyShkolyarenko This is very weird. I retested it on the develop branch again and I have another result.

screen shot 2016-10-31 at 00 41 29
apiuser
New Member

Comment from SerhiyShkolyarenko, posted on GitHub Oct 31, 2016

@YTorbyk have you settled transaction after placing order? Could you please put your credentials to this script and settle transaction with it? braintree_settle.zip Transaction id should be a parameter of the script.

apiuser
New Member

Comment from SerhiyShkolyarenko, posted on GitHub Oct 31, 2016

Offline refunds(credit memos) are not associated with invoices 1:1 It's possible to refund several invoices with one offline refund transaction, so in this case invoice_id will be NULL in sales_credit_memo record.

apiuser
New Member

Comment from SerhiyShkolyarenko, posted on GitHub Nov 01, 2016

@YTorbyk we analyzed our offline refunding again and concluded it needs improvement. After implementing story MAGETWO-60332 our credit memos will be bound strictly to invoices. Thank you for taking part.