-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[MIG] Migrate auditlog module from 8.0 to 9.0 #454
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
Conversation
- Update documentation to point to the new auditlog menu locations. These were changed because the 8.0 version was referencing menus that do not exist in 9.0 - Change version from 8.0.1.0.0 to 9.0.1.0.0 - Make the module installable again - Remove an unused parameter from pre-migration.py for versioning - Update classes to follow OCA new api conventions, camel case instead of snake case - Fix typos and remove commented out blocks of code that were irrelevant
|
Hey @holdenrehg, thank you for your Pull Request. It looks like some users haven't signed our Contributor License Agreement, yet.
Appreciation of efforts, |
|
Here is a reference to my CLA signature odoo/odoo#12305 |
|
@holdenrehg
This one is CLA of odoo. Could you sign your CLA of oca https://odoo-community.org/page/cla too? |
…ields These were updated to follow OCA conventions. - License set to AGPL-3 - Images set to empty array
|
@moylop260 Checked and updated the license field. See here for the commit. |
|
Thank you |
|
you should follow the procedure outlined in https://github.com/OCA/maintainer-tools/wiki/Migration-to-version-9.0#howto to get 8.0's commits. This allows us to simply cherry pick changes afterwards and keeps history intact. |
|
Sounds good @hbrunn I'll pull in that 8.0 history and update the PR. |
|
@hbrunn It appears that all the 8.0 commit history is already there. There was an updated translations file that I pulled from the 12th after I migrated the module. |
|
you seem to run the commands mentioned above on your current branch, this won't give you the desired results. You need to start out from an upstream 9.0 branch, and then do do the stuff so that the commit history includes all of those: https://github.com/OCA/server-tools/commits/8.0/auditlog I also see that there are some commits that make the module better, but are not reflected in this PR, like 3f9152c |
…itlog.log' model (standard 'create_date' field is used instead)
…S.txt file removed
|
@hbrunn So is the proper way to perform the actions on an upstream branch and then merge into this PR? It will add 70+ commits to this PR. Want to make sure I'm handling this the correct way according to OCA conventions. |
|
yes, that's exactly what we want Just do all of this in a fresh branch and push overwrite this one. Or just close this PR and create a new one with your new branch. |
|
Ah thanks @hbrunn |
|
|
||
| Get the details: | ||
|
|
||
| .. image:: /auditlog/static/description/log.png |
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.
I set all these image URLs in my last PR, but it seems they do not work properly on apps.odoo.com (https://apps.odoo.com/apps/modules/8.0/auditlog/). We should change them to relative ones like static/description/IMAGE.png in order to have them displayed.
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.
Relative paths do not work when testing. I'll leave these as absolute for now.
auditlog/__openerp__.py
Outdated
| 'author': "ABF OSIELL,Odoo Community Association (OCA)", | ||
| 'license': "AGPL-3", | ||
| 'website': "http://www.osiell.com", | ||
| 'license': 'AGPL-3', |
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.
two is a crowd already: https://travis-ci.org/OCA/server-tools/jobs/137559872#L433
|
runbot error unrelated |
|
@hbrunn stripped out that duplicated license key, also thanks for mentioning unrelated runbot errors. Saw the same, related to other modules. |
|
Tested on Runbot, 👍 |
|
|
||
|
|
||
| def migrate(cr, version): | ||
| def migrate(cr): |
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.
I did not see this. We should not change the signature of the method here, even if the version parameter is not used. It seems that the migrate method is always called with this parameter: https://github.com/odoo/odoo/blob/9.0/openerp/modules/migration.py#L152
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.
In fact, this file should be totally removed, as the migration doesn't apply to the version 9.
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 right.
…is not required for version 9
…nit hook exists any more
| _order = "create_date DESC" | ||
| _rec_name = 'display_name' | ||
|
|
||
| display_name = fields.Char(u"Name", compute="_display_name") |
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.
s/_display_name/_compute_display_name/g
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.
any reason not to overwrite name_get instead? This will be the display name by default, with the added benefit that name_get also returns something sensible. Then you also don't need to set _rec_name. cf https://github.com/OCA/OCB/blob/9.0/openerp/models.py#L1664
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's better in this scenario? name_get seems to be less elegant if you still keep the computed display_name field. If you get rid of display_name and compute directly in name_get that has worse performance since it will be computed on every view load that has this model defined.
class AuditlogHTTPRequest(models.Model):
...
display_name = fields.Char(u"Name", compute="_compute_display_name")
@api.multi
@api.depends('create_date', 'name')
def _compute_display_name(self):
for httprequest in self:
create_date = fields.Datetime.from_string(httprequest.create_date)
tz_create_date = fields.Datetime.context_timestamp(
httprequest, create_date)
httprequest.display_name = u"%s (%s)" % (
httprequest.name or '?',
fields.Datetime.to_string(tz_create_date))
@api.multi
def name_get(self):
res = []
for request in self:
res += [(request.id, request.display_name)]
return resThere 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.
Is this a blocking point to migrate on 9.0? At best rename _display_name to _compute_display_name.
|
Please rebase the branch to make it mergeable |
|
Superseeded by #603 |
Syncing from upstream OCA/server-tools (9.0)
The majority of the module was already following new api conventions and not using any deprecated methods, so there was only minor clean up to move to over to 9.0