-
-
Notifications
You must be signed in to change notification settings - Fork 868
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
[11.0][mig] partner_academic_title #719
[11.0][mig] partner_academic_title #719
Conversation
…ble to remove spaces in the separator definition by overriding the method _get_separator.
f3362fa
to
b14ad35
Compare
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.
thanks for the work. please squash your commits.
code lgtm
b14ad35
to
982658e
Compare
@tbaden commits squashed |
<!-- Copyright 2015-2017 ACSONE SA/NV | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> | ||
<odoo> | ||
<data noupdate="1"> |
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.
data element is no longer needed. noupdate attribute can be added to odoo element. Please remove data and decrease indents of records.
@@ -0,0 +1,16 @@ | |||
# Copyright 2015-2017 ACSONE SA/NV (<http://acsone.eu>) |
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.
Put https: on copyright and license lines.
return ', ' | ||
|
||
@api.depends('academic_title_ids', 'academic_title_ids.sequence') | ||
@api.one |
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.
@api.one is deprecated. Use self.ensure_one() as first line in method.
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.
Changes done, but ensure_one() causes an error when building the runbot instance because the method is applied on a set of records. Maybe iterating with something like "for rec in self" inside the function?
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.
Yes that would be the solution. I had not taken into account the possibility that this could be called for multiple records. for rec in self
or for this in self
as i prefer (but that is purely personal taste), is fine.
display_title = "" | ||
separator = self._get_separator() | ||
title_ids = self.academic_title_ids.sorted(lambda r: r.sequence) | ||
for title in title_ids: |
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.
More pythonic (and readable) to do something like separator.join([title.name for title in title_ids])
<!-- Copyright 2015-2017 ACSONE SA/NV | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> | ||
<odoo> | ||
<data> |
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.
Get rid of data tag here as well.
class PartnerAcademicTitle(models.Model): | ||
_name = 'partner.academic.title' | ||
|
||
name = fields.Char(required=True, |
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.
Please use the same identation style here as for the field definitions in res_partner.py
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.
Nice additions, but code can use some improvements. See separate comments.
d638bdb
to
2bedb90
Compare
@NL66278 changes done, can I squash my commits? |
This PR has the |
2bedb90
to
8d0defe
Compare
OK, I didn't see the approval. Commits squashed |
Migration to 11.0.
This module was written to adds possibility to define some academic titles and
to add multiple titles on partners. there is a sequence on titles to display
them in an order on the partner.