Browse Source
[MIG] base_global_discount: Migration to 13.0
[MIG] base_global_discount: Migration to 13.0
[UPD] Update base_global_discount.pot Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: server-backend-13.0/server-backend-13.0-base_global_discount Translate-URL: https://translation.odoo-community.org/projects/server-backend-13-0/server-backend-13-0-base_global_discount/14.0
Ernesto Tejeda
4 years ago
committed by
Omar (Comunitea)
15 changed files with 85 additions and 40 deletions
-
16base_global_discount/README.rst
-
6base_global_discount/__manifest__.py
-
11base_global_discount/i18n/base_global_discount.pot
-
4base_global_discount/i18n/es.po
-
6base_global_discount/i18n/pt.po
-
36base_global_discount/migrations/13.0.1.0.0/post-migration.py
-
13base_global_discount/migrations/13.0.1.0.0/pre-migration.py
-
14base_global_discount/models/global_discount.py
-
2base_global_discount/models/res_partner.py
-
1base_global_discount/readme/CONTRIBUTORS.rst
-
5base_global_discount/readme/USAGE.rst
-
2base_global_discount/security/security.xml
-
4base_global_discount/tests/test_global_discount.py
-
1base_global_discount/views/global_discount_views.xml
-
4base_global_discount/views/res_partner_views.xml
@ -0,0 +1,36 @@ |
|||
# Copyright 2020 Tecnativa - Ernesto Tejeda |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from openupgradelib import openupgrade |
|||
|
|||
|
|||
@openupgrade.migrate() |
|||
def migrate(env, version): |
|||
openupgrade.logged_query( |
|||
env.cr, |
|||
""" |
|||
INSERT INTO customer_global_discount_rel |
|||
(partner_id, global_discount_id) |
|||
SELECT |
|||
partner_id, |
|||
global_discount_id |
|||
FROM |
|||
global_discount_res_partner_rel |
|||
WHERE |
|||
discount_scope = 'sale'; |
|||
""", |
|||
) |
|||
openupgrade.logged_query( |
|||
env.cr, |
|||
""" |
|||
INSERT INTO supplier_global_discount_rel |
|||
(partner_id, global_discount_id) |
|||
SELECT |
|||
partner_id, |
|||
field_id |
|||
FROM |
|||
global_discount_res_partner_rel |
|||
WHERE |
|||
discount_scope = 'purchase'; |
|||
""", |
|||
) |
@ -0,0 +1,13 @@ |
|||
# Copyright 2020 Tecnativa - Ernesto Tejeda |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
|
|||
def migrate(cr, version): |
|||
if not version: |
|||
return |
|||
cr.execute( |
|||
""" |
|||
DELETE FROM ir_model_relation |
|||
WHERE name = 'global_discount_res_partner_rel'; |
|||
""" |
|||
) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue