Skip to content

Commit

Permalink
fixup! [MIG] pos_customer_wallet: Migration to 16.0
Browse files Browse the repository at this point in the history
Signed-off-by: Carmen Bianca BAKKER <[email protected]>
  • Loading branch information
carmenbianca committed Sep 7, 2023
1 parent c0535de commit 6f66939
Showing 1 changed file with 28 additions and 30 deletions.
58 changes: 28 additions & 30 deletions pos_customer_wallet/tests/test_balance.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright 2022 Coop IT Easy SC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

import random

from odoo import fields

from .common import TestPosBalance as TestBalance
Expand Down Expand Up @@ -45,7 +47,6 @@ def test_credit_by_product(self):
],
}
)

self.wallet_product = self.env.ref(
"account_customer_wallet.product_wallet_demo"
)
Expand All @@ -57,47 +58,35 @@ def test_credit_by_product(self):
"pricelist_id": self.pricelist.id,
}
)
self.pos_config.open_ui()

self.cash_method = self.pos_config.payment_method_ids.filtered(
lambda x: x.is_cash_count
)
self.cash_statement = self.pos_config.current_session_id.statement_ids.filtered(
lambda x: x.journal_id.type == "cash"
)
self.receivable_account = (
self.env.user.partner_id.property_account_receivable_id
)
self.pos_config.open_ui()

# Make an order
order_data = {
"id": "0006-001-0010",
"to_invoice": False,
"data": {
"creation_date": "2022-01-01 12:00:00",
"name": "Order 0006-001-0010",
"uid": "00001-001-0001",
"pricelist_id": self.pricelist.id,
"user_id": self.env.user.id,
"partner_id": self.partner.id,
"fiscal_position_id": False,
"sequence_number": 1,
"name": "Order Foo Bar",
"amount_paid": 1000.0,
"amount_total": 1000.0,
"amount_tax": 0,
"amount_return": 0,
"amount_total": 1000.0,
"amount_paid": 1000,
"pos_session_id": self.pos_config.current_session_id.id,
"lines": [
[
0,
0,
{
"product_id": self.wallet_product.id,
"price_unit": 1,
"qty": 1000,
"price_unit": 1.0,
"price_subtotal": 1000.0,
"price_subtotal_incl": 1000.0,
"tax_ids": False,
"discount": 0,
"product_id": self.wallet_product.id,
"tax_ids": [[6, 0, []]],
# The randint seems rather strange to me, but I
# nicked this idea from tests/common.py in the pos
# module.
"id": random.randint(1000, 1000000),
"pack_lot_ids": [],
},
]
],
Expand All @@ -106,15 +95,24 @@ def test_credit_by_product(self):
0,
0,
{
"journal_id": self.cash_journal.id,
"name": fields.Datetime.to_string(fields.Datetime.now()),
"payment_method_id": self.cash_method.id,
"amount": 1000.0,
"name": fields.Datetime.now(),
"account_id": self.receivable_account.id,
"statement_id": self.cash_statement.id,
},
]
],
"pos_session_id": self.pos_config.current_session_id.id,
"pricelist_id": self.pricelist.id,
"partner_id": self.partner.id,
"user_id": self.env.user.id,
"uid": "00001-001-1234",
"sequence_number": 1,
"creation_date": fields.Datetime.to_string(fields.Datetime.now()),
"fiscal_position_id": False,
"to_invoice": False,
},
"uid": "00001-001-1234",
"to_invoice": False,
}

# Buy 1000 of wallet product
Expand Down

0 comments on commit 6f66939

Please sign in to comment.