-
-
Notifications
You must be signed in to change notification settings - Fork 846
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
Better partner_firstname. #104
Conversation
Hey @yajo, thank you for your Pull Request. It looks like some users haven't signed our Contributor License Agreement, yet.
Appreciation of efforts, |
Sorry because I sent the pull request and later I saw some mistakes. Now it's ready for review. I already sent the signed CLA. The point in upgrading this module is that I'm also creating a |
@yajo could you tell me under which name the CLA has been sent? I'm not able to identify you from the github login only. Thanks |
'description': """ | ||
This module splits first name and last name for non company partners | ||
==================================================================== | ||
Split first name and last name for non company partners |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move description under README.rst ? using OCA template: https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst
What do the coverage messages mean? Is there anything left to be done? Thanks. |
It means the quantity of the repo code that it's been tested automatically. The ideal is 100%. More reviews are needed to be merged. |
|
||
@property | ||
def value(self): | ||
raise NotImplementedError() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the point of subclassing if it is only used once? Can we merge these two Exceptions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a common pattern I follow for modules: do a base exception for that module and subclass it. It helps with submodules and tests. However, seems like after finishing only one possible exception was left, so I will merge it as you say.
Could we add a test for _install_firstname and for the exceptions' value functions? There are also a few branches in _name_inverse which could use a test case. |
👍 |
Hardly, the method's effect can be checked only by creating a partner, then installing the module and then checking the partner's firstname and lastname, because after installing the module all that happens automatically with the constraints. On the other hand, to run tests, you have to install the module first. Suggestions are welcome, however.
After the last update, it's not necessary now.
I'm working on all of it, I'll update soon. Thanks everyone! |
Everything fixed AFAIK. |
@api.depends("firstname", "lastname") | ||
def _name_compute(self): | ||
"""Write the 'name' field according to splitted data.""" | ||
self.name = " ".join((p for p in (self.lastname, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a detail but u" ".join seems better
Some details but it is globally OK. Thanks |
👍 tested on production instance |
@yajo I've PR https://github.com/grupoesoc/partner-contact/pull/1 to you to be able to select names order ('firstname lastname' or 'lastname firstname'), please review, thanks |
@antespi Wow you were faster than me in testing on production! 😄 To others... seems like runbots hate me 😕:
|
@yajo we have in several production enviroment firstname's module with a couple of issues that are correctect with your fix, that's why! :-D |
This happened because the invert method was not being called when using the UI, and because lastname & firstname fields were required while hidden.
Coveralls fails because the code is shorter, so it should be considered OK. |
👍 |
Sorry to bother you again, but I found a bug with the onchange method that I'm fixing right now. Maybe you want to roll this back before it's too late. |
Please make it the PR fast and I'll fast track it. |
I could not fix it in time, I'll patch it this monday. Sorry for that, the bug was just in the very one line that is not tested 😁. Is there a way to unit test onchange methods? |
@yajo say
|
@hbrunn You guys are awesome. You'll have the fix tomorrow. |
Pros:
provide either the last or the first name.
Cons:
suffix is added to the first name instead of the last name. However,
the user is expected to replace that word for the real one, so this
should not be a big problem.