Skip to content

Commit

Permalink
[MIG] account_move_line_rma_order_line: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPForgeFlow committed May 9, 2024
1 parent 8033ed4 commit 3247261
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 35 deletions.
2 changes: 1 addition & 1 deletion account_move_line_rma_order_line/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

This file was deleted.

4 changes: 2 additions & 2 deletions account_move_line_rma_order_line/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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"]
Expand All @@ -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)
Expand All @@ -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,
Expand All @@ -81,21 +80,14 @@ 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."""
account = cls.account_model.create(
{
"name": name,
"code": code,
"user_type_id": acc_type.id,
"account_type": acc_type,
"company_id": company.id,
"reconcile": reconcile,
}
Expand Down Expand Up @@ -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",
Expand All @@ -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
Expand All @@ -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",
Expand Down

0 comments on commit 3247261

Please sign in to comment.