Skip to content

Commit

Permalink
Merge PR #139 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by carmenbianca
  • Loading branch information
OCA-git-bot committed Jun 14, 2024
2 parents 8df73a6 + 2323966 commit d122c74
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
26 changes: 14 additions & 12 deletions l10n_be_cooperator_national_number/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,20 @@ def get_be_national_register_number(self):
def update_belgian_national_number(self, national_number):
self.ensure_one()
result = None
if national_number:
existing = self.get_be_national_register_number_id_number()
# Update
if existing:
existing = self.get_be_national_register_number_id_number()
# Update
if existing:
if not national_number:
existing.unlink()
else:
existing.name = national_number
result = existing
# Create new
else:
values = {
"name": national_number,
"category_id": self.get_be_national_register_number_id_category().id,
"partner_id": self.id,
}
result = self.env["res.partner.id_number"].create(values)
# Create new
elif national_number:
values = {
"name": national_number,
"category_id": self.get_be_national_register_number_id_category().id,
"partner_id": self.id,
}
result = self.env["res.partner.id_number"].create(values)
return result
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow removal of national number.

0 comments on commit d122c74

Please sign in to comment.