mirror of
https://github.com/OCA/server-backend.git
synced 2025-02-18 09:52:42 +02:00
[MIG] base_global_discount: Migration to 14.0
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
{
|
{
|
||||||
"name": "Base Global Discount",
|
"name": "Base Global Discount",
|
||||||
"version": "13.0.2.0.0",
|
"version": "14.0.1.0.0",
|
||||||
"category": "Base",
|
"category": "Base",
|
||||||
"author": "Tecnativa, Odoo Community Association (OCA)",
|
"author": "Tecnativa, Odoo Community Association (OCA)",
|
||||||
"website": "https://github.com/OCA/server-backend",
|
"website": "https://github.com/OCA/server-backend",
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
# 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';
|
|
||||||
""",
|
|
||||||
)
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
# 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';
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
@@ -25,7 +25,7 @@ class ResPartner(models.Model):
|
|||||||
# HACK: Looks like UI doesn't behave well with Many2many fields and
|
# HACK: Looks like UI doesn't behave well with Many2many fields and
|
||||||
# negative groups when the same field is shown. In this case, we want to
|
# negative groups when the same field is shown. In this case, we want to
|
||||||
# show the readonly version to any not in the global discount group.
|
# show the readonly version to any not in the global discount group.
|
||||||
# TODO: Check in v14 if it's fixed
|
# TODO: Check in future versions if it's fixed
|
||||||
customer_global_discount_ids_readonly = fields.Many2many(
|
customer_global_discount_ids_readonly = fields.Many2many(
|
||||||
string="Sale Global Discounts (readonly)",
|
string="Sale Global Discounts (readonly)",
|
||||||
related="customer_global_discount_ids",
|
related="customer_global_discount_ids",
|
||||||
|
|||||||
@@ -5,3 +5,4 @@
|
|||||||
* Carlos Dauden
|
* Carlos Dauden
|
||||||
* Rafael Blasco
|
* Rafael Blasco
|
||||||
* Ernesto Tejeda
|
* Ernesto Tejeda
|
||||||
|
* Omar Castiñeira <omar@comunitea.com>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
widget="many2many_tags"
|
widget="many2many_tags"
|
||||||
groups="!base_global_discount.group_global_discount"
|
groups="!base_global_discount.group_global_discount"
|
||||||
attrs="{'invisible': [('is_company', '=', False), ('parent_id', '!=', False)]}"
|
attrs="{'invisible': [('is_company', '=', False), ('parent_id', '!=', False)]}"
|
||||||
|
readonly="1"
|
||||||
/>
|
/>
|
||||||
</group>
|
</group>
|
||||||
<group name="purchase" position="inside">
|
<group name="purchase" position="inside">
|
||||||
|
|||||||
1
setup/base_global_discount/odoo/addons/base_global_discount
Symbolic link
1
setup/base_global_discount/odoo/addons/base_global_discount
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../../../base_global_discount
|
||||||
6
setup/base_global_discount/setup.py
Normal file
6
setup/base_global_discount/setup.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['setuptools-odoo'],
|
||||||
|
odoo_addon=True,
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user