You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi
I'm getting the following error each time I attempt to add an item to the cart; "Module::DelegationError (Spree::Order#invoice_number delegated to invoice.number, but invoice is nil", while running `ensure_cart'.
I have a clean install of spree 4.1. However I've imported order data from a spree 2.4 implementation, so possibly that is causing the issue. Within order I still have the invoice_number and invoice_date.
EDIT:
Error message solved
The error was caused by still having the invoice_number field on orders. I renamed the columns invoice_number and invoice date and the error went away.
Data migration still a problem
I tried to migrate the invoice numbers from the old 2.4 setup into the new spree 4.1 setup. I added the following migration;
It recreated the invoices but the invoice numbers didn't set as the old numbers. The order numbers didn't set to the old number but a number a few thousand higher. Possibly it is taking the next invoice number and adding the old number to it?
Also attempting to set the number on the packaging_slip to the old invoice number had no effect and it kept the packaging slip number as the order number.
The text was updated successfully, but these errors were encountered:
Hi
I'm getting the following error each time I attempt to add an item to the cart; "Module::DelegationError (Spree::Order#invoice_number delegated to invoice.number, but invoice is nil", while running `ensure_cart'.
I have a clean install of spree 4.1. However I've imported order data from a spree 2.4 implementation, so possibly that is causing the issue. Within order I still have the invoice_number and invoice_date.
EDIT:
Error message solved
The error was caused by still having the invoice_number field on orders. I renamed the columns invoice_number and invoice date and the error went away.
Data migration still a problem
I tried to migrate the invoice numbers from the old 2.4 setup into the new spree 4.1 setup. I added the following migration;
`class RenameInvoiceNumberOnOrder < ActiveRecord::Migration[6.0]
def change
up_only {
Spree::Order.complete.where.not(invoice_number: nil).find_each do |order|
order.bookkeeping_documents.delete_all
order.invoice_for_order
order.invoice.update(number: order.invoice_number, created_at: order.completed_at.to_date)
order.packaging_slip.update(number: order.invoice_number, created_at: order.completed_at.to_date)
end
}
rename_column :spree_orders, :invoice_number, :old_invoice_number
rename_column :spree_orders, :invoice_date, :old_invoice_date
end
end
`
It recreated the invoices but the invoice numbers didn't set as the old numbers. The order numbers didn't set to the old number but a number a few thousand higher. Possibly it is taking the next invoice number and adding the old number to it?
Also attempting to set the number on the packaging_slip to the old invoice number had no effect and it kept the packaging slip number as the order number.
The text was updated successfully, but these errors were encountered: