From 2a7e6df0316789d13fd2f3c259596e3626ba150f Mon Sep 17 00:00:00 2001 From: AlexPForgeFlow Date: Fri, 4 Aug 2023 11:10:11 +0200 Subject: [PATCH] [MIG] account_move_line_sale_info: Migration to 16.0 --- account_move_line_sale_info/__manifest__.py | 4 ++-- account_move_line_sale_info/hooks.py | 2 +- .../models/account_move.py | 2 +- .../models/sale_order_line.py | 2 +- .../models/stock_move.py | 6 +++--- .../readme/CONFIGURE.rst | 0 .../tests/test_account_move_line_sale_info.py | 21 +++++++------------ 7 files changed, 15 insertions(+), 22 deletions(-) delete mode 100644 account_move_line_sale_info/readme/CONFIGURE.rst diff --git a/account_move_line_sale_info/__manifest__.py b/account_move_line_sale_info/__manifest__.py index c35e7433..ae1989ac 100644 --- a/account_move_line_sale_info/__manifest__.py +++ b/account_move_line_sale_info/__manifest__.py @@ -1,10 +1,10 @@ -# Copyright 2020 ForgeFlow S.L. +# Copyright 2020-23 ForgeFlow S.L. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Account Move Line Sale Info", "summary": "Introduces the purchase order line to the journal items", - "version": "15.0.1.0.3", + "version": "16.0.1.0.0", "author": "ForgeFlow S.L., " "Odoo Community Association (OCA)", "website": "https://github.com/OCA/account-financial-tools", "category": "Generic", diff --git a/account_move_line_sale_info/hooks.py b/account_move_line_sale_info/hooks.py index cd6be373..2ccdb260 100644 --- a/account_move_line_sale_info/hooks.py +++ b/account_move_line_sale_info/hooks.py @@ -1,4 +1,4 @@ -# Copyright 2019 ForgeFlow S.L. +# Copyright 2019-23 ForgeFlow S.L. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). diff --git a/account_move_line_sale_info/models/account_move.py b/account_move_line_sale_info/models/account_move.py index 0bb4346b..5996b305 100644 --- a/account_move_line_sale_info/models/account_move.py +++ b/account_move_line_sale_info/models/account_move.py @@ -1,4 +1,4 @@ -# Copyright 2020 ForgeFlow S.L. +# Copyright 2020-23 ForgeFlow S.L. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import fields, models diff --git a/account_move_line_sale_info/models/sale_order_line.py b/account_move_line_sale_info/models/sale_order_line.py index a46eeac9..b6c8c109 100644 --- a/account_move_line_sale_info/models/sale_order_line.py +++ b/account_move_line_sale_info/models/sale_order_line.py @@ -1,4 +1,4 @@ -# Copyright 2020 ForgeFlow S.L. +# Copyright 2020-23 ForgeFlow S.L. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import models diff --git a/account_move_line_sale_info/models/stock_move.py b/account_move_line_sale_info/models/stock_move.py index 4f522e11..01627480 100644 --- a/account_move_line_sale_info/models/stock_move.py +++ b/account_move_line_sale_info/models/stock_move.py @@ -1,4 +1,4 @@ -# Copyright 2020 ForgeFlow S.L. +# Copyright 2020-23 ForgeFlow S.L. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import api, models @@ -8,10 +8,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: line[2]["sale_line_id"] = self.sale_line_id.id diff --git a/account_move_line_sale_info/readme/CONFIGURE.rst b/account_move_line_sale_info/readme/CONFIGURE.rst deleted file mode 100644 index e69de29b..00000000 diff --git a/account_move_line_sale_info/tests/test_account_move_line_sale_info.py b/account_move_line_sale_info/tests/test_account_move_line_sale_info.py index a33c42e6..756880ac 100644 --- a/account_move_line_sale_info/tests/test_account_move_line_sale_info.py +++ b/account_move_line_sale_info/tests/test_account_move_line_sale_info.py @@ -1,4 +1,4 @@ -# Copyright 2020 ForgeFlow S.L. +# Copyright 2020-23 ForgeFlow S.L. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo.tests import common @@ -10,7 +10,6 @@ class TestAccountMoveLineSaleInfo(common.TransactionCase): self.sale_line_model = self.env["sale.order.line"] self.product_model = self.env["product.product"] self.product_ctg_model = self.env["product.category"] - self.acc_type_model = self.env["account.account.type"] self.account_model = self.env["account.account"] self.aml_model = self.env["account.move.line"] self.res_users_model = self.env["res.users"] @@ -23,18 +22,18 @@ class TestAccountMoveLineSaleInfo(common.TransactionCase): self.group_account_manager = self.env.ref("account.group_account_manager") # Create account for Goods Received Not Invoiced - acc_type = self._create_account_type("equity", "other") + acc_type = "equity" name = "Goods Received Not Invoiced" code = "grni" self.account_grni = self._create_account(acc_type, name, code, self.company) # Create account for Cost of Goods Sold - acc_type = self._create_account_type("expense", "other") + acc_type = "expense" name = "Cost of Goods Sold" code = "cogs" self.account_cogs = self._create_account(acc_type, name, code, self.company) # Create account for Inventory - acc_type = self._create_account_type("asset", "other") + acc_type = "asset_fixed" name = "Inventory" code = "inventory" self.account_inventory = self._create_account( @@ -81,19 +80,13 @@ class TestAccountMoveLineSaleInfo(common.TransactionCase): ) return user.id - def _create_account_type(self, name, atype): - acc_type = self.acc_type_model.create( - {"name": name, "type": atype, "internal_group": name} - ) - return acc_type - def _create_account(self, acc_type, name, code, company): """Create an account.""" account = self.account_model.create( { "name": name, "code": code, - "user_type_id": acc_type.id, + "account_type": acc_type, "company_id": company.id, } ) @@ -189,7 +182,7 @@ class TestAccountMoveLineSaleInfo(common.TransactionCase): break sale.action_confirm() picking = sale.picking_ids[0] - picking.move_lines.write({"quantity_done": 1.0}) + picking.move_ids.write({"quantity_done": 1.0}) picking.button_validate() expected_balance = -1.0 @@ -260,7 +253,7 @@ class TestAccountMoveLineSaleInfo(common.TransactionCase): break sale.action_confirm() picking = sale.picking_ids[0] - picking.move_lines.write({"quantity_done": 1.0}) + picking.move_ids.write({"quantity_done": 1.0}) picking.button_validate() sale._create_invoices() invoice = sale.invoice_ids[0]