mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[MIG] account_move_line_mrp_info: Migration to 17.0
Minor fixes Adjustments
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
{
|
||||
"name": "Account Move Line Mrp Info",
|
||||
"version": "16.0.1.0.0",
|
||||
"version": "17.0.1.0.0",
|
||||
"author": "ForgeFlow," "Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/manufacture",
|
||||
"category": "Manufacture",
|
||||
|
||||
@@ -3,7 +3,7 @@ import logging
|
||||
from psycopg2 import sql
|
||||
|
||||
|
||||
def pre_init_hook(cr):
|
||||
def pre_init_hook(env):
|
||||
"""Precreate move_type and fill with appropriate values to prevent
|
||||
a MemoryError when the ORM attempts to call its compute method on a large
|
||||
amount of preexisting moves. Note that the order of the mapping is
|
||||
@@ -11,8 +11,9 @@ def pre_init_hook(cr):
|
||||
and the move type is set in the order of precedence."""
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.info("Add mrp_info")
|
||||
cr.execute(
|
||||
"ALTER TABLE account_move_line ADD COLUMN IF NOT EXISTS mrp_production_id INTEGER"
|
||||
env.cr.execute(
|
||||
"ALTER TABLE account_move_line "
|
||||
"ADD COLUMN IF NOT EXISTS mrp_production_id INTEGER"
|
||||
)
|
||||
query = sql.SQL(
|
||||
"""
|
||||
@@ -29,8 +30,8 @@ def pre_init_hook(cr):
|
||||
where q2.account_move_id=account_move_line.id;
|
||||
"""
|
||||
)
|
||||
cr.execute(query)
|
||||
cr.execute(
|
||||
env.cr.execute(query)
|
||||
env.cr.execute(
|
||||
"ALTER TABLE account_move_line ADD COLUMN IF NOT EXISTS unbuild_id INTEGER"
|
||||
)
|
||||
query = sql.SQL(
|
||||
@@ -48,4 +49,4 @@ def pre_init_hook(cr):
|
||||
where q2.account_move_id=account_move_line.id;
|
||||
"""
|
||||
)
|
||||
cr.execute(query)
|
||||
env.cr.execute(query)
|
||||
|
||||
@@ -18,7 +18,7 @@ class TestMrpOrder(TestMrpCommon):
|
||||
super(TestMrpCommon, cls).setUpClass()
|
||||
|
||||
def setUp(self):
|
||||
super(TestMrpOrder, self).setUp()
|
||||
super().setUp()
|
||||
self.stock_location = self.env.ref("stock.stock_location_stock")
|
||||
self.Quant = self.env["stock.quant"].with_context(inventory_mode=True)
|
||||
self.env.ref("base.group_user").write(
|
||||
@@ -124,7 +124,7 @@ class TestUnbuild(TestMrpCommon):
|
||||
super(TestMrpCommon, cls).setUpClass()
|
||||
|
||||
def setUp(self):
|
||||
super(TestUnbuild, self).setUp()
|
||||
super().setUp()
|
||||
self.stock_location = self.env.ref("stock.stock_location_stock")
|
||||
self.Quant = self.env["stock.quant"].with_context(inventory_mode=True)
|
||||
self.env.ref("base.group_user").write(
|
||||
@@ -132,8 +132,9 @@ class TestUnbuild(TestMrpCommon):
|
||||
)
|
||||
|
||||
def test_unbuild_with_journal_items(self):
|
||||
"""This test creates an Unbuild order from a Manufacturing order and then check if the
|
||||
Journal Items button links to the journal items of the order.
|
||||
"""This test creates an Unbuild order from a Manufacturing order
|
||||
and then check if the Journal Items button links to the
|
||||
journal items of the order.
|
||||
"""
|
||||
|
||||
mo, bom, p_final, p1, p2 = self.generate_mo()
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
class="oe_stat_button"
|
||||
icon="fa-th-list"
|
||||
groups="base.group_no_one"
|
||||
attrs="{'invisible': [('state', '!=', 'done')]}"
|
||||
invisible="state != 'done'"
|
||||
/>
|
||||
</xpath>
|
||||
</field>
|
||||
@@ -42,7 +42,7 @@
|
||||
class="oe_stat_button"
|
||||
icon="fa-th-list"
|
||||
groups="base.group_no_one"
|
||||
attrs="{'invisible': [('state', '=', 'draft')]}"
|
||||
invisible="state == 'draft'"
|
||||
/>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user