cancel
Showing results for 
Search instead for 
Did you mean: 

regenerate the invoice table

SOLVED

regenerate the invoice table

Hi,

 

I've just done a module that allows you to have a custom field in the invoices and everything works.
But now the invoices that have already been generated the custom field remains null and is not populated with the value I want.

So I ask, is it possible that there is a command that regenerates the invoices?
(would be the table in the "sales_invoice" database)

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Re: regenerate the invoice table

Hi @bombe93,

 

In that case, maybe, it will be easier if you create a command taht reads all the Invoices with that field with null value and then run that code to update the invoice.

I'm not sure but I guess you should be able to do that using just SQL into your database.

View solution in original post

3 REPLIES 3

Re: regenerate the invoice table

Hi @bombe93,


That won't be possible with Magento out of the box.

Also, I can imagine a lot of problems try to do that (becasue internal references).

Maybe you can create your own command to fill the new column with the right value for the old invoices?

Can you share which value should be stored on that attribute/column?

Re: regenerate the invoice table

Yes, it is the field that contains the country.
I extended the invoice class and in the register function I rewrote it by adding the field like this:

      $MyAddress = $order->getShippingAddress();
      $MyRegion = $MyAddress->getCountryId();
      $this->setCountryMy($MyRegion);

for example for France comes "FR", obviously I added the methods also in the interface class, everything already works for the new invoices.

Re: regenerate the invoice table

Hi @bombe93,

 

In that case, maybe, it will be easier if you create a command taht reads all the Invoices with that field with null value and then run that code to update the invoice.

I'm not sure but I guess you should be able to do that using just SQL into your database.