diff --git a/account_move_line_rma_order_line/__manifest__.py b/account_move_line_rma_order_line/__manifest__.py index 77666408d..01ddade0f 100644 --- a/account_move_line_rma_order_line/__manifest__.py +++ b/account_move_line_rma_order_line/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Account Move Line Rma Order Line", "summary": "Introduces the rma order line to the journal items", - "version": "14.0.1.1.0", + "version": "16.0.1.1.0", "author": "ForgeFlow, " "Odoo Community Association (OCA)", "website": "https://github.com/ForgeFlow/stock-rma", "category": "Generic", diff --git a/account_move_line_rma_order_line/migrations/14.0.1.1.0/post-migration.py b/account_move_line_rma_order_line/migrations/14.0.1.1.0/post-migration.py deleted file mode 100644 index 0ecd26e33..000000000 --- a/account_move_line_rma_order_line/migrations/14.0.1.1.0/post-migration.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com) -# Part of ForgeFlow. See LICENSE file for full copyright and licensing details. -import logging - -from odoo import SUPERUSER_ID, api - -from odoo.addons.account_move_line_rma_order_line import post_init_hook - -_logger = logging.getLogger(__name__) - - -def migrate(cr, version): - _logger.info("Trigger again the post_init_hook") - env = api.Environment(cr, SUPERUSER_ID, {}) - post_init_hook(cr, env.registry) diff --git a/account_move_line_rma_order_line/models/stock_move.py b/account_move_line_rma_order_line/models/stock_move.py index 39b05b44a..e2e01bc34 100644 --- a/account_move_line_rma_order_line/models/stock_move.py +++ b/account_move_line_rma_order_line/models/stock_move.py @@ -9,10 +9,10 @@ class StockMove(models.Model): @api.model def _prepare_account_move_line( - self, qty, cost, credit_account_id, debit_account_id, description + self, qty, cost, credit_account_id, debit_account_id, svl_id, description ): res = super(StockMove, self)._prepare_account_move_line( - qty, cost, credit_account_id, debit_account_id, description + qty, cost, credit_account_id, debit_account_id, svl_id, description ) for line in res: if ( diff --git a/account_move_line_rma_order_line/tests/test_account_move_line_rma_order_line.py b/account_move_line_rma_order_line/tests/test_account_move_line_rma_order_line.py index 88c3283a1..20568bd42 100644 --- a/account_move_line_rma_order_line/tests/test_account_move_line_rma_order_line.py +++ b/account_move_line_rma_order_line/tests/test_account_move_line_rma_order_line.py @@ -4,7 +4,7 @@ from odoo.tests import common -class TestAccountMoveLineRmaOrderLine(common.SavepointCase): +class TestAccountMoveLineRmaOrderLine(common.TransactionCase): @classmethod def setUpClass(cls): super(TestAccountMoveLineRmaOrderLine, cls).setUpClass() @@ -18,7 +18,6 @@ def setUpClass(cls): cls.invoice_line_model = cls.env["account.move.line"] cls.product_model = cls.env["product.product"] cls.product_ctg_model = cls.env["product.category"] - cls.acc_type_model = cls.env["account.account.type"] cls.account_model = cls.env["account.account"] cls.aml_model = cls.env["account.move.line"] cls.res_users_model = cls.env["res.users"] @@ -35,18 +34,18 @@ def setUpClass(cls): cls.customer_location = cls.env.ref("stock.stock_location_customers") cls.supplier_location = cls.env.ref("stock.stock_location_suppliers") # Create account for Goods Received Not Invoiced - acc_type = cls._create_account_type("equity", "other", "equity") + acc_type = "equity" name = "Goods Received Not Invoiced" code = "grni" cls.account_grni = cls._create_account(acc_type, name, code, cls.company) # Create account for Cost of Goods Sold - acc_type = cls._create_account_type("expense", "other", "expense") + acc_type = "expense" name = "Goods Delivered Not Invoiced" code = "gdni" cls.account_cogs = cls._create_account(acc_type, name, code, cls.company) # Create account for Inventory - acc_type = cls._create_account_type("asset", "other", "asset") + acc_type = "asset_cash" name = "Inventory" code = "inventory" cls.account_inventory = cls._create_account(acc_type, name, code, cls.company) @@ -68,7 +67,7 @@ def setUpClass(cls): def _create_user(cls, login, groups, company): """Create a user.""" group_ids = [group.id for group in groups] - user = cls.res_users_model.with_context({"no_reset_password": True}).create( + user = cls.res_users_model.with_context(**{"no_reset_password": True}).create( { "name": "Test User", "login": login, @@ -81,13 +80,6 @@ def _create_user(cls, login, groups, company): ) return user.id - @classmethod - def _create_account_type(cls, name, account_type, internal_group): - acc_type = cls.acc_type_model.create( - {"name": name, "type": account_type, "internal_group": internal_group} - ) - return acc_type - @classmethod def _create_account(cls, acc_type, name, code, company, reconcile=False): """Create an account.""" @@ -95,7 +87,7 @@ def _create_account(cls, acc_type, name, code, company, reconcile=False): { "name": name, "code": code, - "user_type_id": acc_type.id, + "account_type": acc_type, "company_id": company.id, "reconcile": reconcile, } @@ -234,7 +226,7 @@ def test_rma_invoice(self): rma.price_unit = 1.0 rma_line.action_rma_approve() wizard = self.rma_make_picking.with_context( - { + **{ "active_id": 1, "active_ids": rma_line.ids, "active_model": "rma.order.line", @@ -254,7 +246,7 @@ def test_rma_invoice(self): else: picking_ids = self.env["stock.picking"].search(res["domain"]) picking = self.env["stock.picking"].browse(picking_ids) - picking.move_lines.write({"quantity_done": 1.0}) + picking.move_ids.write({"quantity_done": 1.0}) picking.button_validate() # decreasing cogs expected_balance = -1.0 @@ -263,7 +255,7 @@ def test_rma_invoice(self): self.account_cogs.id, rma_line=record, expected_balance=expected_balance ) make_refund = self.rma_refund_wiz.with_context( - { + **{ "customer": True, "active_ids": rma_line.ids, "active_model": "rma.order.line",