Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.0 -> 9.0] fail to migrate sale / purchase module (invoice line UoS undefined) #2076

Closed
legalsylvain opened this issue Oct 31, 2019 · 4 comments
Milestone

Comments

@legalsylvain
Copy link
Contributor

Hi all,

Similar bug as #2075.

The 8.0 setting is the following :

  • purchase.order.line product_id : False
  • purchase.order.line uom_id : Unit
  • account.invoice.line product_id : False
  • account.invoice.line uom_id : False

This case is valid in 8.0, because invoice UoS is optional.

Running the migration, the following error is raised.

Conversion from Product UoM **False** to Default UoM **Unit** is not possible as they both belong to different Category!.

Current Fix for purchase migration

if invoice line uos_id is NULL, set the purchase order line uom

UPDATE account_invoice_line ail
SET uos_id = pol.product_uom
FROM purchase_order_line_invoice_rel rel,
    purchase_order_line pol
WHERE pol.id = rel.order_line_id
AND ail.id = rel.invoice_id
AND ail.uos_id is null; 

Current fix for sale migration

(theoritical, I don't have the case)
if invoice line uos_id is NULL, set the sale order line uom

UPDATE account_invoice_line ail
SET uos_id = sol.product_uom
FROM purchase_order_line_invoice_rel rel,
    sale_order_line sol
WHERE sol.id = rel.order_line_id
AND ail.id = rel.invoice_id
AND ail.uos_id is null;

Proposal

Add this two requests in pre-migration script of sale and purchase (well with uom_id and not uos_id because at this step, uos_id has been renamed)

Regarding #2075 (comment), we could imagine also creating an new UoM with no name (only a space, because name is required), and disabled, and affect this UoM to the invoice line UoS, but I is a little dirty, and not sure that it is required in this case.

@pedrobaeza
Copy link
Member

Please see #1599

@legalsylvain
Copy link
Contributor Author

thanks for taking a look on that issue. If I understand correctly, #1599 is about missing product_id on purchase.order.line.
The current issue is about missing uos_id on account.invoice.line.

But I'll take a look ! because in my multicompany context, the current code that create product is not ok. (as you said on #1599)

@pedrobaeza
Copy link
Member

I think that they are related, as having the product with proper UoM in sale/purchase, then you can propagate that UoM to account.invoice.line when missing, don't you think?

@pedrobaeza
Copy link
Member

Closing as stalled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants