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

[11.0][mig] partner_academic_title #719

Merged
merged 9 commits into from
Apr 26, 2019

Conversation

luismontalba
Copy link
Member

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.

@luismontalba luismontalba changed the title [11.0][mig] partner_academic_title [WIP][11.0][mig] partner_academic_title Mar 20, 2019
@luismontalba luismontalba mentioned this pull request Mar 20, 2019
53 tasks
@pedrobaeza pedrobaeza added this to the 11.0 milestone Mar 20, 2019
@luismontalba luismontalba force-pushed the 11.0-mig-partner_academic_title branch from f3362fa to b14ad35 Compare March 20, 2019 19:46
@luismontalba luismontalba changed the title [WIP][11.0][mig] partner_academic_title [11.0][mig] partner_academic_title Mar 20, 2019
Copy link
Member

@tbaden tbaden left a 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

@luismontalba luismontalba force-pushed the 11.0-mig-partner_academic_title branch from b14ad35 to 982658e Compare April 24, 2019 21:18
@luismontalba
Copy link
Member Author

@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">
Copy link
Contributor

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>)
Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Member Author

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?

Copy link
Contributor

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:
Copy link
Contributor

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>
Copy link
Contributor

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,
Copy link
Contributor

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

Copy link
Contributor

@NL66278 NL66278 left a 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.

@luismontalba luismontalba force-pushed the 11.0-mig-partner_academic_title branch 4 times, most recently from d638bdb to 2bedb90 Compare April 26, 2019 07:35
@luismontalba
Copy link
Member Author

@NL66278 changes done, can I squash my commits?

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@luismontalba luismontalba force-pushed the 11.0-mig-partner_academic_title branch from 2bedb90 to 8d0defe Compare April 26, 2019 09:55
@luismontalba
Copy link
Member Author

OK, I didn't see the approval. Commits squashed

@NL66278 NL66278 merged commit 1cd51af into OCA:11.0 Apr 26, 2019
@luismontalba luismontalba deleted the 11.0-mig-partner_academic_title branch April 26, 2019 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants