Skip to content

Commit

Permalink
Merge pull request #1032 from Tecnativa/13.0-fix-product_abc_classifi…
Browse files Browse the repository at this point in the history
…cation_sale-migration-script

[13.0][OU-FIX] product_abc_classification_sale: migration script
  • Loading branch information
pedrobaeza committed Mar 9, 2022
2 parents 053fb7b + 162f326 commit b959a4b
Showing 1 changed file with 46 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,53 @@ def _create_profile_from_config_parameters(env):
openupgrade.logged_query(
env.cr,
"""
INSERT INTO abc_classification_profile_level (
profile_id,
fixed,
)
SELECT
(
SELECT acp.id as profile, rc.sale_classification_a as fixed
FROM abc_classification_profile acp
JOIN res_company rc ON rc.id = acp.company_id
),
(
SELECT acp.id as profile, rc.sale_classification_b as fixed
FROM abc_classification_profile acp
JOIN res_company rc ON rc.id = acp.company_id
),
(
SELECT acp.id as profile, rc.sale_classification_c as fixed
FROM abc_classification_profile acp
JOIN res_company rc ON rc.id = acp.company_id
),
(
SELECT acp.id as profile, 0 as fixed
FROM abc_classification_profile acp
JOIN res_company rc ON rc.id = acp.company_id
INSERT INTO abc_classification_profile_level (
profile_id,
fixed
)
SELECT acp.id, rc.sale_classification_a
FROM abc_classification_profile acp
JOIN res_company rc ON rc.id = acp.company_id
;
""",
)
openupgrade.logged_query(
env.cr,
"""
INSERT INTO abc_classification_profile_level (
profile_id,
fixed
)
SELECT acp.id, rc.sale_classification_b
FROM abc_classification_profile acp
JOIN res_company rc ON rc.id = acp.company_id
;
""",
)
openupgrade.logged_query(
env.cr,
"""
INSERT INTO abc_classification_profile_level (
profile_id,
fixed
)
SELECT acp.id, rc.sale_classification_c
FROM abc_classification_profile acp
JOIN res_company rc ON rc.id = acp.company_id
;
""",
)
openupgrade.logged_query(
env.cr,
"""
INSERT INTO abc_classification_profile_level (
profile_id,
fixed
)
SELECT acp.id, 0
FROM abc_classification_profile acp
JOIN res_company rc ON rc.id = acp.company_id
;
""",
)

Expand Down

0 comments on commit b959a4b

Please sign in to comment.