odoo-addon-openupgrade-scripts 16.0.1.0.4.1__py3-none-any.whl → 16.0.1.0.4.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- odoo/addons/openupgrade_scripts/scripts/stock/16.0.1.1/post-migration.py +18 -0
- odoo/addons/openupgrade_scripts/scripts/stock/16.0.1.1/pre-migration.py +54 -0
- odoo/addons/openupgrade_scripts/scripts/stock/16.0.1.1/upgrade_analysis_work.txt +1 -1
- {odoo_addon_openupgrade_scripts-16.0.1.0.4.1.dist-info → odoo_addon_openupgrade_scripts-16.0.1.0.4.3.dist-info}/METADATA +1 -1
- {odoo_addon_openupgrade_scripts-16.0.1.0.4.1.dist-info → odoo_addon_openupgrade_scripts-16.0.1.0.4.3.dist-info}/RECORD +7 -7
- {odoo_addon_openupgrade_scripts-16.0.1.0.4.1.dist-info → odoo_addon_openupgrade_scripts-16.0.1.0.4.3.dist-info}/WHEEL +1 -1
- {odoo_addon_openupgrade_scripts-16.0.1.0.4.1.dist-info → odoo_addon_openupgrade_scripts-16.0.1.0.4.3.dist-info}/top_level.txt +0 -0
@@ -42,8 +42,26 @@ def _handle_stock_picking_backorder_strategy(env):
|
|
42
42
|
)
|
43
43
|
|
44
44
|
|
45
|
+
def _complete_stock_move_quantity_done_with_orm(env):
|
46
|
+
"""In pre-migration we left out the moves with lines with different units of
|
47
|
+
measure to be treated by the ORM"""
|
48
|
+
env.cr.execute(
|
49
|
+
"""
|
50
|
+
SELECT move_id
|
51
|
+
FROM stock_move_line
|
52
|
+
WHERE state != 'cancel'
|
53
|
+
GROUP BY move_id
|
54
|
+
HAVING COUNT(DISTINCT product_uom_id) > 1
|
55
|
+
AND SUM(qty_done) <> 0
|
56
|
+
"""
|
57
|
+
)
|
58
|
+
move_ids = [id for id, *_ in env.cr.fetchall() if id]
|
59
|
+
env["stock.move"].browse(move_ids)._quantity_done_compute()
|
60
|
+
|
61
|
+
|
45
62
|
@openupgrade.migrate()
|
46
63
|
def migrate(env, version):
|
47
64
|
_handle_multi_location_visibility(env)
|
48
65
|
_handle_stock_picking_backorder_strategy(env)
|
49
66
|
openupgrade.load_data(env.cr, "stock", "16.0.1.1/noupdate_changes.xml")
|
67
|
+
_complete_stock_move_quantity_done_with_orm(env)
|
@@ -127,6 +127,59 @@ def _handle_stock_picking_backorder_strategy(env):
|
|
127
127
|
)
|
128
128
|
|
129
129
|
|
130
|
+
def _prefill_stock_move_quantity_done(env):
|
131
|
+
"""It's going to be an stored field now. Let's try to speed up the field
|
132
|
+
computation so it performs better in larga stock_move tables"""
|
133
|
+
if not openupgrade.column_exists(env.cr, "stock_move", "quantity_done"):
|
134
|
+
openupgrade.add_fields(
|
135
|
+
env,
|
136
|
+
[
|
137
|
+
(
|
138
|
+
"quantity_done",
|
139
|
+
"stock.move",
|
140
|
+
"stock_move",
|
141
|
+
"float",
|
142
|
+
False,
|
143
|
+
"stock",
|
144
|
+
)
|
145
|
+
],
|
146
|
+
)
|
147
|
+
# For moves with lines with different units of measure we rather pass them through
|
148
|
+
# the ORM in post-migration, although this will deal with the vast majority of
|
149
|
+
# moves.
|
150
|
+
openupgrade.logged_query(
|
151
|
+
env.cr,
|
152
|
+
"""
|
153
|
+
WITH precision_cte AS (
|
154
|
+
SELECT digits FROM decimal_precision
|
155
|
+
WHERE name = 'Product Unit of Measure' LIMIT 1
|
156
|
+
),
|
157
|
+
consistent_moves AS (
|
158
|
+
SELECT move_id
|
159
|
+
FROM stock_move_line
|
160
|
+
GROUP BY move_id
|
161
|
+
HAVING COUNT(DISTINCT product_uom_id) = 1 AND SUM(qty_done) <> 0
|
162
|
+
),
|
163
|
+
move_quantities AS (
|
164
|
+
SELECT sm.id AS move_id,
|
165
|
+
-- Round the values to the current decimal precision in case it changed
|
166
|
+
-- in the past
|
167
|
+
SUM(
|
168
|
+
ROUND(sml.qty_done, (SELECT digits FROM precision_cte))
|
169
|
+
) AS total_quantity_done
|
170
|
+
FROM stock_move sm
|
171
|
+
JOIN stock_move_line sml ON sm.id = sml.move_id
|
172
|
+
WHERE sm.id IN (SELECT move_id FROM consistent_moves)
|
173
|
+
GROUP BY sm.id
|
174
|
+
)
|
175
|
+
UPDATE stock_move
|
176
|
+
SET quantity_done = mq.total_quantity_done
|
177
|
+
FROM move_quantities mq
|
178
|
+
WHERE stock_move.id = mq.move_id;
|
179
|
+
""",
|
180
|
+
)
|
181
|
+
|
182
|
+
|
130
183
|
@openupgrade.migrate()
|
131
184
|
def migrate(env, version):
|
132
185
|
openupgrade.rename_tables(env.cr, _tables_renames)
|
@@ -138,3 +191,4 @@ def migrate(env, version):
|
|
138
191
|
_update_sol_product_category_name(env)
|
139
192
|
_compute_stock_location_replenish_location(env)
|
140
193
|
_handle_stock_picking_backorder_strategy(env)
|
194
|
+
_prefill_stock_move_quantity_done(env)
|
@@ -90,7 +90,7 @@ stock / stock.move / lot_ids (many2many) : relati
|
|
90
90
|
# NOTHING TO DO
|
91
91
|
|
92
92
|
stock / stock.move / quantity_done (float) : is now stored
|
93
|
-
#
|
93
|
+
# DONE: pre-migration: pre-compute the majority for performance post-migration: compute with ORM the rest
|
94
94
|
|
95
95
|
stock / stock.move / route_ids (many2many) : relation is now 'stock.route' ('stock.location.route') [nothing to do]
|
96
96
|
# NOTHING TO DO
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: odoo-addon-openupgrade_scripts
|
3
|
-
Version: 16.0.1.0.4.
|
3
|
+
Version: 16.0.1.0.4.3
|
4
4
|
Summary: Module that contains all the migrations analysis and scripts for migrating Odoo SA modules.
|
5
5
|
Home-page: https://github.com/OCA/OpenUpgrade
|
6
6
|
Author: Odoo Community Association (OCA)
|
@@ -596,10 +596,10 @@ odoo/addons/openupgrade_scripts/scripts/spreadsheet_dashboard_sale_timesheet/16.
|
|
596
596
|
odoo/addons/openupgrade_scripts/scripts/spreadsheet_dashboard_stock_account/16.0.1.0/upgrade_analysis.txt,sha256=Vp-WUODorZEcKxq6rrNuRluCu9NbzZfNXIcNEM03Vdo,291
|
597
597
|
odoo/addons/openupgrade_scripts/scripts/spreadsheet_dashboard_website_sale_slides/16.0.1.0/upgrade_analysis.txt,sha256=ia8_6HEpeaY5bOmyhrMq92t8PKztRaCPP_w7w4AqZW0,307
|
598
598
|
odoo/addons/openupgrade_scripts/scripts/stock/16.0.1.1/noupdate_changes.xml,sha256=duUlxKkToVmaan9wD3Kl8phi_TT3V4CJ3mNAADH69NE,805
|
599
|
-
odoo/addons/openupgrade_scripts/scripts/stock/16.0.1.1/post-migration.py,sha256=
|
600
|
-
odoo/addons/openupgrade_scripts/scripts/stock/16.0.1.1/pre-migration.py,sha256=
|
599
|
+
odoo/addons/openupgrade_scripts/scripts/stock/16.0.1.1/post-migration.py,sha256=SjjpivhH3ei-pnUTGp3ZXfsTsq-pQcbN3vHsEdn_xo0,2396
|
600
|
+
odoo/addons/openupgrade_scripts/scripts/stock/16.0.1.1/pre-migration.py,sha256=V3KW5p6IcCDnWwRFlbrVPlKu2RPkUvv-D5oUfnqfLyg,6114
|
601
601
|
odoo/addons/openupgrade_scripts/scripts/stock/16.0.1.1/upgrade_analysis.txt,sha256=hI1BB9O45hRFUGUM8_uws2yoblPYMy26X3bZt1II7_U,8133
|
602
|
-
odoo/addons/openupgrade_scripts/scripts/stock/16.0.1.1/upgrade_analysis_work.txt,sha256=
|
602
|
+
odoo/addons/openupgrade_scripts/scripts/stock/16.0.1.1/upgrade_analysis_work.txt,sha256=6LsBb-ofs-3pja-g5SOaGlD2baLyhSqBhB_kQz54Cdc,14479
|
603
603
|
odoo/addons/openupgrade_scripts/scripts/stock_account/16.0.1.1/pre-migration.py,sha256=xVzqocfCFvbB5AGOrPUVyhCVdn8KEkyssMBvpsUcth8,948
|
604
604
|
odoo/addons/openupgrade_scripts/scripts/stock_account/16.0.1.1/upgrade_analysis.txt,sha256=--ShQGHEIfJ3hxITbLby_mqEszI05hutMWsZekrqnd8,805
|
605
605
|
odoo/addons/openupgrade_scripts/scripts/stock_account/16.0.1.1/upgrade_analysis_work.txt,sha256=ns6T8z3WXky-hn5FZNFLsxf3Uz7JIORzWT300uY_Aw8,865
|
@@ -723,7 +723,7 @@ odoo/addons/openupgrade_scripts/scripts/website_twitter/16.0.1.0/upgrade_analysi
|
|
723
723
|
odoo/addons/openupgrade_scripts/static/description/banner.png,sha256=KTIBu4gfxeZVw9zjs_fivTgFEOeaAorlBxajmCA1p6k,26859
|
724
724
|
odoo/addons/openupgrade_scripts/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
|
725
725
|
odoo/addons/openupgrade_scripts/static/description/index.html,sha256=In9_GT_zstffKTETBxiyjfSzZz_5JtVugN-08tmDS6o,12722
|
726
|
-
odoo_addon_openupgrade_scripts-16.0.1.0.4.
|
727
|
-
odoo_addon_openupgrade_scripts-16.0.1.0.4.
|
728
|
-
odoo_addon_openupgrade_scripts-16.0.1.0.4.
|
729
|
-
odoo_addon_openupgrade_scripts-16.0.1.0.4.
|
726
|
+
odoo_addon_openupgrade_scripts-16.0.1.0.4.3.dist-info/METADATA,sha256=Gu0B8c65XxYB_1PLKG_ofpk2_32V231X62Qc0OdpH-Y,3789
|
727
|
+
odoo_addon_openupgrade_scripts-16.0.1.0.4.3.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
728
|
+
odoo_addon_openupgrade_scripts-16.0.1.0.4.3.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
|
729
|
+
odoo_addon_openupgrade_scripts-16.0.1.0.4.3.dist-info/RECORD,,
|