Skip to content

Commit

Permalink
[MIG] stock_account_operating_unit: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BT-dherreros committed Jan 3, 2025
1 parent 9221c19 commit fb9abce
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
1 change: 1 addition & 0 deletions stock_account_operating_unit/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Contributors
<[email protected]>
- Serpent Consulting Services Pvt. Ltd. <[email protected]>
- Jarsa Sistemas <[email protected]>
- Daniel Herreros <[email protected]>

Maintainers
-----------
Expand Down
2 changes: 1 addition & 1 deletion stock_account_operating_unit/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.,"
Expand Down
7 changes: 5 additions & 2 deletions stock_account_operating_unit/model/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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 = (
Expand Down
1 change: 1 addition & 0 deletions stock_account_operating_unit/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
\<<[email protected]>\>
- Serpent Consulting Services Pvt. Ltd. \<<[email protected]>\>
- Jarsa Sistemas \<<[email protected]>\>
- Daniel Herreros \<<[email protected]>\>
1 change: 1 addition & 0 deletions stock_account_operating_unit/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
&lt;<a class="reference external" href="mailto:contact&#64;eficent.com">contact&#64;eficent.com</a>&gt;</li>
<li>Serpent Consulting Services Pvt. Ltd. &lt;<a class="reference external" href="mailto:support&#64;serpentcs.com">support&#64;serpentcs.com</a>&gt;</li>
<li>Jarsa Sistemas &lt;<a class="reference external" href="mailto:info&#64;jarsa.com.mx">info&#64;jarsa.com.mx</a>&gt;</li>
<li>Daniel Herreros &lt;<a class="reference external" href="mailto:daniel.herreros&#64;braintec.com">daniel.herreros&#64;braintec.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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
)
Expand Down Expand Up @@ -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,
}
)
Expand Down Expand Up @@ -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
Expand All @@ -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(
Expand Down

0 comments on commit fb9abce

Please sign in to comment.