-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] l10n_be_cooperator_national_number: Fix the tests
- Loading branch information
1 parent
10afd2e
commit 2fb232c
Showing
3 changed files
with
32 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from . import subscription_request | ||
from . import company | ||
from . import subscription_request | ||
from . import res_partner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# SPDX-FileCopyrightText: 2023 Coop IT Easy SC | ||
# | ||
# SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
from odoo import api, models | ||
|
||
|
||
class ResPartner(models.Model): | ||
_inherit = "res.partner" | ||
|
||
@api.model | ||
def create(self, vals): | ||
national_number = vals.pop("national_number", None) | ||
partner = super().create(vals) | ||
partner.create_national_number(national_number) | ||
return partner | ||
|
||
def create_national_number(self, national_number): | ||
self.ensure_one() | ||
result = None | ||
if national_number: | ||
values = { | ||
"name": national_number, | ||
"category_id": self.env.ref( | ||
"l10n_be_national_number.l10n_be_national_number_category" # noqa | ||
).id, | ||
"partner_id": self.id, | ||
} | ||
result = self.env["res.partner.id_number"].create(values) | ||
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters