-
-
Notifications
You must be signed in to change notification settings - Fork 707
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
[16.0][OU-ADD] stock: migration #3966
Conversation
b90a7b5
to
65d94f3
Compare
/ocabot migration stock Depends on :
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a fix for an error that happened when i ran the upgrade.
1744fcb
to
fda9382
Compare
fda9382
to
2707d13
Compare
2707d13
to
d6dfed8
Compare
I don't know about the dependency, but I've run a very real database through this and there are a few problems.
I just commented out the inside of _columns_renames to move forward.
Given where I'm at in my migration, I just returned out of that function early and moved on. Anyway, just my two cents, THANKS FOR THE MIGRATION!!! |
Hi! |
Can confirm both issues
|
openupgrade.rename_tables(env.cr, _tables_renames) | ||
openupgrade.rename_models(env.cr, _models_renames) | ||
openupgrade.rename_fields(env, _fields_renames) | ||
openupgrade.rename_columns(env.cr, _columns_renames) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already covered by the rename_fields
as seen by the error of the column already existing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confirmed, reserved_qty is renamed by openupgrade.rename_fields(env, _fields_renames) and after by openupgrade.rename_columns(env.cr, _columns_renames)
END as replenish_location_status | ||
FROM stock_location sl | ||
LEFT JOIN stock_warehouse sw | ||
ON sw.id = sl.warehouse_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The warehouse is a computed value that is new being stored, I tried adding the field using openupgrade.add_fields
and calculating the value in this script, however got the following warning
add_fields: There's already an entry for warehouse_id in stock.location. This may mean that there's some misconfiguration, or simply that another module added the same field previously.
Is there a reason this cannot be moved the the post migration? allowing the module to calculate the values for us?
I wrote a code to retrieve and update the warehouse_id based on the computation performed in Odoo 15.0. Needs reviews an work around :
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested in a real migration from 14 to 15 and 16.
openupgrade.rename_tables(env.cr, _tables_renames) | ||
openupgrade.rename_models(env.cr, _models_renames) | ||
openupgrade.rename_fields(env, _fields_renames) | ||
openupgrade.rename_columns(env.cr, _columns_renames) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the order of execution of methods is not correct and gives errors
openupgrade.rename_tables(env.cr, _tables_renames) | |
openupgrade.rename_models(env.cr, _models_renames) | |
openupgrade.rename_fields(env, _fields_renames) | |
openupgrade.rename_columns(env.cr, _columns_renames) | |
openupgrade.rename_columns(env.cr, _columns_renames) | |
openupgrade.rename_fields(env, _fields_renames) | |
openupgrade.rename_models(env.cr, _models_renames) | |
openupgrade.rename_tables(env.cr, _tables_renames) |
WHEN sl.usage = 'internal' AND sl.id = sw.lot_stock_id THEN True | ||
ELSE FALSE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WHEN sl.usage = 'internal' AND sl.id = sw.lot_stock_id THEN True | |
ELSE FALSE | |
WHEN sl.usage = 'internal' AND sl.id = sw.lot_stock_id THEN TRUE | |
ELSE FALSE |
END as replenish_location_status | ||
FROM stock_location sl | ||
LEFT JOIN stock_warehouse sw | ||
ON sw.id = sl.warehouse_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This left join does not work because the field does not exist and if it does exist it will be empty.
you have to change it to
ON sw.id = sl.warehouse_id | |
ON sw.lot_stock_id = sl.id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can confirm this fix
Hello! We are migrating from v13 to v16. Can you share the status of migration scripts v15 to v16? Can we help in any way to finish it? |
Hello, do you plan to work on the previous comments or does someone plan to work on it? I also need this script for a migration. Thanks! |
I think the comment thread has not been checked. Hopefully, someone in charge of OCA will review these cases or tell us how to proceed. |
The problem is that I don't know how to proceed to upload those changes to another user's proposal. If there is OCA documentation for this I have not found it. There have been suggestions for changes that can be applied but I don't know if this is the right way to go about it. Can someone from OCA point us in the right direction? |
diff --git a/openupgrade_scripts/scripts/stock/16.0.1.1/pre-migration.py b/openupgrade_scripts/scripts/stock/16.0.1.1/pre-migration.py
index f287c09..ff023b5 100644
--- a/openupgrade_scripts/scripts/stock/16.0.1.1/pre-migration.py
+++ b/openupgrade_scripts/scripts/stock/16.0.1.1/pre-migration.py
@@ -92,7 +92,7 @@ def _compute_stock_location_replenish_location(env):
END as replenish_location_status
FROM stock_location sl
LEFT JOIN stock_warehouse sw
- ON sw.id = sl.warehouse_id
+ ON sw.lot_stock_id = sl.id
)
UPDATE stock_location sl
SET replenish_location = info.replenish_location_status
@@ -121,10 +121,10 @@ def _update_stock_quant_package_pack_date(env):
@openupgrade.migrate()
def migrate(env, version):
- openupgrade.rename_tables(env.cr, _tables_renames)
- openupgrade.rename_models(env.cr, _models_renames)
- openupgrade.rename_fields(env, _fields_renames)
openupgrade.rename_columns(env.cr, _columns_renames)
+ openupgrade.rename_fields(env, _fields_renames)
+ openupgrade.rename_models(env.cr, _models_renames)
+ openupgrade.rename_tables(env.cr, _tables_renames)
_update_stock_quant_storage_category_id(env)
_update_stock_quant_package_pack_date(env)
_update_sol_product_category_name(env) Those set of changes (which were commented on this thread) apparently fixed migration errors for me. |
Hi, I think the only way to do that is to open a new PR. You can cherry-pick this commit or set @hoangtiendung070797 as co-author of your commit. |
I can confirm this PR with @crazybolillo 's patch works |
Thank you for appreciating my review and follow-up work. More of the same. |
Is there any plans to merge this, @percevaq can you open a PR with these changes cherry-picked and your fixes on top? |
@hoangtiendung070797 can you apply the patch that @crazybolillo indicates to see if the error is solved and we can give a boost to this? |
Hi everybody, |
@pedrobaeza we close this PR for : #4291 ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
migration to 16.0