[IMP] while clean the odoo module version archive the product - #36
Conversation
|
@RoelAdriaans @oscarolar @StephanRozendaal Please review. |
| product = self.env['product.product'].search( | ||
| [('odoo_module_version_id', '=', module_version.id)]) | ||
| product.write({'active': False}) | ||
| all_varient_archived = all( |
| @@ -0,0 +1,25 @@ | |||
| # Copyright (C) 2017-Today: Odoo Community Association (OCA) | |||
|
there is a typo in the name of the file -> odoo_module_version.py |
|
@elicoidal @legalsylvain thanks for your comments. changes are done as suggested. sorry for typos |
|
@oscarolar @RoelAdriaans @StephanRozendaal @legalsylvain can you please review this PR. |
legalsylvain
left a comment
There was a problem hiding this comment.
LGTM. Thanks for this work.
(code review / no test).
|
once this PR and OCA/interface-git#30 both are merged. I will test on the migration database for the process to fix old products. and then we can proceed for the update on the production. |
|
@oscarolar @RoelAdriaans @StephanRozendaal if you have the opportunity to review? |
|
@elicoidal we have already 2 approval e can go ahead if we want. |
| product = self.env['product.product'].search( | ||
| [('odoo_module_version_id', '=', module_version.id)]) | ||
| product.write({'active': False}) | ||
| all_variant_archived = all( |
There was a problem hiding this comment.
Since you are making 3 iterations(all, for, mapped) here I think you should use something with less performance impact:
active_variants = product_obj.search_count(
[('product_tmpl_id', '=', product.product_tmpl_id.id),
('active', '=', True)])
if not active_variants:
product.product_tmpl_id.write({'active': False, 'website_published': False})what do you think?
There was a problem hiding this comment.
@oscarolar thank you for your suggestion, You are right, I have changed the code as per your suggestion.
cc @elicoidal
There was a problem hiding this comment.
I do not see the change here. Did I miss somethign?
There was a problem hiding this comment.
something strange with github this still shows the outdated changes.
https://github.com/OCA/apps-store/pull/36/files#diff-87908d4d380713ee148592d4aa5e5069R16
please find the changes it is there already
|
@oscarolar please have a look but I think your remark was attended |
|
@gurneyalex The OCA/interface-github + OCA/apps-store repository should be refreshed in our ERP (not urgent) |
|
@elicoidal @gurneyalex yes code can be pulled on the server. |
|
@bizzappdev could you have a look at Travis too because something got broken in the process. |
|
@elicoidal https://travis-ci.org/OCA/apps-store/builds/446015225?utm_source=github_status&utm_medium=notification |
|
https://travis-ci.org/OCA/apps-store/builds/446534958?utm_medium=notification&utm_source=email
I am not sure why transifex is failing though: not sure it is important
|
|
@sbidoul maybe can help |
|
@elicoidal it is failing for |
|
makepot failed to push to github because in the meantime another commit (the readme update) was made. But that commit triggered a new travis build which itself succeeded: https://github.com/OCA/apps-store/commits/11.0 So all is well. |
|
Shall I install this on odoo-community.org? |
|
@sbidoul yes please 😄 |
|
@sbidoul @gurneyalex along with the update on the odoo-community.org. we have to update the latest code for interface-github repo also as OCA/interface-git#30 as the current PR is depending upon this As there are missing product variant and odoo module version. |
|
Installed. The above script is running right now. |
|
Still running... |
|
@bizzappdev thanks for the detailed procedure. |
|
It's done. Can you please check everything is ok? |
|
No it is not fixed.. not sure qhy. Do you think we should have screen sharing session or something tomorrow. |
|
Hm, perhaps because I forgot to upgrade interface-github. I'm relaunching the script. |
* [IMP] while clean the odoo module version archive the product * [FIX]Added new line at the end of file * [FIX] fix some typo * [IMP]improve logic with less iterations
* [IMP] while clean the odoo module version archive the product * [FIX]Added new line at the end of file * [FIX] fix some typo * [IMP]improve logic with less iterations
* [IMP] while clean the odoo module version archive the product * [FIX]Added new line at the end of file * [FIX] fix some typo * [IMP]improve logic with less iterations
* [IMP] while clean the odoo module version archive the product * [FIX]Added new line at the end of file * [FIX] fix some typo * [IMP]improve logic with less iterations
* [IMP] while clean the odoo module version archive the product * [FIX]Added new line at the end of file * [FIX] fix some typo * [IMP]improve logic with less iterations
in reference to OCA/interface-git#30
when the Odoo module version will be deleted it will archive the related product variant.
If there will be no other product related to that product template then it will archive and unpublish the product template.