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 6f66939 commit 06ace62
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
1 change: 1 addition & 0 deletions pos_customer_wallet/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import pos_config
from . import pos_payment_method
from . import pos_session
from . import res_partner
14 changes: 14 additions & 0 deletions pos_customer_wallet/models/pos_payment_method.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-FileCopyrightText: 2023 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from odoo import fields, models


class PosPaymentMethod(models.Model):
_inherit = "pos.payment.method"

is_customer_wallet_method = fields.Boolean(
related="journal_id.is_customer_wallet_journal",
store=True,
)
20 changes: 4 additions & 16 deletions pos_customer_wallet/models/pos_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,17 @@
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from odoo import api, models
from odoo import models


class PosSession(models.Model):
_inherit = "pos.session"

@api.model
def _pos_ui_models_to_load(self):
result = super()._pos_ui_models_to_load()
result.append("account.journal")
def _loader_params_pos_payment_method(self):
result = super()._loader_params_pos_payment_method()
result["search_params"]["fields"].append("is_customer_wallet_method")
return result

def _loader_params_account_journal(self):
# TODO: This doesn't call super(), which means that it could be
# incompatible with other modules that also implement this method. Find
# a solution to this problem.
return {
"search_params": {
"domain": [],
"fields": ["is_customer_wallet_journal"],
}
}

def _loader_params_product_product(self):
result = super()._loader_params_product_product()
result["search_params"]["fields"].append("is_customer_wallet_product")
Expand Down

0 comments on commit 06ace62

Please sign in to comment.