diff --git a/account_move_line_mrp_info/__manifest__.py b/account_move_line_mrp_info/__manifest__.py index 7781393bc..7582bc3a1 100644 --- a/account_move_line_mrp_info/__manifest__.py +++ b/account_move_line_mrp_info/__manifest__.py @@ -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", diff --git a/account_move_line_mrp_info/hooks.py b/account_move_line_mrp_info/hooks.py index bcb4d1f15..35d0b3dc5 100644 --- a/account_move_line_mrp_info/hooks.py +++ b/account_move_line_mrp_info/hooks.py @@ -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) diff --git a/account_move_line_mrp_info/tests/test_mrp_journal_items.py b/account_move_line_mrp_info/tests/test_mrp_journal_items.py index 24e09de06..50e094933 100644 --- a/account_move_line_mrp_info/tests/test_mrp_journal_items.py +++ b/account_move_line_mrp_info/tests/test_mrp_journal_items.py @@ -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() diff --git a/account_move_line_mrp_info/views/mrp_production_view.xml b/account_move_line_mrp_info/views/mrp_production_view.xml index 6bfaf88d5..73c19bd93 100644 --- a/account_move_line_mrp_info/views/mrp_production_view.xml +++ b/account_move_line_mrp_info/views/mrp_production_view.xml @@ -24,7 +24,7 @@ class="oe_stat_button" icon="fa-th-list" groups="base.group_no_one" - attrs="{'invisible': [('state', '!=', 'done')]}" + invisible="state != 'done'" /> @@ -42,7 +42,7 @@ class="oe_stat_button" icon="fa-th-list" groups="base.group_no_one" - attrs="{'invisible': [('state', '=', 'draft')]}" + invisible="state == 'draft'" />