Skip to content

Commit

Permalink
[MIG] portal_customer_wallet: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
carmenbianca committed Jul 4, 2023
1 parent 95edd09 commit cb6389a
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 17 deletions.
2 changes: 1 addition & 1 deletion portal_customer_wallet/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"name": "Portal Customer Wallet",
"summary": """
My Home displays expenditures using customer wallet""",
"version": "15.0.1.0.0",
"version": "16.0.1.0.0",
"category": "Website",
"website": "https://github.com/coopiteasy/addons",
"author": "Coop IT Easy SC",
Expand Down
2 changes: 1 addition & 1 deletion portal_customer_wallet/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ def _prepare_portal_layout_values(self):
)

values["customer_wallet_payments_per_month"] = ordered
values["company_currency"] = request.env.currency_id
values["company_currency"] = request.env.company.currency_id
values["customer_wallet_balance"] = partner_id.customer_wallet_balance
return values
8 changes: 2 additions & 6 deletions portal_customer_wallet/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,11 @@ def customer_wallet_payments_per_month(self):
self.ensure_one()
# Like in account_customer_wallet, search against all partners in family.
all_partners_in_family = self.get_all_partners_in_family()
all_account_ids = (
self.env["res.partner"]
.browse(all_partners_in_family)
.mapped("customer_wallet_account_id")
)
wallet_account_id = self.env.company.customer_wallet_account_id
move_lines = self.env["account.move.line"].search(
[
("partner_id", "in", all_partners_in_family),
("account_id", "in", all_account_ids.ids),
("account_id", "=", wallet_account_id.id),
# Negative balances = fill up the customer wallet. We're only
# interested in customer wallet spendings here, so let's skip
# them.
Expand Down
63 changes: 54 additions & 9 deletions portal_customer_wallet/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ def setUpClass(cls, *args, **kwargs):
{
"name": "Test Wallet Account",
"code": "10101010101",
"user_type_id": cls.env.ref(
"account.data_account_type_current_liabilities"
).id,
"account_type": "liability_current",
}
)
cls.company_id.customer_wallet_account_id = cls.customer_wallet_account
Expand All @@ -31,25 +29,72 @@ def setUpClass(cls, *args, **kwargs):
"code": "TSTWLLT",
"type": "bank",
"is_customer_wallet_journal": True,
"default_debit_account_id": cls.customer_wallet_account.id,
"default_credit_account_id": cls.customer_wallet_account.id,
"inbound_payment_method_line_ids": [
(
0,
False,
{
"payment_method_id": cls.env.ref(
"account.account_payment_method_manual_in"
).id,
"name": "Manual",
"payment_account_id": cls.customer_wallet_account.id,
},
)
],
"outbound_payment_method_line_ids": [
(
0,
False,
{
"payment_method_id": cls.env.ref(
"account.account_payment_method_manual_out"
).id,
"name": "Manual",
"payment_account_id": cls.customer_wallet_account.id,
},
)
],
}
)
cls.cash_account = cls.env["account.account"].create(
{
"name": "Test Cash Account",
"code": "654321",
"user_type_id": cls.env.ref("account.data_account_type_liquidity").id,
"account_type": "asset_cash",
}
)
cls.cash_journal = cls.env["account.journal"].create(
{
"name": "Test Cash Journal",
"code": "TSTCASH",
"type": "cash",
"journal_user": True,
"default_debit_account_id": cls.cash_account.id,
"default_credit_account_id": cls.cash_account.id,
"inbound_payment_method_line_ids": [
(
0,
False,
{
"payment_method_id": cls.env.ref(
"account.account_payment_method_manual_in"
).id,
"name": "Manual",
"payment_account_id": cls.cash_account.id,
},
)
],
"outbound_payment_method_line_ids": [
(
0,
False,
{
"payment_method_id": cls.env.ref(
"account.account_payment_method_manual_out"
).id,
"name": "Manual",
"payment_account_id": cls.cash_account.id,
},
)
],
}
)

Expand Down

0 comments on commit cb6389a

Please sign in to comment.