-
-
Notifications
You must be signed in to change notification settings - Fork 77
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
[FIX]do not delete module version if already exists and just update #30
[FIX]do not delete module version if already exists and just update #30
Conversation
OCA/apps-store#31 will be solved after this PR merged. |
@RoelAdriaans @oscarolar @StephanRozendaal Can anyone of you please review this. |
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.
LGTM
Why Travis is red? |
@pedrobaeza https://github.com/OCA/interface-github/blob/11.0/github_connector/models/github.py#L75 this is the normal python Class and Travis is expecting a Super call for changes are Not from my commit. |
Looks like the flake8 test failed, in the log I see:
|
Yes, you should remove previous line too. But I wonder why it was there initially, as this seems to be put on purpose. @legalsylvain @cubells any idea? |
Not needed code removed. thanks @StephanRozendaal |
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.
Hi, I understand that it is problematic with the new appstore !
this code was designed to be sure that all the module version was up to date. I mean to handle situations where a module version moved out of the repository.
I think we should replace this code by another, to test if the module still exist, and if not, delete obsolete module version.
please ping me if I'm not clear.
@legalsylvain okay clear, You mean to say at the end of the cron job we should call the module and module version verification method. |
Makes sense to me too |
Not exactly. I mean : when we analyse again, if a module.version disappeared from the repository we should drop it. (and so the appstore should drop the related products also) so kind of algorithm like :
(something like that) |
you mean inactivate. When it reappears we just reactivate the product. @hbrunn has an interesting idea that we could develop later to create products in Alpha maturity level for open PR with green travis. We should be able to activate/inactivate a version after discovery IMO |
this seems little tricky as we do process always all the branches. we just project the branches which have state |
Looks like a good idea to one specific cron job to have one pass on all module and change the |
as per that, I have added a new cron job for cleaning up the Odoo module version. |
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 design, thanks !
A blocking point about path. LGTM otherwise.
regards.
def clean_odoo_module_version(self): | ||
for module_version in self: | ||
module_ver_path = os.path.join( | ||
module_version.repository_branch_id.local_path, |
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.
You should base your analyse about local_path
, but on module_paths
. Otherwise, analysis of project base on Odoo. (OCB, OpenUpgrade, will fail).
so a for each is required.
see line 87 (previously 94) of the same file.
module_version.technical_name) | ||
if os.path.exists(module_ver_path): | ||
continue | ||
module_version._process_clean_module_version() |
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.
why not just move_version.unlink() ? and removing the function _process_clean_module_version
.
(sorry for the noice, just understood that point, reading https://github.com/OCA/apps-store/pull/36/files#diff-65d1a23272a69d00ef4e64370b596546R10
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 have a question (I am not able to see it in the code sorry).
I understand the pseudo code as followed:
- if a module is present we check whether there is a product associated (active or inactive)
- if product is inactive -> activate and publish
- if module is not present and there is a product -> inactivate and unpublish
I think this is what you do here: https://github.com/OCA/apps-store/pull/36/files but I just want to be sure
@elicoidal yes the flow is exactly what you say. |
@legalsylvain changes are done as per your suggestion. and |
I don't understand that point. I'm running this module in local instance, and I analyse correctly modules, downloading the code of https://github.com/odoo/odoo and the analysis of the modules of Odoo core works fine. |
Sorry for the previous update. "Now" is autocorrected in mind by "Not". and that has changed the complete meaning of the Sentence. |
OK. ;-). |
indeed push was not done. |
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.
minor non blocking point. LGTM. code review, no test.
Thanks for the changes.
for module_version in self: | ||
# Compute path(s) to analyze | ||
branch = module_version.repository_branch_id | ||
if branch.module_paths: |
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.
Hi thanks.
Not blocking point. (can be done later).
it could be great to refactor this lines because duplicated with a new function in repository.branch model named :
@api.multi
def _get_module_paths:
self.ensure_one()
branch = self
if branch.module_path
paths = []
for path in branch.module_paths.split('\n'):
if path.strip():
paths.append(os.path.join(branch.local_path, path))
else:
paths = [branch.local_path]
return paths
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.
Instead, I would suggest having a new functional field.
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.
sorry my bad it will be not possible as we might have list in paths
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.
As you wish on that point.
- it can be the function, (as proposed).
- it can be a new computed field my_computed_field = fields.Char(help="coma separated path") (as in ADDONS_PATH syntax), that we have just to split after.
no clear point of view on that point.
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.
removed redundant code and added function for that.
@StephanRozendaal can you please review again because few things are changed after your approval. |
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.
LGTM
@StephanRozendaal are we good to go? |
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.
LGTM
thanks @StephanRozendaal merging |
…CA#30) * [FIX]do not delete module version if already exists and just update * [FIX]remove not needed code * [IMP] added clean odoo module version cron * [IMP]support module_paths also * [IMP]separate function fo the module path to remove redundant code
…CA#30) * [FIX]do not delete module version if already exists and just update * [FIX]remove not needed code * [IMP] added clean odoo module version cron * [IMP]support module_paths also * [IMP]separate function fo the module path to remove redundant code
…CA#30) * [FIX]do not delete module version if already exists and just update * [FIX]remove not needed code * [IMP] added clean odoo module version cron * [IMP]support module_paths also * [IMP]separate function fo the module path to remove redundant code
…CA#30) * [FIX]do not delete module version if already exists and just update * [FIX]remove not needed code * [IMP] added clean odoo module version cron * [IMP]support module_paths also * [IMP]separate function fo the module path to remove redundant code
…CA#30) * [FIX]do not delete module version if already exists and just update * [FIX]remove not needed code * [IMP] added clean odoo module version cron * [IMP]support module_paths also * [IMP]separate function fo the module path to remove redundant code
…CA#30) * [FIX]do not delete module version if already exists and just update * [FIX]remove not needed code * [IMP] added clean odoo module version cron * [IMP]support module_paths also * [IMP]separate function fo the module path to remove redundant code
…CA#30) * [FIX]do not delete module version if already exists and just update * [FIX]remove not needed code * [IMP] added clean odoo module version cron * [IMP]support module_paths also * [IMP]separate function fo the module path to remove redundant code
…CA#30) * [FIX]do not delete module version if already exists and just update * [FIX]remove not needed code * [IMP] added clean odoo module version cron * [IMP]support module_paths also * [IMP]separate function fo the module path to remove redundant code
…CA#30) * [FIX]do not delete module version if already exists and just update * [FIX]remove not needed code * [IMP] added clean odoo module version cron * [IMP]support module_paths also * [IMP]separate function fo the module path to remove redundant code
…CA#30) * [FIX]do not delete module version if already exists and just update * [FIX]remove not needed code * [IMP] added clean odoo module version cron * [IMP]support module_paths also * [IMP]separate function fo the module path to remove redundant code
…CA#30) * [FIX]do not delete module version if already exists and just update * [FIX]remove not needed code * [IMP] added clean odoo module version cron * [IMP]support module_paths also * [IMP]separate function fo the module path to remove redundant code
…CA#30) * [FIX]do not delete module version if already exists and just update * [FIX]remove not needed code * [IMP] added clean odoo module version cron * [IMP]support module_paths also * [IMP]separate function fo the module path to remove redundant code
If Odoo module version already exists then instead of updating that version it is deleting and creating a new one.
Expected behaviour after this PR, It will not delete the existing version.
Updating the existing version functionality is already there