diff --git a/stock_account_operating_unit/README.rst b/stock_account_operating_unit/README.rst index 06a42cde8e..631877a956 100644 --- a/stock_account_operating_unit/README.rst +++ b/stock_account_operating_unit/README.rst @@ -71,6 +71,7 @@ Contributors - Serpent Consulting Services Pvt. Ltd. - Jarsa Sistemas +- Daniel Herreros Maintainers ----------- diff --git a/stock_account_operating_unit/__manifest__.py b/stock_account_operating_unit/__manifest__.py index b909669448..3a609c95ad 100644 --- a/stock_account_operating_unit/__manifest__.py +++ b/stock_account_operating_unit/__manifest__.py @@ -7,7 +7,7 @@ "name": "Stock account moves with Operating Unit", "summary": "Create journal entries in moves between internal locations " "with different operating units.", - "version": "15.0.1.0.0", + "version": "17.0.1.0.0", "category": "Generic Modules/Sales & Purchases", "author": "Eficent Business and IT Consulting Services S.L., " "Serpent Consulting Services Pvt. Ltd.," diff --git a/stock_account_operating_unit/model/stock_move.py b/stock_account_operating_unit/model/stock_move.py index a53e853cc9..59f22197e8 100644 --- a/stock_account_operating_unit/model/stock_move.py +++ b/stock_account_operating_unit/model/stock_move.py @@ -16,15 +16,17 @@ def _generate_valuation_lines_data( credit_value, debit_account_id, credit_account_id, + svl_id, description, ): - res = super(StockMove, self)._generate_valuation_lines_data( + res = super()._generate_valuation_lines_data( partner_id, qty, debit_value, credit_value, debit_account_id, credit_account_id, + svl_id, description, ) if res: @@ -79,7 +81,7 @@ def _action_done(self, cancel_backorder=False): a transit location or is outside of the company or the source or destination locations belong to different operating units. """ - res = super(StockMove, self)._action_done(cancel_backorder) + res = super()._action_done(cancel_backorder) for move in self: if move.product_id.valuation == "real_time": # Inter-operating unit moves do not accept to @@ -101,6 +103,7 @@ def _action_done(self, cancel_backorder=False): move.product_id.standard_price, acc_valuation, acc_valuation, + False, _("%s - OU Move") % move.product_id.display_name, ) am = ( diff --git a/stock_account_operating_unit/readme/CONTRIBUTORS.md b/stock_account_operating_unit/readme/CONTRIBUTORS.md index 8727574b10..a04d0074fe 100644 --- a/stock_account_operating_unit/readme/CONTRIBUTORS.md +++ b/stock_account_operating_unit/readme/CONTRIBUTORS.md @@ -2,3 +2,4 @@ \<\> - Serpent Consulting Services Pvt. Ltd. \<\> - Jarsa Sistemas \<\> +- Daniel Herreros \<\> diff --git a/stock_account_operating_unit/static/description/index.html b/stock_account_operating_unit/static/description/index.html index f674ea3da4..2518cb3888 100644 --- a/stock_account_operating_unit/static/description/index.html +++ b/stock_account_operating_unit/static/description/index.html @@ -417,6 +417,7 @@

Contributors

<contact@eficent.com>
  • Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
  • Jarsa Sistemas <info@jarsa.com.mx>
  • +
  • Daniel Herreros <daniel.herreros@braintec.com>
  • diff --git a/stock_account_operating_unit/tests/__init__.py b/stock_account_operating_unit/tests/__init__.py index 604c5f9c2e..5af3358fc4 100644 --- a/stock_account_operating_unit/tests/__init__.py +++ b/stock_account_operating_unit/tests/__init__.py @@ -1,2 +1,2 @@ -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). from . import test_stock_account_operating_unit diff --git a/stock_account_operating_unit/tests/test_stock_account_operating_unit.py b/stock_account_operating_unit/tests/test_stock_account_operating_unit.py index 872b0a9812..bc289d72af 100644 --- a/stock_account_operating_unit/tests/test_stock_account_operating_unit.py +++ b/stock_account_operating_unit/tests/test_stock_account_operating_unit.py @@ -2,21 +2,19 @@ # - Jordi Ballester Alomar # © 2019 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). -from odoo.tests import Form from odoo.addons.stock.tests.common import TestStockCommon class TestStockAccountOperatingUnit(TestStockCommon): def setUp(self): - super(TestStockAccountOperatingUnit, self).setUp() + super().setUp() self.res_groups = self.env["res.groups"] self.res_users_model = self.env["res.users"] self.aml_model = self.env["account.move.line"] self.account_model = self.env["account.account"] self.product_model = self.env["product.product"] self.product_cteg_model = self.env["product.category"] - self.acc_type_model = self.env["account.account.type"] self.operating_unit_model = self.env["operating.unit"] self.company_model = self.env["res.company"] self.move_model = self.env["stock.move"] @@ -55,24 +53,24 @@ def setUp(self): # Create account for Goods Received Not Invoiced name = "Goods Received Not Invoiced" code = "grni" - acc_type = self.env.ref("account.data_account_type_equity") + acc_type = "equity" self.account_grni = self._create_account(acc_type, name, code, self.company) # Create account for Cost of Goods Sold name = "Cost of Goods Sold" code = "cogs" - acc_type = self.env.ref("account.data_account_type_expenses") + acc_type = "expense" self.account_cogs_id = self._create_account(acc_type, name, code, self.company) # Create account for Inventory name = "Inventory" code = "inventory" - acc_type = self.env.ref("account.data_account_type_fixed_assets") + acc_type = "asset_fixed" self.account_inventory = self._create_account( acc_type, name, code, self.company ) # Create account for Inter-OU Clearing name = "Inter-OU Clearing" - code = "inter_ou" - acc_type = self.env.ref("account.data_account_type_equity") + code = "inter.ou" + acc_type = "equity" self.account_inter_ou_clearing = self._create_account( acc_type, name, code, self.company ) @@ -118,7 +116,7 @@ def _create_account(self, acc_type, name, code, company): { "name": name, "code": code, - "user_type_id": acc_type.id, + "account_type": acc_type, "company_id": company.id, } ) @@ -175,12 +173,7 @@ def _confirm_receive(self, user_id, picking): """ picking.action_confirm() picking.action_assign() - res = picking.with_user(user_id).button_validate() - wiz = Form( - self.env[res["res_model"]].with_context(**res["context"]), - view=self.env.ref("stock.view_immediate_transfer"), - ).save() - wiz.process() + picking.with_user(user_id).button_validate() def _check_account_balance( self, account_id, operating_unit=None, expected_balance=0.0 @@ -197,8 +190,9 @@ def _check_account_balance( self.assertEqual( balance, expected_balance, - "Balance is not %s for Operating Unit %s." - % (str(expected_balance), operating_unit.name), + "Balance is not {} for Operating Unit {}.".format( + expected_balance, operating_unit.name + ), ) else: self.assertEqual(