Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0] partner_firstname cannot be installed, if the system contains a contact with an empty name #1677

Open
mohs8421 opened this issue Feb 28, 2024 · 5 comments
Labels
bug stale PR/Issue without recent activity, it'll be soon closed automatically.

Comments

@mohs8421
Copy link

mohs8421 commented Feb 28, 2024

When trying to install this module, I already get the following error:

RPC_ERROR
Odoo Server Error
Traceback (most recent call last):

File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 90, in new
odoo.modules.load_modules(registry, force_demo, status, update_module)
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 488, in load_modules
processed_modules += load_marked_modules(cr, graph,
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 372, in load_marked_modules
loaded, processed = load_module_graph(
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 249, in load_module_graph
getattr(py_module, post_init)(cr, registry)
File "partner_firstname/hooks.py", line 9, in post_init_hook
env["res.partner"]._install_partner_firstname()
File "partner_firstname/models/res_partner.py", line 220, in _install_partner_firstname
records._inverse_name()
File "partner_firstname/models/res_partner.py", line 193, in _inverse_name
record.lastname = parts["lastname"]
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1325, in set
records.write({self.name: write_value})

File "/usr/lib/python3/dist-packages/odoo/models.py", line 3798, in write
real_recs._validate_fields(vals, inverse_fields)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 1359, in _validate_fields
check(self)
File "partner_firstname/models/res_partner.py", line 206, in _check_name
raise exceptions.EmptyNamesError(record)
odoo.addons.partner_firstname.exceptions.EmptyNamesError: ('Fehler beim Namen des Partners 1270 .', 'Es ist kein Name eingetragen.')

It might be an issue referring to the general misconceptions about names also

  1. People have names.

Besides the edgecases, it might also be relevant for the system to be aware that the information about the firstname might simply be missing and only other details might be available.

Module

partner_firstname

To Reproduce

Affected versions: 16.0

Steps to reproduce the behavior:

  1. Create a Contact without a name, for example with only a phone number or an email
  2. Try to install the module

Expected behavior
The module should be installable

@mohs8421 mohs8421 added the bug label Feb 28, 2024
@mohs8421 mohs8421 changed the title partner_firstname cannot be installed, if in the system is a contact with an empty firstname partner_firstname cannot be installed, if the system contains a contact with an empty name Feb 28, 2024
@mohs8421
Copy link
Author

In my local system I resolved this issue with the following small change:

diff --git a/partner_firstname/models/res_partner.py b/partner_firstname/models/res_partner.py
index d933e8055..64bb9966d 100644
--- a/partner_firstname/models/res_partner.py
+++ b/partner_firstname/models/res_partner.py
@@ -214,7 +214,7 @@ class ResPartner(models.Model):
         correctly into the database. This can be called later too if needed.
         """
         # Find records with empty firstname and lastname
-        records = self.search([("firstname", "=", False), ("lastname", "=", False)])
+        records = self.search([("firstname", "=", False), ("lastname", "=", False), ("name", "!=", "")])
 
         # Force calculations there
         records._inverse_name()

mohs8421 added a commit to mohs8421/partner-contact that referenced this issue Feb 28, 2024
This change fixes this bug: OCA#1677

With that the module can be installed as only partners with names will be processed
@mohs8421 mohs8421 changed the title partner_firstname cannot be installed, if the system contains a contact with an empty name [16.0] partner_firstname cannot be installed, if the system contains a contact with an empty name Mar 15, 2024
@mohs8421
Copy link
Author

I have to wonder if this repository is still maintained?
I provided a bug report and a fix, and there is no reaction at all.

@simahawk
Copy link
Contributor

@mohs8421 thanks for your contrib.

I have to wonder if this repository is still maintained? I provided a bug report and a fix, and there is no reaction at all.

There are plenty of things to maintain as we have more than 230 repos and more than 5k modules 😉

I'm not a maintainer of that module but I'll have a look at your PR.

Copy link

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Oct 20, 2024
@mohs8421
Copy link
Author

so how does contributing work here?
Things don't get reviewed or merged and bots automatically tend to close contributions if they are left unattended? Isn't this behaviour actually harming for contributions in general?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

No branches or pull requests

2 participants